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

Accept npm's config variables in package.json #1711

Closed
zanona opened this issue Feb 24, 2015 · 4 comments
Closed

Accept npm's config variables in package.json #1711

zanona opened this issue Feb 24, 2015 · 4 comments

Comments

@zanona
Copy link
Contributor

zanona commented Feb 24, 2015

It would be really awesome if we could be able to set NPM's config object for setting bower configurations as well, in addition to env vars and having a package.json like:

package.json

{
  "name": "my-app",
  "private": true,
  "dependencies": {
    "bower": "^1.3.12"
  },
  "config": {
    "bower_directory": "src/vendor",
    "bower_storage__cache": "~/.bower"
  },
  "scripts": {
    "postinstall": "bower install -p",
    "prestart": "bower install --offline",
    "update": "bower update"
  }
}

This would be it really good for development and continuous integration as well, without having to reset these variables for every bower command called (using bower --config flag). Simply running npm install would then inherit all those configurations.

@sheerun
Copy link
Contributor

sheerun commented Mar 11, 2015

Isn't it a duplicate of your own issue? :) #1626

Just a note: You can use .bowerrc and ENV variables for configuring those variables.

That said, I really like this feature, and it should be as easy to implement as allowing npm_package_bower_ additionally to bower_ prefix for ENV variables.

Would you mind preparing PR with tests for https://github.com/bower/config ?

@sheerun sheerun added this to the 1.4 milestone Mar 11, 2015
@zanona
Copy link
Contributor Author

zanona commented Mar 11, 2015

@sheerun thanks for the support. Actually I believe this complements #1626 in a way that would partially resolve one of its issues.

I have managed to allow npm_package_config_bower as you have mentioned. However, I am not quite sure on how to proceed with the tests considering they would need to start with their own npm instance so the config attribute defined on package.json is evaluated.

https://github.com/zanona/config/commit/b2bbd68fc4db30164cd4556c31686d6e0fd27902

Please let me know if you have an idea on what would be the proper way to link that to the main test thread.

@sheerun
Copy link
Contributor

sheerun commented Mar 11, 2015

Hey. For filesystem tests I think you can use: https://github.com/tschaub/mock-fs I also think it's possible to edit process.env directly in node. No? I think any way is good as long as it is tested somehow.

@zanona
Copy link
Contributor Author

zanona commented Mar 12, 2015

hey @sheerun let me know if that's ok now. If so, I can then submit a PR. cheers

@sheerun sheerun closed this as completed Mar 30, 2015
@sheerun sheerun mentioned this issue Mar 30, 2015
16 tasks
sheerun added a commit that referenced this issue Mar 30, 2015
sheerun pushed a commit that referenced this issue Jun 10, 2016
sheerun added a commit that referenced this issue Jun 10, 2016
Allow NPM config variables. Resolve #1711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants