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

Feature: New installation method for Yarn #964

Closed
mischah opened this issue Oct 13, 2016 · 15 comments
Closed

Feature: New installation method for Yarn #964

mischah opened this issue Oct 13, 2016 · 15 comments
Labels

Comments

@mischah
Copy link
Member

mischah commented Oct 13, 2016

Hej,

I would love to have a Yarn installation method in addition to bowerInstall and npmInstall 💖

Would you accept a pull request for that feature?

Yours, Michael

@SBoudrias
Copy link
Member

FWIW, you can use runInstall() right now to install packages using yarn. Maybe we should wait a bit to provide it as part of the core library as it'll be a lot of open issues asking us why the command fail when yarn is not installed.

@mischah
Copy link
Member Author

mischah commented Oct 18, 2016

FWIW, you can use runInstall() right now to install packages using yarn.

Yeah. I know 👌

But runInstall() doesn’t provide a callback function to the case Yarn isn’t installed, right?

Maybe we should wait a bit to provide it as part of the core library as it'll be a lot of open issues asking us why the command fail when yarn is not installed.

My idea was to have a yarnInstall method which:

  • checks if yarn is installed
    • installs with yarn install in case yarn is installed
    • installs with npm install if yarn isn’t installed

Could be possible because of the compatibility between npm and Yarn.

@mischah
Copy link
Member Author

mischah commented Oct 18, 2016

Okay. Might cause problems when passing yarn options that npm doesn’t have.

And there a a few 😵

What about to provide an optional param for the new yarnInstall which is a boolean like fallbackToNpmInstall. So authors of generators are aware of this drawback.

@mischah
Copy link
Member Author

mischah commented Oct 18, 2016

Just throwing in ideas.

@sindresorhus
Copy link
Member

Maybe a more generic method .installDependencies() that uses yarn when available, otherwise npm. With yarnArg and npmArg options, in case you need to specify arguments for either.

@mischah
Copy link
Member Author

mischah commented Oct 24, 2016

There is already a method called installDependencies() 😎
Lets sum up the current state. We now have:

  • bowerInstall()
    • installs with bower`
  • npmInstall()
    • installs with bower
  • installDependencies()
    • runs npm and bower
  • runInstall()
    • runs the install command for a given installer
    • used by bowerInstall() and npmInstall()

See: http://yeoman.io/generator/actions_install.html

In addition one could use any CLI installer with spawnCommand() like described here: http://yeoman.io/authoring/dependencies.html


Just realized that I’v mistaken spawnCommand() with runInstall() in my answer to @SBoudrias above:

But runInstall() doesn’t provide a callback function to the case Yarn isn’t installed, right?

runInstall() do provide a callback 👌

@mischah
Copy link
Member Author

mischah commented Oct 24, 2016

But maybe Simon is right that it might be a bit early to generally support Yarn.

Cause Yarn will cause trouble for projects that are using bower in addition to npm.

➡️ It deletes the bower_components directory. See here: yarnpkg/yarn#616

@thymikee
Copy link

@mischah Bower support is now removed from Yarn (I believe it will land with the latest release)

@sindresorhus
Copy link
Member

I think we should do the following:

  • Deprecate bowerInstall() (Bower is dead)
  • Add yarnInstall()
  • Change installDependencies() to not use bowerInstall(), but to use Yarn when available, otherwise npm. With yarnArgs and npmArgs options, in case you need to specify arguments for either.

This would be a breaking change, but for the better.

@Borjagodoy
Copy link
Contributor

I don't know if the deprecated bower install is a good option.

I think that we can add a new method yarnInstall() and the user can chose between npm and yarn across the option parameter.

if the user want use yarn in the option object set yarn: true, else set npm: true.

@mischah
Copy link
Member Author

mischah commented Nov 8, 2016

First I thought think it’s to early to deprecate bowerInstall() and get rid of it within installDependencies() because Bower isn’t dead and is still used widely.

But Bower has no future and will day sooner than later.

So yes. Im with that:

  • Deprecate bowerInstall() (Bower is dead)
  • Add yarnInstall()
  • Change installDependencies() to not use bowerInstall(), but to use Yarn when available, otherwise npm. With yarnArgs and npmArgs options, in case you need to specify arguments for either.

Authors of generators can still use Bower but with that breaking change it’s clear that have to switch.

I could prepare a PR if the rest of @yeoman is okay with that breaking change.

@mischah
Copy link
Member Author

mischah commented Nov 8, 2016

Oh, I just recognized that there is a PR in the making over here: #974

@mischah
Copy link
Member Author

mischah commented Nov 21, 2016

Travis also supports Yarn now 🙀

@Borjagodoy What’s the status with your PR over here: #974?

@mischah
Copy link
Member Author

mischah commented Nov 25, 2016

The Yarn install method is in master with 4eccb2a

Question:
Who will add this to the website?
https://github.com/yeoman/yeoman.github.io/blob/source/app/authoring/dependencies.md

@mischah
Copy link
Member Author

mischah commented Nov 26, 2016

Question:
Who will add this to the website?
https://github.com/yeoman/yeoman.github.io/blob/source/app/authoring/dependencies.md

PR regarding the website over here yeoman/yeoman.io#699

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

No branches or pull requests

5 participants