To guide you through committing changes along with bumping the version of the root monorepo's package.json
(e.g., from "version": "0.1.2-beta"
to "0.1.3-beta"
), then publishing a GitHub tag and release, and finally, only npm publishing the package considering the dist
location in an Nx monorepo, here's a structured approach:
-
Bump Version in Root
package.json
First, manually update the version in the root
package.json
or use a versioning tool compatible with your project setup. Nx offers commands that can help automate this process, but for manual changes, directly edit theversion
field. -
Commit Changes
Utilize the script defined in your
package.json
to lint and then commit your changes using Commitizen for a conventional commit message:yarn commit
This command will lint your changes and then guide you through creating a conventional commit message.
-
Create a Git Tag
After committing, create a Git tag corresponding to your new version:
git tag v0.1.3-beta
-
Push the Tag to GitHub
Push the tag to GitHub to facilitate tracking versions and potentially automating releases:
git push origin v0.1.3-beta
-
Create a GitHub Release
- Navigate to your repository's Releases section on GitHub.
- Click on Draft a new release.
- Use the tag you've pushed as the target for this release.
- Fill in the release title and description, detailing the changes or improvements made.
- Publish the release.
Since your dist
directory is located at the root of the Nx monorepo and you wish to publish only a specific package (@every-layout/react-tamagui
), follow these steps:
-
Build the Specific Package
If not already done, build the specific package to ensure the
dist
directory is up to date:yarn build
-
Navigate to the Package's Dist Directory
Change your current working directory to the package's distribution directory within the
dist
:cd dist/packages/react-tamagui
-
Publish the Package
Use npm or Yarn to publish the package. Since your
package.json
within thedist/packages/react-tamagui
directory already contains"publishConfig": {"access": "public"}
, you can publish directly:npm publish
or if you're using Yarn:
yarn publish
- Ensure you're logged into npm or Yarn with an account that has permissions to publish under the namespace you're using.
- Review the
npm publish
oryarn publish
documentation for additional flags or configurations that might be relevant to your specific needs, such as using a tag withnpm publish --tag beta
to publish under a specific distribution tag. - Automating some of these steps can streamline your workflow. Consider using CI/CD pipelines or Nx capabilities to automate version bumping, tagging, and publishing processes based on conventional commits and other triggers.