-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Package.json as replacement for bower.json and .bowerrc #1626
Comments
Looks like this is an active discussion in #1520 |
thanks for the reference @cvburgess, it appear that this discussion goes in more in-depth in the design and fusion between npm and bower. I think that is a nice idea as well, however the suggestion here would just act upon the configuration files itself not looking for merging one tool with another. But definitely great so see this being discussed. 👍 |
As for me I'd gladly allow that for private projects. For public projects you'd need to use |
I really like this suggestion. As @cvburgess referenced by pointing to the issue about tighter bower / npm integration, it’s been explicitly endorsed by npm:
This is the approach taken by jspm, which tries to understand as much as possible from the existing As many have pointed out, maintaining many separate json configuration files is error prone, redundant, and a pain in the ass, so the idea of DRY-ing all of that up is very appealing to me. And naïvely, it seems to me that it shouldn’t be hard for bower to maintain backwards compatibility with |
Yes please +1 |
+1 |
+1 I agree that it would be nice to have Bower read it's configuration and dependencies from package.json rather than it's own two separate configuration files. |
This would make config much cleaner |
package.json can now contain bower configuration: #1711 |
Hey @sheerun, I believe this issue revolves something a bit more complex than just the configuration settings but also all project bower dependencies. |
Yeah, I know.. I just wanted to point it out. |
👍 |
NPM 3 is in beta, and will be released soon: NPM 3 installs dependencies as flat as possible, unless there are conflicts: Once NPM 3 drops the "beta" flag, there'll likely be little reason to favour Bower. |
@sheerun Sounds really great with
I cant figure out how its implemented / find the documentation. Is it like https://github.com/jspm/registry/wiki/Configuring-Packages-for-jspm#prefixing-configuration where we place a |
@mathiasrw here's an example package.json on how I use it: {
"name": "app-name",
"version": "0.1.0",
"config": {
"bower_directory": "src/vendor"
},
"scripts": {
"postinstall": "bower install -p",
"prestart": "bower install"
}
} Hopefully it can help. |
@zanona Thanks for super quick response. I have a feeling the I will look into it and get back with feedback. |
+1 to @zanona, I like this suggestion too. Edit: Didn't see it was already implemented! Nice! |
+1. It doesn't make sense to maintain duplicate configuration files. |
+1 |
+1 |
Having read this interesting article I myself was trying to move my configuration to If bower were to read the package.json like this: var pkg = require('pkgcfg')(); i.s.o var fs = require('fs');
var pkg = JSON.parse(fs.readFileSync('../../package.json')); Then all transformations inside the package.json would be executed and the result would be saved in Then, users would be able to use package transformations like this: {
"name": "my-pakage",
"version": "my-version",
"outputFolder": "bin",
"outputFile": "{pkg name}-{pkg version}.min.js",
"outputPath": "{pkg outputFolder}/{pkg outputFile}",
..
} It's very early for my little library so I don't suggest you use this as-is, but I stumbled onto this issue and it dawned upon me that if packages that depend on config in What do you guys think about this? |
I think with Angular 2 and others moving to deprecate Bower in favour of npm for front-end package management, this issue might become obsolete in the foreseeable future. Not trying to hammer on Bower, as it has served its purpose well over the past years, but it seems that with ES6 modules and improved build tools, it's no longer going to be necessary to have two different package managers for your projects. |
@zanona Thanks for sharing your example I am using Bower version 1.7.7. Am I misunderstanding how this feature is intended to work or is there a bug in it? /cc @mathiasrw |
Hello @meitar, As per my second example to @mathiasrw, But I'm afraid we are not there yet in regards a unified dependencies file 😄 All the best |
@zanona I think so. If I understand what you're saying, this means I was in fact misunderstanding and that a |
@meitar actually, that does work. So perhaps I misunderstood your question :) Re-enforcing last my example: package.json {
"name": "test",
"version": "1.0.0",
"config": {
"bower_directory": "src/vendor"
},
"scripts": {
"bower-install": "bower install",
"bower-install-moment": "bower install moment"
}
} When running Overall, that PR was a replacement for Does that make sense? |
Yes. My confusion was that I thought you did not have to run bower through |
Bower is deprecated and we recommend using Yarn or Npm that supports package.json |
I am using bower for a while now and was analysing that, at the same time I am using bower I am also required to add files to my project which don't really seem necessary. IMHO
bower.json
and.bowerrc
are two of them.Isn't it possible for bower to simply use an attribute inside
package.json
file namedbower
?Take volo, for example, the great thing about it is that it is invisible. All declarations are made inside
package.json
file itself and it also re-uses common fields likename
,author
,version
, etc.package.json
This way, instead of having an structure like this:
We would have this knowing
package.json
is the central point of attention for both node, bower (and any other package manager) making it clear that this doesn't needs to be related to node development at all in case it's not needed. It would be perfectly valid only for bower packages as well.I believe this really makes a whole difference on the perception of complexity behind your code, it just simplifies it gracefully.
It would be great to know what do you guys think.
The text was updated successfully, but these errors were encountered: