Closed aqzhyi closed 8 years ago
$ DEBUG=app:compile; npm run ov
will set DEBUG
env variable, but then it will be overwritten again by better-npm-run
(if you set it on env
object)
Ok, thanks :)
So is there a way to override variables specified in betterScripts
? I guess It would be very convenient because package.json
is usually synchronized with repo and I see no way to override it in environment rather than in project, in a case when developing environment differs between developers at least a little bit.
@oeeq Sorry, didn't catch your point, can you illustrate it with an example?
{
"scripts": {
"dev": "better-npm-run start:dev",
"prod": better-npm-run start:prod"
},
"betterScripts": {
"start:dev": {
"command": "./bin/run.js",
"env": {
"PORT": 3000,
"DBPORT": 3306
},
"start:dev": {
"command": "./bin/run.js",
"env": {
"NODE_ENV": "development",
"PORT": 3000,
"DBPORT": 3306
}
},
"start:prod": {
"command": "./bin/run.js",
"env": {
"NODE_ENV": "production",
"PORT": 80,
"DBPORT": 6603
}
}
}
}
@benoror Here's a very simple example. I assume it's a pretty common use case, it simplifies configurations a lot. However, I'm losing a capability to override those parameters in environment (using .env
file or specifying them before command PORT=3001 npm run dev
). For example, if I don't have a 3000 port available, the only way to change it is to update package.json
, which will affect other developers.
So I'm searching the way to override parameters from environment, for example using some file that I could add to .gitignore.
Probably it's not intended to be used this way, and this feature could add unnecessary complexity to better-npm-run
, I'm just wondering if I didn't overlook this functionality.
@oeeq Yeah this definitely feels overengineered and out of scope for better-npm-run
If I have
When I run sh$
npm run ov
will outputapp:*
Can I do something like this, sh$
DEBUG=app:compile; npm run ov
and expect output to beapp:compile
?