MCPcopy
hub / github.com/stackblitz-labs/pkg.pr.new

github.com/stackblitz-labs/pkg.pr.new @v0.0.77 sqlite

repository ↗ · DeepWiki ↗ · release v0.0.77 ↗
88 symbols 279 edges 50 files 0 documented · 0%
README

Cloudflare is now backing pkg.pr.new's data infrastructure!

pkg.pr.new

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.

  • 🚀 Instant Builds
  • 🍕 No Need for NPM Access
  • 🛠️ GitHub Workflows Friendly
  • 📦️ No Configuration
  • 🔩 Single Command
  • ✉️ Pull Request Comments
  • 🔥 Check Runs

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?

Badge

Show that your project uses pkg.pr.new by adding a badge to your README:

pkg.pr.new

How to Get a Badge for Your Repository

  1. Automatically on Repository Page: Visit your repository page at https://pkg.pr.new/~/OWNER/REPO and you'll find a badge with a copy button that will copy the markdown code for you.

  2. Direct Badge URL: Use this format to create a badge for your repository: markdown [![pkg.pr.new](https://pkg.pr.new/badge/OWNER/REPO)](https://pkg.pr.new/~/OWNER/REPO) Just replace OWNER and REPO with your GitHub username/organization and repository name.

These are some of the projects and companies using pkg.pr.new:

Sanity

    <img height="40" src="https://raw.githubusercontent.com/intlify/art/master/logo_symbol.svg">

    <img height="40" src="https://raw.githubusercontent.com/vite-pwa/.github/main/hero-light.svg">

Vue Mess Detector Logo WXT Framework Logo

Preply

playcanvas-react

Resend

React Email

Feel free to add your project or company here to join the pkg.pr.new family :)

You can also join our discord server here, so we all have fun together!

Setup

First install the GitHub Application.

[!IMPORTANT] Make sure it's installed on the repository before trying to publish a package. To read about the permissions the app needs, check #305.

After installing on your repository, run pkg-pr-new from your lockfile in workflows (for example with pnpm exec pkg-pr-new publish) to get continuous releases.

npm install --save-dev pkg-pr-new

For workspaces and monorepos:

pnpm exec pkg-pr-new publish './packages/A' './packages/B' # or `pnpm exec pkg-pr-new publish './packages/*'`

You can also pass prebuilt tarballs (.tgz or .tar.gz) directly, which is handy when your build pipeline already produces tarballs in a custom way:

pnpm exec pkg-pr-new publish './artifacts/*.tgz'

[!NOTE] Prebuilt tarballs are uploaded as-is: pkg.pr.new will not repack them. If one tarball references another tarball being published in the same call, pkg.pr.new will print a warning and that reference will not be rewritten to a pkg.pr.new URL. Repack with the resolved version yourself if you need cross-package linking.

[!CAUTION] In CI environments, avoid npx, pnpm dlx, yarn dlx, and bunx for this step. Install pkg-pr-new as a dependency and execute it from the lockfile (npm exec, pnpm exec, yarn, or bun run).

[!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.

pnpm exec 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.

Compact URLs are the default (and will fall back to long form if npm metadata is unavailable). To force long-form URLs, use --no-compact:

pnpm exec pkg-pr-new publish --no-compact './packages/A' './packages/B'

Compact URLs rely on your package being published on npm with a valid repository field in package.json. See this. pkg.pr.new is case sensitive, if the GitHub owner is PuruVJ, the package.json repository field should not have puruvj.

With default compact URLs:

npm i https://pkg.pr.new/tinybench@a832a55

With --no-compact or if npm metadata is unavailable:

npm i https://pkg.pr.new/tinylibs/tinybench/tinybench@a832a55

For CLI applications you might want to show npx instead of npm i for the preview command. This can be accomplished with the --bin flag:

pnpm exec pkg-pr-new publish --bin

With --bin:

npx https://pkg.pr.new/pkg-pr-new@a832a55

Without --bin:

npm i https://pkg.pr.new/pkg-pr-new@a832a55

You can control publishing comments with --comment:

pnpm exec 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.

--commentWithSha specifies whether to replace the PR number with the commit SHA in the generated comments.

With --commentWithSha:

pnpm exec pkg-pr-new publish --commentWithSha

Generated comments use commit SHA URLs:

```sh npm i https://pkg.pr.new/tinybe

Extension points exported contracts — how you extend this code

R2UploadedPart (Interface)
(no doc)
packages/cli/index.ts
User (Interface)
(no doc)
packages/app/shared/types/index.ts
ProcessEnv (Interface)
(no doc)
packages/cli/environments.ts
PullRequest (Interface)
(no doc)
packages/app/shared/types/index.ts
Contributions (Interface)
(no doc)
packages/app/shared/types/index.ts
WorkflowData (Interface)
(no doc)
packages/app/server/types.ts
PullRequestData (Interface)
(no doc)
packages/app/server/types.ts

Core symbols most depended-on inside this repo

useBinding
called by 12
packages/app/server/utils/bucket.ts
useBucket
called by 9
packages/app/server/utils/bucket.ts
fetchWithRetry
called by 5
packages/cli/index.ts
hijackDeps
called by 4
packages/cli/index.ts
parsePackageJson
called by 4
packages/cli/index.ts
generatePublishUrl
called by 4
packages/app/server/utils/markdown.ts
useWorkflowsBucket
called by 4
packages/app/server/utils/bucket.ts
abbreviateCommitHash
called by 3
packages/utils/index.ts

Shape

Function 69
Interface 19

Languages

TypeScript100%

Modules by API surface

packages/app/server/utils/bucket.ts17 symbols
packages/cli/index.ts11 symbols
packages/app/server/api/repo/search.get.ts7 symbols
packages/app/server/api/repo/commits.get.ts7 symbols
packages/utils/index.ts6 symbols
packages/app/server/utils/markdown.ts6 symbols
packages/app/server/utils/driver.ts4 symbols
packages/app/server/types.ts4 symbols
packages/app/shared/types/index.ts3 symbols
packages/app/server/utils/types.ts3 symbols
packages/app/server/utils/template.ts3 symbols
packages/app/server/utils/octokit.ts3 symbols

Dependencies from manifests, versioned

@actions/core3.0.1 · 1×
@antfu/eslint-config3.12.1 · 1×
@cloudflare/vitest-pool-workers0.6.8 · 1×
@cloudflare/workers-types4.20240512.0 · 1×
@iconify-json/ph1.1.14 · 1×
@jsdevtools/ez-spawn3.0.4 · 1×
@nuxt/eslint0.7.4 · 1×
@nuxt/ui3.0.0-alpha.10 · 1×
@nuxtjs/mdc0.17.0 · 1×
@octokit/app15.1.1 · 1×
@octokit/auth-unauthenticated5.0.1 · 1×
@octokit/graphql8.1.1 · 1×

For agents

$ claude mcp add pkg.pr.new \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact