Stolen from rackt/redux
.
Relevant package.json snippet:
"build:lib": "babel src --out-dir lib",
"build:umd": "webpack src/index.js dist/my-pkg-name.js --config webpack.config.development.js",
"build:umd:min": "webpack src/index.js dist/my-pkg-name.min.js --config webpack.config.production.js",
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min",
You shouldn't need to build manually for publishing. Use the npm lifecycle hooks below to automate it.
npm version patch -m "Summary of this version"
Relevant npm lifecycle scripts in package.json
, e.g:
"preversion": "npm run clean && npm run lint",
"version": "npm run build",
"postversion": "git push && git push --tags && npm run clean",
Ensure logged in:
npm adduser
npm login
Check owners of a package:
npm owner ls
Add another user as an owner (so they can publish):
npm owner add ...
To actually publish the current directory (after doing npm version first):
npm publish
To check what would be published, check with npm pack to generate a tarball:
npm pack
If things are being excluded, check for the presence of .npmignore
, if it's missing, then
npm will use the default which will exclude many things. So, either override with an empty
.npmignore
file to incluce everything, or tweak to your liking.