npm-module-template
Template project for building KrimzenNinja npm modules
Prerequisites
Install Chandler to sync your CHANGELOG.md
entries to GitHub
Getting Started
Delete this from the readme once you have setup your project.
- Copy this template.
- In the
package.json
file update the following fields:name
description
repository.url
keywords
bugs.url
homepage
license
if private thenUNLICENSED
- In the
CHANGELOG.md
file, update the path tounreleased
. - Replace the
README.md
file. - Make sure the included
LICENSE
file is appropriate. if private then delete the file. - In the
.circleci/config.yml
file:- Update the
working_directory
field. - If this is a private package then after
npm publish .
add--access restricted
- Update the
- Add the project to CircleCi if it is not picked up automatically
- Add the
$NPM_TOKEN
environment variable
API
How to publish to NPM
You can either do releases from the master branch or follow the LTS model and branch off when you do a release.
- Ensure you are on the branch you want to publish from.
- Decide based on what is going into the release how the version number is going to change, see Semantic Versioning for more info.
- The
CHANGELOG.md
file should have pending changes documented in theUnreleased
section, create a new heading for this version and cut the relevant changes and paste them into the new section. - Commit the changes to the
CHANGELOG.md
file. - Run one of the prebuilt publish commands that matches your
semver
patch
,minor
,major
npm run patch -m "A message that makes sense"
If none of the prebuilt ones fit, you can usenpm version [major | minor | patch | premajor | preminor | prepatch | prerelease] -m "A message that makes sense"
- If you didn't publish from master, make sure to merge back into master if you were fixing a bug or the changes released need to go back to master.
TODO
- Make a Yeoman generator to do all the steps.
- Add snyk &| nsp
- Update CI step to push coverage to codecov or coveralls
- Badges in the README.md
License
MIT © Ryan Kotzen