-
Notifications
You must be signed in to change notification settings - Fork 0
NPM package development
Luis Beu edited this page Aug 27, 2023
·
1 revision
- Create a new branch.
- Code the feature.
- Make sure to update the version and the changelog.
- Push the feature branch.
- Check all qa checks and comments.
- Test the package with the GitHub registry where the feature versions are stored. See Using the GitHub package registry for feature testing.
- Merge.
- Test the package with the
next
dist tag. See Usage of dist-tag with npm - Create a release.
GitHub actions will publish a 'feature' version of every created pull request to the GitHub package registry. This is done to enable full and easy testing for inside docker containers and alike.
To enable this you need to follow NPM registry authenticating-with-a-personal-access-token.
You can add a function in your .bashrc
to easily switch between the default npm registry and the GitHub one:
npmDev(){ echo "Using develop registry"; npm config set @beuluis:registry https://npm.pkg.github.com; npm "$@"; npm config set @beuluis:registry http://registry.npmjs.org }
This script will temporary alter the npm registry for @beuluis
scoped packages.
To install a 'feature' version of a package during development you can run this command:
npmDev i @beuluis/{packageName}@{featureBranch}
https://docs.npmjs.com/cli/v9/commands/npm-dist-tag
To make use of other tags as latest
just use:
npm i @beuluis@{distTag}
- Go on the release page of the repository and click
Draft a new release
. - Click on
Choose a tag
and input the version you specified in thepackage.json
. - Click
Create new tag: *
. - Click on
Generate release notes
. - Make changes if needed.
- Publish release.