Note to self.
How to Publish
- Create an NPM account
- Create GitHub repo
- Clone repo with
git clone <url> - Inside the repo run:
npm init - Fill the required fields
- Push to Github:
git push origin master - Publish publicly:
npm publish
Basic Commands
- To publish a new version of the package:
npm version 1.0.0 && npm publish - To see the current profile:
npm profile get - To change a property:
npm profile set <property> <value> - To get current local version:
npm version - To update a specific package:
npm install package@latest - To update if the version change is minor:
npm update package
Whitelisting Specific Directories
This is useful to minimize the size of the package by not including unnecessary files present in the repo.
{
"name": "package-name",
"main": "./lib/index.js",
"files": [
"/allowed-directory"
]
}
Top comments (0)