Publishing snapshots
Occasionally you may wish to publish a snapshot release so consumers can test package changes before doing a production publish.
Snapshot releases allow you to publish pending changes with a non-semver version that can be installed manually, but won't be updated automatically when apps install or update packages.
There are two pnpm scripts to help you prepare and publish a snapshot version, pnpm run snapshot:version and pnpm run snapshot:publish.
Both commands use a TAG environment variable to specify the snapshot tag. If no tag is provided, it defaults to snapshot:
TAG=pagination-test pnpm run snapshot:version
TAG=pagination-test pnpm run snapshot:publish
Or set the tag for both commands at once:
export TAG=pagination-test
pnpm run snapshot:version
pnpm run snapshot:publish
This is especially important for the publish command, because if no tag is supplied artifactory will add the latest tag to the snapshot release, which will cause consumers to install the snapshot version by default.
The --no-git-tag flag is automatically included in the snapshot:publish script to prevent creating unnecessary git tags for temporary snapshot releases.
- Pull the latest master branch.
- Create a branch for the snapshot change. While you won't be committing any changes it is good to be off master.
- Run TAG=your-tag-here pnpm run snapshot:version.
- The version script will update all updated packages to the snapshot version.
- Check the versions are all updated as expected.
- Run TAG=your-tag-here pnpm run snapshot:publish. Do not forget to supply the tag.
- You can confirm that the package has been published by checking for the version in artifactory.
- If you wish to share updated docs with consumers, publish the master branch to staging and share the staging link.
Remember, there is no need to commit these changes, and they should never be merged to master.