1.0.8 • Published 8 years ago

creating-node-modules v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

#Creating Node Modules

  1. Create a package.json file

    $ npm init

  2. Automated response ask you questions to build the package.json file. ex: First it asks for a name, then version number, decription etc. Some fields have a default, others can be left blank.

  3. Next create an index.js file. In that file, add a function as a property of the exports object.	This will make the function available to other code. 
    
    ```
    // My module
     exports.printMsg = function() {  

    console.log("This message is from the npm-demo-pkg");
    }

    ```

    #Publishing Node Modules

  4. You can publish packages that are not node modules. In fact, any files that are buddled together with a package.json file can be handled as a module.

  5. 	The two required fields are the name and the version.
  6. Create a user with the npm registry.

    $ npm adduser

    ls will can show you the information that is stored locally for your user. You can also test that your new user has been created by going to: npmjs.org/~

  7. Finally publish the node module.

    $ npm publish

1.0.8

8 years ago

1.0.7777777

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago