Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ? 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 ?

How can I move only "dependencies" modules and not "devDependencies" modules ?

like image 548
Thomas thomas Avatar asked Nov 10 '22 03:11

Thomas thomas


1 Answers

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.

Check out how Node looks for a package here: 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

like image 168
slomek Avatar answered Nov 14 '22 21:11

slomek