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

未关闭
#489 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

@kunalgoesbyken 已经在做这个了。

开始于 2026年10月25日。

  • #565 来自 @kunalgoesbyken —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
typescript
领域
build-system, cli

调研方向

首先跟踪命令 pkg-pr-new publish --pnpm 中对 --template 的处理,并将其与现有的已发布 package 的 catalog: 解析进行比较。使用示例中的 template package.json 和 pnpm-workspace.yaml 作为输入,然后验证上传的 StackBlitz template 能够在没有未解析的 catalog: 引用的情况下完成安装。

由索引模型根据 Issue 内容生成。

描述

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:
主要语言
TypeScript
星标
1.9k
派生
131
平均合并
1 天 9 小时
30 天内合并 PR
6

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

stackblitz-labs/pkg.pr.new 的其他 Issue

查看 stackblitz-labs/pkg.pr.new 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。