1.0.0 • Published 5 years ago

@evotionce/nodemoduleexample v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

nodeModuleExample

Create a node module

Source

  1. Create a package.json file
//Creates a package.json in root directoy with given SCOPE-NAME [user/org]
npm init --scope=@SCOPE-NAME

Note: Scopes are used to have unique module names. For example @npm/package-name (npm is the scope)

  1. Create file that is loaded when module is required Create the javascript file you defined for "main" in package.json and use exports to make it available to other code. Note: index.js is the default name

  2. Publish package to npm Note: If you are not logged execute npm login first Private/unscoped packages

npm publish

Scoped public packages

npm publish --access public
  1. Consume module

Package.json

  • "main": define starting point for node module