Saturday, 6 May 2017

How to publish NPM Scoped Packages

I want to start publishing npm packages to a scope. Do I need to register as a user with the scope as my user name? For example is doing the following enough to publish the @npmtestscope/firstpackage and if not what additional steps need to be taken (I'm already able to publish npm packages in general)?

    ole@MKI:~/firstpackge$ npm init
    This utility will walk you through creating a package.json file.
    It only covers the most common items, and tries to guess sensible defaults.

    See `npm help json` for definitive documentation on these fields
    and exactly what they do.

    Use `npm install <pkg> --save` afterwards to install a package and
    save it as a dependency in the package.json file.

    Press ^C at any time to quit.
    name: (firstpackage) @npmtestscope/firstpackage
    version: (1.0.0) 
    description: 
    entry point: (index.js) 
    test command: 
    git repository: 
    keywords: 
    author: 
    license: (ISC) 
    About to write to /home/ole/deletethis/package.json:

    {
      "name": "@npmtestscope/firstpackage",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "",
      "license": "ISC"
    }


    Is this ok? (yes) 

    ole@MKI:~/firstpackage$ touch README.md
    ole@MKI:~/firstpackage$ npm publish



via Ole

No comments:

Post a Comment