list-npm-package-content

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

List npm Package Content

列出npm包内容

This skill lists the exact contents of an npm package tarball - the same files that would be uploaded to npm and downloaded by users.
本Skill会列出npm包压缩包的准确内容——也就是会上传到npm并供用户下载的文件。

Usage

使用方法

Run the script from the package directory (e.g.,
packages/ai
):
bash
bash scripts/list-package-files.sh
The script will build the package, create a tarball, list its contents, and clean up automatically.
从包目录(例如
packages/ai
)运行脚本:
bash
bash scripts/list-package-files.sh
该脚本会自动构建包、创建压缩包、列出其内容并清理。

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.
所包含的文件由以下因素决定:
  1. package.json
    中的
    files
    字段
    - 明确允许的文件/目录列表
  2. .npmignore
    - 要排除的文件(如果存在)
  3. .gitignore
    - 如果没有
    .npmignore
    则使用此文件
  4. 始终包含的文件
    package.json
    README
    LICENSE
    CHANGELOG
  5. 始终排除的文件
    .git
    node_modules
    .npmrc