Linux command
npm-pack 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Pack current package
npm pack
Pack specific package
npm pack [package]
Pack without gzip
npm pack --pack-destination [./dist]
Dry run (list contents)
npm pack --dry-run
Output as JSON
npm pack --json
说明
npm pack creates a tarball of a package exactly as it would be published. This is useful for testing what will be included in a published package. The tarball can be installed locally to test the package.
参数
- --dry-run
- Show contents without packing.
- --json
- Output as JSON.
- --pack-destination _dir_
- Output directory.
- --workspace _ws_
- Pack specific workspace.
FAQ
What is the npm-pack command used for?
npm pack creates a tarball of a package exactly as it would be published. This is useful for testing what will be included in a published package. The tarball can be installed locally to test the package.
How do I run a basic npm-pack example?
Run `npm pack` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --dry-run do in npm-pack?
Show contents without packing.