l1f7 / surface

:construction: Building blocks & guidelines for front-end at Lift (deprecated: unmaintained)
2 stars 1 forks source link

Need a cross-platform way to set environment vars when running scripts #9

Closed stormwarning closed 7 years ago

stormwarning commented 7 years ago

set NODE_ENV=prototype&& npm run watch -s works on Windows but fails in bash. NODE_ENV=prototype npm run watch -s works in bash but fails on Windows.

hyshka commented 7 years ago

Maybe like in our old Gulp tasks: https://gitlab.com/l1f7/cookie-monster/blob/master/%7B%7Bcookiecutter.short_name%7D%7D/gulpfile.js/tasks/_tasks.js#L48

// Use these tasks to set our NODE_ENV manually
gulp.task('set-dev-node-env', () => (process.env.NODE_ENV = 'development'));
gulp.task('set-prod-node-env', () => (process.env.NODE_ENV = 'production'));

...
gulp.task('development', ['set-dev-node-env'], (cb) => {
...