Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn support #154

Open
tobymurray opened this issue Feb 25, 2017 · 8 comments
Open

Yarn support #154

tobymurray opened this issue Feb 25, 2017 · 8 comments

Comments

@tobymurray
Copy link
Contributor

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?

@dougwilson
Copy link
Contributor

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?

@tobymurray
Copy link
Contributor Author

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...).

@dougwilson
Copy link
Contributor

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
Copy link
Contributor Author

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.

@dougwilson
Copy link
Contributor

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.

@tobymurray
Copy link
Contributor Author

tobymurray commented 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
Copy link
Contributor

dougwilson commented 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
Copy link
Contributor Author

Sounds extremely doable. I'll give it a shot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants