npm publish总是忽略哪些文件名模式?

huangapple go评论81阅读模式
英文:

What file name patterns does npm publish always ignore?

问题

npm publish命令的文档中提到了关于哪些文件将包含在包中的内容:

> 如果文件匹配某些模式,除非在package.json的"files"列表中明确添加,或者在.npmignore或.gitignore文件中使用!规则取消忽略,否则它将永远不会被包含。

那些"某些模式"是什么?

这在技术文档中似乎非常模糊。这些模式的列表是否有文档记录(除了源代码之外)?

引发这个问题的背景是:最近我发布了一个包含在文件结构中嵌套了几个级别的名为src的目录的JavaScript包。这个目录在最终发布的包中完全被省略了。在后续尝试中,将该目录重命名后,它被包含在内。package.json中没有允许列表,.npmignore中也没有匹配的条目。看起来我的src目录属于这种"某些模式"的范畴,但是粗略的谷歌搜索没有找到更多的细节。

英文:

The documentation for the npm publish command says this regarding which files will be included in the package:

> If the file matches certain patterns, then it will never be included, unless explicitly added to the "files" list in package.json, or un-ignored with a ! rule in a .npmignore or .gitignore file

What are those "certain patterns"?

This seems very vague for technical documentation. Is the list of patterns documented anywhere (outside of the source code)?

The context that brought this up -- I was recently publishing a Javascript package with a directory named src nested several levels in the file structure. This directory was entirely omitted from the resulting published package. Renaming the directory caused it to be included on a subsequent try. There was not an allow list in the package.json, and there were no matching entries in '.npmingore'. It seems my src directory fell into this category of "certain patterns", but a cursory Google didn't turn up any further detail.

答案1

得分: 0

运行npm publish时,以下模式匹配的文件始终被忽略:

  • .*.swp
  • ._*
  • .DS_Store
  • .git
  • .gitignore
  • .hg
  • .npmignore
  • .npmrc
  • .lock-wscript
  • .svn
  • .wafpickle-*
  • config.gypi
  • CVS
  • npm-debug.log

这在开发者文档中有详细说明。

英文:

The files matching the following patterns are always ignored when running npm publish:

  • .*.swp
  • ._*
  • .DS_Store
  • .git
  • .gitignore
  • .hg
  • .npmignore
  • .npmrc
  • .lock-wscript
  • .svn
  • .wafpickle-*
  • config.gypi
  • CVS
  • npm-debug.log

This is documented in the developer docs.

huangapple
  • 本文由 发表于 2023年8月9日 03:36:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76862729.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定