Pnpm Changesets Publish npm Packages
Introduction
pnpm Monorepo multi-package project, using changesets to publish npm packages.
Solution
- Log in to your npm account
Confirm the current local registry address
npm config get registry
Just display https://registry.npmjs.org/
, if not, use the following command to switch
npm config set registry https://registry.npmjs.org/
Then check the currently logged in npm account
npm whoami
If it is not the account you want, log out
npm logout
Log in to your account again
npm login
- Install Changesets
install dependencies
npm install @changesets/cli
- Add the package you want to publish
npx changeset
Follow the interactive prompt to select the subpackage you want to publish
D:\code\github\openHacking>npx changeset
๐ฆ Which packages would you like to include? @openHacking/core
๐ฆ Which packages should have a major bump? ยท No items were selected
๐ฆ Which packages should have a minor bump? ยท No items were selected
๐ฆ The following packages will be patch bumped:
๐ฆ @openHacking/core@0.0.1
๐ฆ Please enter a summary for this change (this will be in the changelogs).
๐ฆ (submit empty line to open external editor)
๐ฆ Summary init npm package
๐ฆ
๐ฆ === Summary of changesets ===
๐ฆ patch: @openHacking/core
๐ฆ
๐ฆ Note: All dependents of these packages that will be incompatible with
๐ฆ the new version will be patch bumped when this changeset is applied.
๐ฆ
๐ฆ Is this your desired changeset? (Y/n) true
๐ฆ Changeset added! - you can now commit it
๐ฆ
๐ฆ If you want to modify or expand on the changeset summary, you can find it here
๐ฆ info D:\code\github\openHacking\.changeset\rich-tools-pretend.md
- Upgrade version
npx changeset version
- Publish
npx changeset publish
Release Prerelease
Before releasing the official version, we may need to release the alpha, beta version, or prerelease version, and we need to use the changeset pre
command
enter
enters Prerelease mode
exit
exits Prerelease mode
Release Prerelease
yarn changeset pre enter next
yarn changeset version
git add .
git commit -m "Enter prerelease mode and version packages"
yarn changeset publish
git push --follow-tags
Exit Prerelease mode and start releasing release
yarn changeset pre exit
yarn changeset version
git add .
git commit -m "Exit prerelease mode and version packages"
yarn changeset publish
git push --follow-tags
Comments