创建没有默认工具包的 angular-cli 应用程序

问题描述:

在使用@angular/cli 创建 angular 应用程序时,我发现还安装了其他几个软件包,例如:karma、protractor、jasmine 等

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

由于我是 angular 的初学者,我现在不需要这些额外的包.将来可能我会需要它们,或者可能是它们的不同组合,但现在肯定不会.

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.

那么如何避免安装所有这些额外的工具包,而只安装学习 Angular 的必需品?

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

谢谢

docs 对于@angular/cli 状态,您可以在运行 ng new 时使用 minimal 标志,如下所示:

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

ng new --minimal [name]

这将排除 karma 和量角器测试,并且不包括相应的 NPM 包.

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

如果你想更多地探索@angular/cli 的输出,你可能会从使用 --skip-install 标志中受益 - 这只会生成文件,但不会下载和安装所有软件包.您可以检查 package.json 文件以查看已添加的依赖项等,以了解发生了什么.

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.