Publishing Distributable Packages
January 25, 2023 ยท View on GitHub
Check Node.js version
Use the Node.js version used by ci-operator-buildroot image.
Check npm version
To check if the current installed version is outdated:
npm outdated -g npm
To install the latest version:
npm install -g npm@VERSION
Sync with upstream main branch
Make sure you're in sync with the upstream main branch:
git fetch upstream && git rebase upstream/main
Build packages
To update dependencies and build all distributable SDK packages:
yarn install
yarn build-libs
Alternatively, you can build a specific SDK package:
(cd ./packages/PKG_DIR ; yarn build)
Check package versions
Make sure the version field in the relevant package.json file(s) has the right value:
jq -r .version < ./packages/PKG_DIR/package.json
npm pkg set version=NEW_VERSION -workspace ./packages/PKG_DIR
Since our packages adhere to Semantic Versioning specification, any backwards incompatible API changes must be published under a new major version.
Check package changelogs
If present, make sure the CHANGELOG.md file of the given package(s) is up to date:
- Each changelog entry describes a notable change that may impact consumers of the package.
- Each version section may contain a notice with additional information, e.g. how to upgrade from a previous version.
See Common Changelog for details on good changelog practices.
Log into npmjs account
Only members of npmjs openshift organization can publish packages maintained in this repo.
npm login --scope=@openshift
Publish packages
To see the latest published version of the given package:
npm view $(jq -r .name < ./packages/PKG_DIR/package.json) dist-tags.latest
To verify the package before publishing:
npm publish ./packages/PKG_DIR --no-git-tag-version --dry-run
To publish the package, run the above command without --dry-run parameter.