pnpm pack
从软件包中创建一个 tarball。
配置项
--recursive, -r
添加于:v10.11.0
打包工作空间(Workspace)中的所有包。
--out <path>" title="直接链接到 --out " translate=no>
自定义 tarball 的输出路径。 可以使用 %s 和 %v来添加软件包名称和版本,例如, %s.tgz 或 some-dir/%s-%v.tgz。 默认情况下,tarball 以名称 <package-name>-<version>.tgz 保存在当前工作目录中。
--pack-destination <dir>" title="直接链接到 --pack-destination " translate=no>
pnpm pack 保存 tarball 的目录。 默认值为当前目录。
--pack-gzip-level <level>" title="直接链接到 --pack-gzip-level " translate=no>
指定自定义压缩级别。
--json
JSON 格式的日志输出。
--filter <package_selector>" title="直接链接到 --filter " translate=no>
添加于:v10.11.0
--dry-run
添加于:v10.26.0
Does everything a normal run does, except actually packing the tarball. Useful for verifying the contents of the tarball.
生命周期
prepackpreparepostpack
提示
You can also use the beforePacking hook to programmatically modify the package.json contents before the tarball is created. This is useful for removing development-only fields or adding publication metadata without modifying your local package.json.