Recent Changes - Search:

edit SideBar

NPMUpload

This page is for developers and is about how to upload the accessors package to the Node Package Manager (npm).

Testing

To test the package before uploading it, do

cd $PTII
mkdir node_modules
npm install org/terraswarm/accessor/accessors/web
What this does is read $PTII/org/terraswarm/accessor/accessors/web/package.json and create $PTII/node_modules/@terraswarm/accessors/.

How to upload

For this to work, you will need the terraswarm npm password. (See Accounts (group access only) and look in ealprivi/passwords/terra-npmjs.txt)

  1. cd accessors/web
  2. Increment the version number in accessors/web/package.json. To upload a new version of the module, npm requires that the version number be incremented.
  3. Login:
    bash-3.2$ npm login
    Username: terraswarm

    Password:
    Email: (this IS public) terraswarm-software@terraswarm.org

    Logged in as terraswarm on https://registry.npmjs.org/.
    bash-3.2$
  4. Upload:
    bash-3.2$ pwd
    /Users/cxh/ptII/org/terraswarm/accessor/accessors/web
    bash-3.2$ npm publish --access=public
    + @terraswarm/accessors@0.0.13
    bash-3.2$

Upload Synopsis

Below is roughly how the upload occurred. This information is mainly for debugging.

  1. Created an account via https://www.npmjs.com/signup
  2. Created accessors/web/package.js by running npm init. See Using A Package (npmjs.com docs)
  3. Edited accessors/web/package.js by hand and added some items after reviewing the jshints package.js file.
    {
      "name": "@terraswarm/accessors",
      "version": "0.0.1",
      "description": "Actor-oriented proxies for IoT",
      "main": "hosts/node/nodeHost.js",
      "author": {
        "name": "Edward A. Lee and others",
        "email": "eal@berkeley.edu",
        "url": "http://ptolemy.eecs.berkeley.edu/~eal"
      },
      "directories": {
        "doc": "doc",
        "test": "test"
      },
      "homepage": "{$ACCESSORS_HOME}/",
      "keywords": [
        "actor",
        "IoT"
      ],
      "repository": {
        "type": "svn",
        "url": "https://repo.eecs.berkeley.edu/svn-anon/projects/terraswarm/accessors/trunk/accessors"
      },
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },


      "license": "SEE LICENSE IN accessors-license.htm"
    }
    Things to notice
    1. "name": "@terraswarm/accessors", - The package is in the @terraswarm npm scope
    2. "main": "hosts/node/nodeHost.js", - The main file is located at this location.
  4. Ran npm login, and used my terraswarm credential, for the password, see https://wiki.eecs.berkeley.edu/ptolemy/Ptolemy/Accounts Accounts (group access only)and look in ealprivi/passwords/terra-npmjs.txt

.

  1. Ran npm publish --access=public, which published it.
  2. To test, see Installing Using NPM

See Also

Edit - History - Print - Recent Changes - Search
Page last modified on June 12, 2019, at 07:01 PM