[英]Control content of node module when included as dependency by a project
Let's say I have a node project 'A' with a JS file, 10 resource files and some test files. 假设我有一个节点项目“ A”,其中包含一个JS文件,10个资源文件和一些测试文件。
There is another project 'B' which depends on the JS file of project 'A'. 还有另一个项目“ B”,该项目取决于项目“ A”的JS文件。 So, it includes it as dependency in package.json as:
因此,它将它作为依赖项包含在package.json中,如下所示:
"dependencies": {
"A": "git+https://github.com/repo/A.git"
}
But this will also try to fetch all unwanted files like resources and test files of project 'A' in node_modules folder. 但这也将尝试在node_modules文件夹中获取所有不需要的文件,例如资源和项目“ A”的测试文件。
Is there a way I can control in package.json of 'A' that which files to expose if included as dependency? 如果包含在依赖项中,有什么办法可以控制我在package.json的'A'中公开哪些文件?
I believe .npmignore is what you need. 我相信.npmignore是您所需要的。 Please see Keeping files out of your package
请参阅将文件移出包装
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.