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

Can I replace bower with yarn ? #617

Closed
warpdesign opened this issue Oct 11, 2016 · 24 comments
Closed

Can I replace bower with yarn ? #617

warpdesign opened this issue Oct 11, 2016 · 24 comments

Comments

@warpdesign
Copy link

The announcement post says that yarn can be used with bower workflows: can it replace bower as well?

How? The documentation doesn't seem to mention bower migration.

@sebmck
Copy link
Contributor

sebmck commented Oct 11, 2016

Hey! Thanks for the question. We're still in the process of ironing out how the integration between npm and bower actually works. Suffice to say, you should be able to run yarn install from inside of a directory with bower.json and have it install all dependencies and work as you'd expect!

@panuhorsmalahti
Copy link

panuhorsmalahti commented Oct 11, 2016

As far as I understand, you need to use yarn in flat mode with yarn install --flat.

@warpdesign
Copy link
Author

warpdesign commented Oct 11, 2016

@kittens doesn't seem to work.

I have both bower.js & package.json in the same directory. Running yarn from this directory installs npm packages but not bower ones.

@dsschnau
Copy link

@panuhorsmalahti yarn install --flat didn't seem to do anything with bower deps. (though it did install node_modules flatly.

@mattbucci
Copy link

Doesn't seem to be any documentation around this either at this time, although it is mentioned in the blog post.

screen shot 2016-10-11 at 9 43 42 am

@NamPNQ
Copy link

NamPNQ commented Oct 11, 2016

@warpdesign Workarround, just rename the package.json and run yarn 💃

@panuhorsmalahti
Copy link

panuhorsmalahti commented Oct 11, 2016

@dsschnau, sorry, I kinda misunderstood this issue, I thought it was about how to replace bower by using the npm registry - which is what the --flat flag can be used for.

@slbug
Copy link

slbug commented Oct 11, 2016

Will be useful to have ability to install packages from package.json and bower.json at the same time.

LeSuisse added a commit to Enalean/docker-tuleap-test-karma that referenced this issue Oct 11, 2016
We can not replace bower (at least not without some hacks) until the
issue [1] is solved.
Also note, that as of today private registries requiring authentication
can not be used [2] [3].

[1] yarnpkg/yarn#617 (comment)
[2] yarnpkg/yarn#606
[3] yarnpkg/yarn#547
@jonathanong
Copy link

i would like a feature/option to only install bower.json so that i can ditch bower. replacing npm with yarn would be a separate step for me, but that's lower priority for me as npm isn't as broken as bower :P

@omnisite
Copy link

If you add the following to package.json, bower install will be called and it works. It is a workaround though:

"scripts": { "postinstall": "bower install" }

@bennypowers
Copy link

@dsschnau This affects Polymer workflows with yarn when certain dependencies are required.
e.g.

bower.json

dependencies: {
  "app-localize-behavior": "PolymerElements/app-localize-behavior#^0.9.2"
}

yarn install --flat fails to install intl-messageformat, which app-localize-behavior depends on

@tony19
Copy link

tony19 commented Oct 25, 2016

@bennyp123 intl-messageformat is actually installed under node_modules instead of bower_components (due to #715). See workaround.

@wyze
Copy link
Member

wyze commented Oct 26, 2016

Bower support has been dropped in #1441.

@wyze wyze closed this as completed Oct 26, 2016
@warpdesign
Copy link
Author

@wyze is it planned for later or definitely dropped ?

The idea of using Yarn for both npm & bower sounded a good idea to me.

@wyze
Copy link
Member

wyze commented Oct 26, 2016

I am not sure what the future plans are. I think there will be a roadmap released eventually that will give more clarity.

@alextreppass
Copy link

Support for bower was removed, see #1441.

@graingert
Copy link
Contributor

graingert commented Nov 3, 2016

@warpdesign

Bower is on it's way out and we shouldn't be supporting it.

and

bring over the features they like from Bower to Yarn (such as flat install which we already have and other unimplemented features like svn support etc).

However it looks the bower package registry is not going to be used.

@warpdesign
Copy link
Author

@graingert Ok. Fair enough.

@hickscorp
Copy link

As @omnisite mentioned, "scripts": { "postinstall": "bower install" } in your npm task does the trick. We use bower-locker to have proper semantic dependency locking, and it's all shiny!

@mvasilkov
Copy link

Rest in pepperoni, sweet feature.

Such sad.

@qknight
Copy link

qknight commented Jun 28, 2017

can someone point out alternatives then? or should one still stick to bower at the time being?

@graingert
Copy link
Contributor

graingert commented Jun 28, 2017 via email

@mokiding
Copy link

https://medium.com/@andrejsabrickis/bye-bye-bower-or-how-to-migrate-from-bower-to-npm-and-webpack-4eb2e1121a50

Meybe this post can help you about migrating from bower ...

@nbonamy
Copy link

nbonamy commented Mar 25, 2018

I am sticking to yarn as a bower replacement for the moment and solved all this by:

  1. Removing @bower_components prefix on all components
  2. Properly split devDependencies and dependencies (so front-end ones)
  3. Set the postinstall script to "node install.js"
  4. Install.js being https://gist.github.com/nbonamy/7019b7a42e7e53dee2a587590a164c39. The root const needs to be adjusted to your setup.

If that can help anyone...

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

No branches or pull requests