I have an Angular-Application, which I would like to bundle within a jar-File (containing the Back-End), using an Ant-script.
This Ant-script should install/update the dependencies (using npm
) and then build the application using Angular CLI
.
It will be used by multiple developers on multiple environments and not all of the developers have to deal with Front-End, so the requirements should be as low as possible.
Idealy only NodeJS
needs to be installed on all the PCs.
Therefore the Ant-script has to make sure, that all the dependencies are installed and up to date, before building the web-page.
Now I can think of multiple ways for doing this, however I am not sure which one is the best and the most stable way:
- Delete
node_module
s folder and reinstall all modules usingnpm install
.
This is probably save, but slow, as an Angular-Applications have tons of dependencies to download. - Use
npm install
, without deleting thenode_modules
first.
This will be faster but some libraries (for exampleAngular CLI
) suggest to do a clean install when updating. - Use
npm update
. This way the dependencies would not only be installed, but also updated to match the latest possible version (^
or~
will affect update).
At the moment I use npm install
, if node_modules
-folder does not exist and npm update
otherwise.
The main problem is, that npm update
might change the package.lock.json
, which is versioned (as sugested by npm documentation) and it led to merge conflicts.
So basicly I am looking for a way to install all the needed dependencies (only NodeJS is a requirement for all developers) inside the build-script, without touching versioned files.