let environment variables override defaults for npm server scripts; fix npm scripts

This commit is contained in:
Christopher Van 2015-01-07 23:01:27 -08:00
Родитель 3063747700
Коммит 4e4fe9d3b5
4 изменённых файлов: 21 добавлений и 25 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -16,3 +16,4 @@ pids
results
scripts/*.json
settings_*.js
test/artifacts/

Просмотреть файл

@ -30,19 +30,14 @@ Initialise settings, if you haven't already:
cp ./settings_dev.js.dist ./settings_dev.js
Set these environment variables:
NODE_ENV=development
GALAXY_API_SETTINGS=./settings_dev.js
To run the local web server:
nodemon index.js
Alternatively:
npm run dev
To run with a different settings file:
GALAXY_API_SETTINGS=./some_different_settings_dev.js npm run prod
To run linting tools:
gulp lint
@ -54,19 +49,19 @@ Initialise settings if you haven't already:
cp ./settings_prod.js.dist ./settings_prod.js
Set these environment variables:
NODE_ENV=production
GALAXY_API_SETTINGS=./settings_prod.js
To run the web server in production:
node index.js
Alternatively:
npm run prod
To run with a different settings file:
GALAXY_API_SETTINGS=./some_different_settings_prod.js npm run prod
Alternatively, without `npm`:
NODE_ENV=production GALAXY_API_SETTINGS=./settings_prod.js node index.js
NODE_ENV=production GALAXY_API_SETTINGS=./some_different_settings_prod.js node index.js
## Testing

Просмотреть файл

@ -33,13 +33,13 @@
},
"scripts": {
"start": "node index.js",
"dev": "NODE_ENV=development GALAXY_API_SETTINGS=./settings_dev.js nodemon index.js",
"prod": "NODE_ENV=production GALAXY_API_SETTINGS=./settings_prod.js node index.js",
"refreshdb-test": "GALAXY_API_SETTINGS=./settings_test.js gulp refreshdb --no-prompt > /dev/null",
"test": "npm run refreshdb-test && GALAXY_API_SETTINGS=./settings_test.js ./node_modules/lab/bin/lab",
"test-keepdb": "npm run refreshdb-test && GALAXY_API_SETTINGS=./settings_test.js ./node_modules/lab/bin/lab",
"test-verbose": "npm run refreshdb-test && GALAXY_API_SETTINGS=./settings_test.js ./node_modules/lab/bin/lab -c -L",
"test-cover": "npm run refreshdb-test && GALAXY_API_SETTINGS=./settings_test.js ./node_modules/lab/bin/lab -c -r html -o ./test/artifacts/coverage.html && open ./test/artifacts/coverage.html"
"dev": "NODE_ENV=development GALAXY_API_SETTINGS=${GALAXY_API_SETTINGS:=./settings_dev.js} nodemon index.js",
"prod": "NODE_ENV=production GALAXY_API_SETTINGS=${GALAXY_API_SETTINGS:=./settings_prod.js} node index.js",
"refreshdb-test": "GALAXY_API_SETTINGS=${GALAXY_API_SETTINGS:=./settings_test.js} gulp refreshdb --no-prompt > /dev/null",
"test": "npm run refreshdb-test && GALAXY_API_SETTINGS=${GALAXY_API_SETTINGS:=./settings_test.js} ./node_modules/lab/bin/lab",
"test-keepdb": "GALAXY_API_SETTINGS=${GALAXY_API_SETTINGS:=./settings_test.js} ./node_modules/lab/bin/lab",
"test-verbose": "npm test -- -c -L",
"test-cover": "npm test -- -c -r html -o ./test/artifacts/coverage.html && open ./test/artifacts/coverage.html"
},
"version": "0.0.5"
}

0
test/artifacts/.gitkeep Normal file
Просмотреть файл