We call it "Continuous Releases" too.
With pkg.pr.new, each of your commits and pull requests will trigger an instant preview release without publishing anything to NPM. This enables users to access features and bug-fixes without the need to wait for release cycles using npm or pull request merges.
pkg.pr.new won't publish anything to NPM; instead, it leverages its own URLs, which are npm-compatible.
npm i https://pkg.pr.new/tinylibs/tinybench/tinybench@a832a55
# npm i https://pkg.pr.new/${owner}/${repo}/${package}@{commit}
It is aiming to reduce the number of these comments :)
This was fixed in #18. Can we release that fix?
These are some of the projects and companies using pkg.pr.new:
Feel free to add your project or company here to join the pkg.pr.new family :) You can also join our discord server [here](https://discord.gg/stackblitz), so we all have fun together! ## Setup First [install the GitHub Application](https://github.com/apps/pkg-pr-new). > [!IMPORTANT] > Make sure it's installed on the repository before trying to publish a package. After installing on your repository, you can run `npx pkg-pr-new publish` in your workflows and then you have continuous releases! ```sh npm install --save-dev pkg-pr-new # or `npx pkg-pr-new publish` ``` For workspaces and monorepos: ```sh npx pkg-pr-new publish './packages/A' './packages/B' # or `npx pkg-pr-new publish './packages/*'` ``` > [!IMPORTANT] > Make sure the pkg-pr-new command runs only once in a defined workflow (that's part of how it avoids spam)! So instead of multiple times running pkg-pr-new for each workspace package, the command should be run one time for all the desired packages using the pattern above. For templates (experimental): > [!NOTE] > With templates, pkg.pr.new will generate Stackblitz instances for the given directories with the new built packages. ```sh npx pkg-pr-new publish './packages/A' --template './examples/*' ``` By default, pkg.pr.new will generate a template called "default" which includes each built package in the dependencies. This can be disabled with `--no-template`. For shorter urls, `--compact` can be useful: ```sh npx pkg-pr-new publish --compact './packages/A' './packages/B' ``` > `--compact` requires your package to be a valid (published) package on npm with a specified `repository` field in the package.json! See [this](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository). pkg.pr.new is case sensitive, if the GitHub owner is `PuruVJ`, the package.json `repository` field should not have `puruvj`. With `--compact`: ```sh npm i https://pkg.pr.new/tinybench@a832a55 ``` Without `--compact`: ```sh npm i https://pkg.pr.new/tinylibs/tinybench/tinybench@a832a55 ``` You can control publishing comments with `--comment`: ```sh npx pkg-pr-new publish --comment=update # default ``` Using `--comment=update`, pkg.pr.new would generate one initial comment and then edit it in the following commits. With `--comment=create`, each commit would generate a comment for itself, useful for triggering workflows, like workflow execution using maintainer comments. And `--comment=off` would turn off comments for maintainers who prefer minimal pull requests. To customize which package manager is reflected in the comments, use the `--packageManager=XYZ` flag. XYZ can be one of the following: npm (default), pnpm, yarn, or bun. For repositories with many packages, comments might get too long. In that case, you can use `--only-templates` to only show templates. pkg.pr.new uses `npm pack --json` under the hood, in case you face issues, you can also use the `--pnpm` flag so it starts using `pnpm pack`. This is not necessary in most cases. pkg.pr.new is not available in your local environment and it only works in workflows. ### Examples #### Release each commit and pull request: ```yml name: Publish Any Commit on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - run: corepack enable - uses: actions/setup-node@v4 with: node-version: 20 cache: "pnpm" - name: Install dependencies run: pnpm install - name: Build run: pnpm build - run: pnpx pkg-pr-new publish ``` #### Release approved pull requests only: ```yml name: Publish Approved Pull Requests on: pull_request_review: types: [submitted] jobs: check: # First, trigger a permissions check on the user approving the pull request. if: github.event.review.state == 'approved' runs-on: ubuntu-latest outputs: has-permissions: ${{ steps.checkPermissions.outputs.require-result }} steps: - name: Check permissions id: checkPermissions uses: actions-cool/check-user-permission@v2 with: # In this example, the approver must have the write access # to the repository to trigger the package preview. require: "write" publish: needs: check # Publish the preview package only if the permissions check passed. if: needs.check.outputs.has-permissions == 'true' runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - run: corepack enable - uses: actions/setup-node@v4 with: node-version: 20 cache: "pnpm" - name: Install dependencies run: pnpm install - run: pnpx pkg-pr-new publish ``` > Releasing approved pull requests is the recommended way of having continuous releases. This ensures users always install approved and safe packages. > [!TIP] > For any in-repo branch not yet opened as a pull request, if pkg.pr.new has already run on it, a `@branch-name` tag will link to the latest commit.