yeoman / generator-webapp

A gulp.js generator for modern webapps
3.77k stars 708 forks source link

Even though Yarn is detected, it creates a npm lockfile #747

Open silvenon opened 5 years ago

ilicmarko commented 5 years ago

This can be solved with a simple child process check. But I would maybe give the user an option to choose. At one point Yarn made a lot of sense but the tables have turned and NPM has caught up to Yarn. It provides some additional functionality like audit fix and npm ci etc..

For this reason I would let users choose between

If you are OK with this I can get right on it @silvenon.

UlisesGascon commented 5 years ago

@ilicmarko thanks a lot for your support :-)

Maybe it is better to handle first this bug and in a separate issue/PR we can discuss about let the user choose the CLI ;-)

What do you think @silvenon ?

silvenon commented 4 years ago

@ilicmarko I like the idea, are you still up for doing this?

ilicmarko commented 4 years ago

@silvenon I will sit down on the weekend and put in some work.

ilicmarko commented 4 years ago

Sorry for a delay, had some construction work in the house so no JS for me :(

Anyways, got something done after work. It was really strange to debug as the npm install was getting called whatever I do. After some sweat, I found it was coming from another side.

https://github.com/yeoman/generator-webapp/blob/c62391b8a58237d9f52f2763497d2e6c049e5833/app/index.js#L23-L31

It's interesting that even if you send the skip-install option to the mocha generator it will do a dev install.

https://github.com/yeoman/generator-mocha/blob/21da7926613dba0d404135798cfb8d8b4161acb1/generators/app/index.js#L70-L88

Looking at line 86.

https://github.com/yeoman/generator-mocha/blob/21da7926613dba0d404135798cfb8d8b4161acb1/generators/app/index.js#L86

Anyways what do you suggest as the fix?

@silvenon @UlisesGascon

silvenon commented 4 years ago

Sorry for my late response 😅 Thank you for figuring out where the error is coming from! 🏆 We definitely need to add Yarn support to those generators, feel free to send PRs there if you're up for it. As for the --skip-install option, ideally in that case you should still get chai and mocha in your package.json, but without npm install/yarn install. We need to unify these three projects.