英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论