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

Manipulating process.env from package-scrips.js #179

Open
wmertens opened this issue Jun 16, 2018 · 2 comments
Open

Manipulating process.env from package-scrips.js #179

wmertens opened this issue Jun 16, 2018 · 2 comments

Comments

@wmertens
Copy link

When putting something like process.env.hello = 'hi' in the package-scripts.js file, you get hello=hi in the spawned environment.

To me, that is a very nice feature, because I can provide helper vars to scripts, while the commands stay somewhat readable, e.g.

process.env.defDebug = '*,-babel,-something,-other'
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'development'

module.exports = {scripts: {default: `\${DEBUG:-$defDebug} node script.js`}}

This will provide the default settings to DEBUG if it's not defined, and enforce NODE_ENV=development unless specified.

I'd like this feature to remain always; I can add it to the documentation if you like, but I have no idea how to write a test for it. I had a look at the tests but couldn't figure it out quickly.

@sezna
Copy link
Owner

sezna commented Aug 28, 2019

@wmertens So this issue is to say that this current feature simply needs documentation? I can write a test for it. If you're willing to document it, that would be great.

@wmertens
Copy link
Author

Yes indeed :)

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

2 participants