yeoman / generator-karma

Yeoman generator for Karma
http://yeoman.io
BSD 2-Clause "Simplified" License
172 stars 48 forks source link

Should add package.json dependencies even if --skip-install is specified #74

Closed alfonso-presa closed 9 years ago

alfonso-presa commented 9 years ago

I know the easier way to add dependencies to the package.json file is by using 'npm install' but.... wouldn't it have sense to add them even if --skip-install is provided?

SBoudrias commented 9 years ago

Can you expand on what you expect the behavior should be?

alfonso-presa commented 9 years ago

Of course, sorry for the sort description.

May be I'm wrong but I expect this two commands to be equivalent: This: yo karma --skip-install & npm install And this: yo karma

It turns out that the first one fails as no dependency is added to package.json, because npm install is used to do so with the --save-dev option.

This is relevant because I've seen some issues in generator angular because of the concurrent execution of both npm install commands, and I was trying to solve it by passing skip-install to karma:app and relying on generator angular install process... But it fails because no karma dependencies are added to the package.json.

SBoudrias commented 9 years ago

Ok, that's a bug in this generator who should add it's dependency manually to the package.json

alfonso-presa commented 9 years ago

I was trying to give a try to solve this by myself when I realized that there's no way to modify the package.json consistently with the npm configuration (check "save-bundle" option and "save-prefix" option at https://github.com/npm/npm/blob/master/lib/install.js#L408) without using npm itself.

Maybe this is only possible if they add a method in npm to modify the package.json that doesn't actually trigger the downloading of artifacts....

I really feel all generator --skip-install should be consistent with a later execution of npm install, but I don't see how to solve my own request in the generator itself. I'm going to fill an issue to npm. Should I close this one or should I keep it and link to the npm one just in case they implement the feature? What do you think?

Thanks!

alfonso-presa commented 9 years ago

Npm issue: https://github.com/npm/npm/issues/7865

SBoudrias commented 9 years ago

I think you're not looking at the issue from the right angle.

This generator should add it's dependency to the package.json file without relying on npm --save

alfonso-presa commented 9 years ago

This should be solved in 1.0.0