list-npm-package-content

作者: vercel

在发布前检查npm包tarball内容,以验证将分发的文件。列出将上传到npm的确切文件,帮助在发布前发现遗漏或不需要的内容。遵循package.json中的files字段、.npmignore和.gitignore规则,显示实际打包内容。自动构建包、创建tarball、显示内容并在单个命令中清理。从包目录运行简单的bash脚本;适用于...

npx skills add https://github.com/vercel/ai --skill list-npm-package-content

List npm Package Content

This skill lists the exact contents of an npm package tarball - the same files that would be uploaded to npm and downloaded by users.

Usage

Run the script from the package directory (e.g., packages/ai):

bash scripts/list-package-files.sh

The script will build the package, create a tarball, list its contents, and clean up automatically.

Understanding Package Contents

The files included are determined by:

  1. files field in package.json - explicit allowlist of files/directories
  2. .npmignore - files to exclude (if present)
  3. .gitignore - used if no .npmignore exists
  4. Always included: package.json, README, LICENSE, CHANGELOG
  5. Always excluded: .git, node_modules, .npmrc, etc.