简体   繁体   English

持续集成、dist 文件夹和 node_modules

[英]Continuous integration, dist folder and node_modules

I m actually studying continuous integration and I m actually facing a (little) problem when dealing with the build sequence of the process.我实际上正在研究持续集成,并且在处理过程的构建顺序时我实际上面临一个(小)问题。

Actually, I have an application that has the following directory at the root of the project:实际上,我有一个应用程序,在项目的根目录下有以下目录:

  • src源文件
  • doc文档
  • dist
  • tests测试
  • node_modules节点模块

My question is : when I m at the building step (building the last artifact to put in production, after testing process) should I copy the node_modules directory inside of the dist folder ?我的问题是:当我在构建步骤(构建最后一个工件以投入生产,在测试过程之后)时,我应该将 node_modules 目录复制到 dist 文件夹中吗? So this dist folder could work in standalone (with minification etc... etc...) and so I have only to deploy this folder in my prod environnement ?所以这个 dist 文件夹可以独立工作(使用缩小等...等...),所以我只需要在我的 prod 环境中部署这个文件夹?

How can I move only "dependencies" modules and not "devDependencies" modules ?如何仅移动“依赖项”模块而不移动“devDependencies”模块?

You don't need to copy anything, because Node when you require a module within your Node app, it will search for node_modules in current directory, and if the dependency is not found, it will try to search in its parent and so on.你不需要复制任何东西,因为当你在你的 Node 应用程序中require一个模块时,Node 会在当前目录中搜索node_modules ,如果没有找到依赖项,它会尝试在它的父级中搜索等等。

Check out how Node looks for a package here: http://mycodesmells.com/post/node-basics-looking-for-package/在此处查看 Node 如何查找包: http : //mycodesmells.com/post/node-basics-looking-for-package/

If you don't want to have development dependencies in your production environment, you can install only non-dev ones:如果你不想在你的生产环境中有开发依赖,你可以只安装非开发依赖:

npm install --production

Source: https://docs.npmjs.com/cli/install来源: https : //docs.npmjs.com/cli/install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM