npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ekhtest/workspace-release-cli

v0.4.0

Published

A streamlined release tool for monorepos that bumps package versions and creates package-level changelogs based on conventional commits.

Downloads

71

Readme

workspace-release

DO NOT USE THIS PACKAGE: IT IS A TEST PACKAGE AND WILL BE MOVED TO IT'S FINAL HOME

workspace-release is a tool for bumping semantic versions in a workspace/monorepo, adhering to the Conventional Commits standard. It can also generates a CHANGELOG.md file for each package in the workspace/monorepo along with support for generating custom changelog web pages.

WARNING: we use the name in package.json as part of the release process. we generate a tag with the package name + version (example tag: @org/[email protected]) and use that tag in future releases to find out which files have changed. If you change the package name, you'll need to add a git tag with the existing version and new package name.

Features

  • super easy to setup and use
  • workspace/monorepo agnostic. in fact, you don't even need to have a monorepo setup for workspace-release to work.
  • builds a CHANGELOG.md file for each package and the github repo itself
    • you can replace your existing release utilities because we completely rebuild the CHANGELOG.md files on every release.
  • bumps package versions in all your packages
    • tags references using @org/packagename@version enabling tracking of versions in the same repository

NOTE: there are currently no command line options. if you need command line options to chnage the defaults, create a github issue and we'll try add the command line option.

Setting up workspace-release

For each package that you want to generate a CHANGELOG.md file, bump the package version and publish the changes to a registry (like npmjs.com):

1a) Add to package.json a release amd publish script. You can name it anything but we recommend ci:release and ci:publish

{
  "scripts": {
    "ci:release": "npx workspace-release release",
    "ci:publish": "npx workspace-release publish"
  }
}
  1. In your pnpm workspace/monorepo add recursive calls using pnpm (use a similar approach if you are using other package managres like npm, lerna, etc.).
{
  "scripts": {
    /// release all of the packages && then release the workspace
    "ci:release": "pnpm run --recursive ci:release && pnpm workspace-release release",
    /// note that we don't publish the workspace
    "ci:publish": "pnpm run --recursive ci:publish",
  }
}

Setup Publishing to npmjs.com

  1. Create an account at https://www.npmjs.com/signup.
  2. Generate a CLASSIC AUTOMATION access token at https://www.npmjs.com/settings/erichosick/tokens.
  • note the token
  1. In ~/.npmrc (or whever that file is). Add the following:
//registry.npmjs.org/:_authToken={your_automation_token}

Using workspace-release locally

To release run pnpm ci:release from the root of the project. This will bump the versions of all packages that have relevant changes since the last release

Now that all versions are bumped, we can safely publish all of the packages by running pnpm ci:publish from the root of the project.

With all versions bumped, we can rely on pnpm workspace to update all the versions within the package.json with the latest version.

How workspace-release works

Our approach is:

  1. run git log @org/[email protected]:
  2. filter out any files that are not part of the package workspace-release was ran in
  3. for the filtered commit messages and using the conventional commits standard standard:
    • we bump the version
    • we update/re-build the package CHANGELOG.md
  4. We add a tag of @org/[email protected] for each package that had a version bump.

IMPORTANT: Because of the way workspace-release works, we recommend that you create commits that only contain files from a single package: stacking up multiple commits on a single branch.

Setting up CI/CD Workflow

workspace-release can be used in your CI/CD workflow in any way you like. following is an example workflow:

  1. in main, run pnpm ci:release (manually or via ci/cd)
  2. optionally publish to npmjs by running pnpm ci:publish

NOTE: by default, workspace-release must be ran in main and the git barnch must be clean (no unstaged changes, untracked files, etc.).

Github Actions CI/CD

  1. For the repository you want to run workspace-release, go to https://github.com/{organization}/{repository}/settings/environments and add a PACKAGE_REGISTRY_ACCESS_TOKEN environment variable. For npmjs.com add the value generated by following the steps in Setup Publishing to npmjs.com.
  2. Add the

Works Well With

We recommend:

  • pnpm: as the package manager
  • nx: for quick parallel builds

Questions

Why do I have to add ci:release to every package?

We don't know anything about your workspace/monorepo or CI/CD process. In fact, workspace-release can even work without a workspace/monorepo. All we know how to do is look at the commit logs, filter for changes on a specific package, and update/generate log files like CHANGELOG.md files.

Why Did We Make This

There are a lot of requests to support workspace/monorepo changelog.md files. There are work arounds for some of the tools that bump versions and generate changelogs but nothing that focuses 100% on workspacess/monorepo. We designed this from the ground up as being workspace/monorepo centric.

Example features request:

Other Information

To be added.