pnpm pack
패키지에서 tarball을 만듭니다.
Files included in the tarball#
Use the files field in package.json to select files and directories. Patterns
support extglobs such as lib/!(*.test.js) and @(dist|lib). A files field
replaces the root .npmignore or .gitignore; ignore files inside selected
subdirectories still apply. An explicitly named file or internal symlink is
included even when its parent directory is excluded.
Brace ranges expand to individual values. For example, part{1..3}.js
matches part1.js, part2.js, and part3.js, and part{a..c}.js matches
parta.js, partb.js, and partc.js. Ranges support descending values,
steps such as part{1..5..2}.js, and zero padding such as part{01..03}.js.
A zero step uses the default increment of 1. Padding in a step such as
part{1..10..02}.js also pads the results to the wider endpoint's width.
These ranges also work in .npmignore and .gitignore.
Without files, pnpm reads .npmignore, falling back to .gitignore.
Negated ignore patterns can re-include default exclusions such as *.orig and
npm-debug.log. Root lockfiles and .npmrc stay excluded.
Private workspace dependencies#
A package that is not private cannot list a private workspace package in
dependencies, because the private package is never published. Packing
such a package fails with ERR_PNPM_PRIVATE_WORKSPACE_DEPENDENCY. List the
private package in devDependencies instead, bundle it by listing it in
bundleDependencies with it installed, or remove the dependency in a
beforePacking hook.
옵션#
--recursive, -r#
워크스페이스의 모든 패키지를 패킹합니다.
--out <path>#
생성되는 tarball의 출력 경로를 사용자 지정합니다. 패키지 이름과 버전을 포함하려면 %s와 %v를 사용하세요. 예: %s.tgz 또는 some-dir/%s-%v.tgz. 기본적으로 tarball은 현재 작업 디렉터리에 <package-name>-<version>.tgz라는 이름으로 저장됩니다.
--pack-destination <dir>#
pnpm pack이 tarball을 저장할 디렉터리입니다. 기본값은 현재 작업 디렉토리입니다.
--pack-gzip-level <level>#
The gzip compression level of the tarball, from 0 to 9. Values outside that range are rejected.
--json#
JSON 형식으로 로그를 출력합니다. Each archive written has an integrity, its SHA-512 in SRI form, and a size in bytes. A dry run writes no archive, so it prints neither.
The manifest field holds the package.json that goes into the tarball, after publishConfig and the other publish-time changes are applied. Run pnpm pack --dry-run --json to preview it without writing a tarball. A dry run still runs prepack and prepare, unless --ignore-scripts is passed.
--filter <package_selector>#
--dry-run#
실제로 tarball을 패킹하지 않는 것을 제외하면 일반 실행과 동일한 모든 작업을 수행합니다. 생성될 tarball의 내용을 확인하는 데 유용합니다.
--ignore-pnpmfile#
Don't load the project's .pnpmfile.cjs, so its hooks, including beforePacking, don't run.
--ignore-scripts#
Don't run the prepack, prepare, and postpack scripts.
--skip-manifest-obfuscation#
패킹된 매니페스트에서 원래의 packageManager 필드와 게시 라이프사이클 스크립트를 제거하지 않고 유지합니다. The pnpm field is still omitted, except for pnpm.config.
Life cycle scripts#
prepackpreparepostpack
팁
beforePacking 훅을 사용하여 tarball이 생성되기 전에 package.json 내용을 프로그래밍 방식으로 수정할 수도 있습니다. 이는 로컬 package.json을 수정하지 않고 개발 전용 필드를 제거하거나 게시 메타데이터를 추가할 때 유용합니다.