Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish package to npmjs.com #66

Open
hsipeng opened this issue Aug 30, 2018 · 0 comments
Open

publish package to npmjs.com #66

hsipeng opened this issue Aug 30, 2018 · 0 comments
Labels

Comments

@hsipeng
Copy link
Owner

hsipeng commented Aug 30, 2018

npm publish package

environment

  • node
  • npm
  • nrm

change registry

nrm use npm

npm add a user

npm add-user

name:
password
email:

then you will receive a email to verify your email, Please check your junk mail list .

GitHub account

you must have a git repo to contain npm package source code.

local files

├── README.md
├── index.js
├── lib
│   └── index.js
├── package.json
└── test

this is a simple npm package template

package.json

some configure must be set

{
  "name": "your-package-name",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "repository": "your-https-git-repo",
  "keywords": [
    "hello",
    "test"
  ],
  "files": [
    "lib",
    "README.md"
  ],
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "your name  <your email>",
  "license": "MIT"
}

name and version is required.
and author must be the same you login.

login && publish

npm login

username:
password:

npm publish

you must git commit local branch before run npm publish

usually success ,and you will find your package, on npmjs.com

publish versions

$ npm version <patch|minor|major>, if you have already published to npm

- patch for bug fix
- minor for new feature
- major for breaking changes

npm pack or npm link to validate the module to be publish

$ npm publish

@hsipeng hsipeng added the npm label Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant