Skip to content

Yarn support #154

Open
Open

Description

@tobymurray

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?

Activity

  1. dougwilson commented on Feb 25, 2017

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

  2. tobymurray commented on Feb 25, 2017

    @tobymurray
    ContributorAuthor

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

  3. dougwilson commented on Feb 25, 2017

    @dougwilson
    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 :)

  4. tobymurray commented on Feb 25, 2017

    @tobymurray
    ContributorAuthor

    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.

  5. dougwilson commented on Feb 25, 2017

    @dougwilson
    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.

  6. tobymurray commented on Feb 25, 2017

    @tobymurray
    ContributorAuthor

    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?

  7. dougwilson commented on Feb 25, 2017

    @dougwilson
    Contributor

    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.

  8. tobymurray commented on Feb 25, 2017

    @tobymurray
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions