Skip to content

Feature request: 99% smaller global install #1263

@kylecordes

Description

@kylecordes

Over the last few weeks we at https://angularbootcamp.com/ have assisted dozens of developers with getting up and running on the CLI (and of course Angular 2 itself). The results have been good, but the process of getting up and running has been unnecessarily rough. We have been thinking about what aspects make it so.

The most obvious reason is that the CLI is still under heavy development. That's great, we are not complaining about that at all. Good luck, keep going, please ask for help if needed.

But here is a feature / architecture improvement that would help quite a lot:

Currently the initial set up command "npm install -g angular-cli" brings in an astonishing several hundred megabytes of global node dependencies. Global node dependencies are the worst kind of node dependencies; they are the kind most likely to have issues interacting with other (globally) installed packages. Struggling with these dependencies leads to the need for unpleasant things, such as the current CLI upgrade instructions (as of June 2016) which direct the user to discard their entire NPM cache (!).

The solution for this is relatively well understood among the node development community, and would (IMHO) be a great improvement for the Angular CLI project:

Make the thing that we ask people to install globally, much much smaller. Chop away ruthlessly at its dependencies. Throw away every dependency not absolutely necessary for the "ng new" command. From a cursory look at the functionality necessary outside the context of a project, it appears that the global CLI package could easily be made less than a megabyte, with a handful of small utility dependencies. It could be made in such a way that it almost never needs to be upgraded.

Instead, the global package and global command only needs to understand enough to begin the "ng new ____" process. Having started a project, it can perform an NPM install of a different package, one which contains the hundreds of megabytes of machinery needed, all of the stuff needed to make the rest of the CLI work.

The global "ng" could then redirect commands (I think it actually already does this) to the locally installed ng. That means the global ng doesn't need to even know a list of all those other commands other than "new", it doesn't need to know about their help, it doesn't need to change when they change, etc.

I think the current behavior, of epic global node module bloat, is simply inherited from the (generally excellent) Ember CLI. I don't know if the Angular CLI team considers it "in scope" to solve things that come from that direction, but if so, I think this would be a great one to consider.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentfeatureIssue that requests a new feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions