Let's say we have a .env
file with some variables specified:
AWS_PROFILE=hsz
ENVIRONMENT=development
There is also a simple npm
task defined:
{
"name": "project",
"version": "0.0.1",
"scripts": {
"deploy": "sls deploy"
}
}
But runnning npm run deploy
ignores our .env
definition.
It can be resolved with better-npm-run
like:
{
"name": "project",
"version": "0.0.2",
"scripts": {
"deploy": "bnr deploy"
},
"betterScripts": {
"deploy": "sls deploy"
},
"devDependencies": {
"better-npm-run": "^0.1.1",
}
}
but this looks like an overhead - especially when we have 10+ tasks.
Is there a better way to always load .env
without proxying all tasks via better-npm-run
?