Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create angular-cli app without default packages for tooling

While creating an angular app with @angular/cli I found, several other packages are getting installed such as: karma, protractor, jasmine etc.

Since I am a beginner with angular I will not need these extra packages as of now. In future may be I will require them or may be a different combination of them but surely not as of now.

So how do I avoid installing all these extra tooling packages and just install essentials for learning Angular?

thanks

like image 849
me_digvijay Avatar asked Dec 07 '22 16:12

me_digvijay


2 Answers

The docs for @angular/cli state that you can use the minimal flag when running ng new, like so:

ng new --minimal [name]

This will exclude both karma and protractor tests and does not include the corresponding NPM packages.

If you want to explore the output of @angular/cli a little more, you might benefit from using the --skip-install flag - This will just generate the files but will not download and install all the packages. You could inspect the package.json file to see the dependencies that have been added, etc, just to get a feel for what's going on.

like image 106
Kirk Larkin Avatar answered Dec 10 '22 11:12

Kirk Larkin


The Angular CLI makes it easy to start small and gradually add dependencies as needed.

Step 1

ng new simple-app --minimal --skip-tests --skip-install --dry-run

Running this command will show you a list of files that would be created in a new Angular app called simple-app.

angular-minimal-dry-run

Step 2

ng new simple-app --minimal --skip-tests --skip-install

Now, rerun the command without the --dry-run option, and you'll have a very minimal Angular app to work with. No tests, and very few dependencies.

Step 3

npm install

After you've had time to examine the files that were created, you'll need to run npm install from within your project directory to install the required dependencies.

Step 4

ng build

At this point, you'll have a ready-to-run app with a fairly minimal set of dependencies.

like image 21
David Holland Avatar answered Dec 10 '22 10:12

David Holland