You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like there is very little actually going on in this generator that's strictly NPM dependent - pretty much just npm install and the documentation. Thoughts about adding a flag (e.g. --yarn) to allow using Yarn instead?
I mean, all this does is create a package.json file. I haven't used yarn before, but from my understanding, you just run yarn install, right? What would we change besides the docs, if anything? Maybe you'd be willing to put together a PR for what would need to be done for yarn support?
It would be a tiny change functionally speaking - npm install would become yarn install and a yarn.lock file would be generated (which locks down the transitive dependencies).
I can do up a PR to flesh it out, the big thing for me is Yarn tends to be way faster (looking at you, CI tests that install the packages...).
Well, we're not going to change the CI -- the CI needs to be the most common one. We can add an additional yarn to the CI, but all the current npm CI will need to stay. But the generator itself AFAIK never runs npm, so I'm still not sure what actually needs to change to support yarn, so a PR would help me understand, I suppose :)
My mistake, I was simply confused. It's just the documentation, and it doesn't make sense to add a switch to change the documentation (especially for a less frequently used alternative). I was thinking npm install was invoked by the generator.
So, I was just thinking, and perhaps there is something you can do, if you want (can re-open): perhaps the generator can see if there is a yarn command in the environment, and if so show the yarn install command in the output, otherwise npm. It seems to me that since yarn is not default, the presence of it would indicate the person probably wants to use it.
True - I believe that's what they're doing over at the angular-cli (I think the relevant code is here). Definitely not an earth shattering change but it seems like a nice touch. To be clear, the change would be to use Yarn if its present in the environment, and use NPM otherwise?
Activity
dougwilson commentedon Feb 25, 2017
I mean, all this does is create a
package.jsonfile. I haven't used yarn before, but from my understanding, you just runyarn install, right? What would we change besides the docs, if anything? Maybe you'd be willing to put together a PR for what would need to be done for yarn support?tobymurray commentedon Feb 25, 2017
It would be a tiny change functionally speaking -
npm installwould becomeyarn installand ayarn.lockfile would be generated (which locks down the transitive dependencies).I can do up a PR to flesh it out, the big thing for me is Yarn tends to be way faster (looking at you, CI tests that install the packages...).
dougwilson commentedon Feb 25, 2017
Well, we're not going to change the CI -- the CI needs to be the most common one. We can add an additional yarn to the CI, but all the current npm CI will need to stay. But the generator itself AFAIK never runs npm, so I'm still not sure what actually needs to change to support yarn, so a PR would help me understand, I suppose :)
tobymurray commentedon Feb 25, 2017
My mistake, I was simply confused. It's just the documentation, and it doesn't make sense to add a switch to change the documentation (especially for a less frequently used alternative). I was thinking
npm installwas invoked by the generator.dougwilson commentedon Feb 25, 2017
So, I was just thinking, and perhaps there is something you can do, if you want (can re-open): perhaps the generator can see if there is a
yarncommand in the environment, and if so show theyarn installcommand in the output, otherwisenpm. It seems to me that sinceyarnis not default, the presence of it would indicate the person probably wants to use it.tobymurray commentedon Feb 25, 2017
True - I believe that's what they're doing over at the angular-cli (I think the relevant code is here). Definitely not an earth shattering change but it seems like a nice touch. To be clear, the change would be to use Yarn if its present in the environment, and use NPM otherwise?
dougwilson commentedon Feb 25, 2017
Yea, like in the block https://github.com/expressjs/generator/blob/master/bin/express#L117-L129 just like it detects cmd.exe that it could detect yarn and show the yarn commands.
tobymurray commentedon Feb 25, 2017
Sounds extremely doable. I'll give it a shot!