Publishing to GitHub and npm
The suggested way to publish to GitHub and npm will be described here.
Add changes to Git
Make your changes and commit them:
git add .
git commit -m "Add new feature"
Merging branches is not described here. It's generally best to run npm version after merging your feature branch into the main (or master) branch. This ensures that the version bump and tag are applied to the final state of the code that will be released.
Publish to npm
Update version number
Increase the number according to what is appropriate.
- In case of Spec-Up-T: https://github.com/trustoverip/spec-up-t/blob/master/package.json#L3
- In case of the Starterpack: https://github.com/trustoverip/spec-up-t-starter-pack/blob/main/package.json#L3
Use this command:
npm version <newversion> -m "Bump version to %s"
In this case that would be something like:
npm version 1.0.88 -m "Bump version to %s"
The % s in the npm version command is a placeholder that gets replaced with the new version number. When you run the command, npm automatically substitutes % s with the version number you specified.
npm automatically creates a new Git tag that matches the new version number you specified.
Push changes
Push the changes and the tag to the remote repository:
git push origin master --tags
or
git push upstream master --tags
where origin
and/or upstream
are the remotes that you have configured.
Publish to npm
Publish the new version to npm:
npm publish
The package files will now be uploaded. The new package will be available as soon as it is uploaded.