generator-webapp icon indicating copy to clipboard operation
generator-webapp copied to clipboard

Even though Yarn is detected, it creates a npm lockfile

Open silvenon opened this issue 5 years ago • 6 comments

silvenon avatar Jan 10 '19 11:01 silvenon

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

  • npm
  • yarn
  • pnpm

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

ilicmarko avatar Oct 21 '19 20:10 ilicmarko

@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 ?

UlisesGascon avatar Oct 28 '19 18:10 UlisesGascon

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

silvenon avatar Nov 16 '19 17:11 silvenon

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

ilicmarko avatar Nov 27 '19 21:11 ilicmarko

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

ilicmarko avatar Dec 06 '19 20:12 ilicmarko

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.

silvenon avatar Mar 01 '20 23:03 silvenon