Skip to content

Instantly share code, notes, and snippets.

@mutongwu
Created February 19, 2019 01:46
Show Gist options
  • Save mutongwu/23b2ededf8c33c87d3d93db967e80ec3 to your computer and use it in GitHub Desktop.
Save mutongwu/23b2ededf8c33c87d3d93db967e80ec3 to your computer and use it in GitHub Desktop.
npm publish 发布 npm 包
1. 默认情况下,不存在 .npmignore,npm 会依据 .gitignore 来选择过滤上传的文件;
2. 如果存在 .npmignore (即便是空白的),则 不再使用 .gitignore;
3. package.json 里面的 files 字段,拥有较高权重,控制打包的文件。
默认被排除在外的文件:
.*.swp
._*
.DS_Store
.git
.hg
.npmrc
.lock-wscript
.svn
.wafpickle-*
config.gypi
CVS
npm-debug.log
https://docs.npmjs.com/misc/developers
// npm publish 之前,查看最终上传的文件
npm pack && tar -xvzf *.tgz && rm -rf package *.tgz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment