stackblitz-labs / stackblitz-labs/pkg.pr.new

--template does not resolve pnpm catalog: references before uploading to StackBlitz

Open
#489 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.9k
Forks
127
PR merge metrics
No merged PRs in 30d

Description

Problem

When using --template with pkg-pr-new publish --pnpm, the template's package.json is copied verbatim to StackBlitz. If the template uses pnpm's catalog: protocol for dependencies, those references are not resolved — even though --pnpm correctly resolves catalog: in the published packages themselves.

This means any template that lives inside a pnpm workspace and uses catalog: will break in StackBlitz because the catalog: protocol has no meaning outside the workspace.

Example

Our CI command:

pnpm dlx pkg-pr-new publish --pnpm \
  --template './samples/pkg-new-template' \
  './packages/atomic' \
  './packages/headless'

Our template's package.json:

{
  "devDependencies": {
    "vite": "catalog:"
  }
}

The published packages correctly have catalog: resolved to real versions. But the template is copied as-is, so StackBlitz sees "vite": "catalog:" and fails to install.

Expected behavior

--template should resolve catalog: (and catalog:<name>) references in the template's package.json before uploading to StackBlitz, the same way --pnpm resolves them for published packages.

Current workaround

We run a script before pkg-pr-new publish that reads pnpm-workspace.yaml and replaces catalog: entries in the template's package.json with resolved versions.

Related
  • #204 — original catalog: support issue (fixed for published packages via --pnpm)
  • #446 — confirmation that --pnpm is the way to resolve catalog:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the --template handling in the pkg-pr-new publish --pnpm command and compare it with the existing catalog: resolution for published packages. Use the template package.json and pnpm-workspace.yaml from the example as inputs, then verify that the uploaded StackBlitz template installs without unresolved catalog: references.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.