Whenever I run "ng new ProjectName" CLI command it takes couple of minutes to create the project.
Is there a faster way to create a project like copying an existing project and changing some parameters? As far as I understand ng new downloads lots of modules.
You can keep an original/unmodified as a template:
ng new AngularCLITemplate
and when you build future projects you can skip installing node_modules:
ng new --skip-install true NewProjectName
then copy and paste your node_modules folder from the template into your new project. Afterward you'll want to npm install:
cd NewProjectName && npm install
to make sure it caches the npm module locations.
It will be close to the same time to build a new project, since downloading the node_modules doesn't take as much time as simply writing them to the disk during installation (which the copy/paste will have to do), but it might save a minute or two on an older machine or slower internet.
hi bro this is because angular cli installs the dependencies running
npm install
but to make it faster you can use yarn.
If you haven't installed yet
npm install -g yarn
this use npm, other ways of installing in the following link.
https://yarnpkg.com/lang/en/docs/install/
ng new --skip-install true NewProjectName // will avoid npm install
ng set --global packageManager=yarn
using yarn will decrease your speed at least by half, if you want to get back to npm.
ng set --global packageManager=npm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With