Use `.` instead of `source` in npm scripts. Then shorten the postCreateCommand. (#3608)
`npm run` runs commands in `sh`, which is dash rather than bash. Dash is strictly POSIX, and `source` is a POSIX extension. I believe that's the bug the extra `npm run setup` in the postCreateCommand was working around, so I've removed it.
This commit is contained in:
Родитель
451fbc5837
Коммит
97ed3f8182
|
@ -53,11 +53,7 @@
|
|||
],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// Recently, when running `npm run clean-setup` in the container, it has
|
||||
// not been installing the packages in the virtual environment. Instead,
|
||||
// it has been installing in the default Python environment. We will
|
||||
// need to call npm run setup again once the environment has been activated.
|
||||
"postCreateCommand": "npm run clean-setup; . cs-env/bin/activate; npm run setup",
|
||||
"postCreateCommand": "npm run clean-setup",
|
||||
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode",
|
||||
|
|
10
package.json
10
package.json
|
@ -14,10 +14,10 @@
|
|||
"scripts": {
|
||||
"setup": "npm ci; python3.11 -m venv cs-env; npm run deps",
|
||||
"clean-setup": "rm -rf node_modules cs-env; npm run setup",
|
||||
"deps": "source cs-env/bin/activate; pip install -r requirements.txt --upgrade && pip install -r requirements.dev.txt --upgrade",
|
||||
"deps": ". cs-env/bin/activate; pip install -r requirements.txt --upgrade && pip install -r requirements.dev.txt --upgrade",
|
||||
"dev-deps": "echo 'dev-deps is no longer needed'",
|
||||
"dev-ot-key": "gcloud secrets versions access latest --secret=DEV_OT_API_KEY --out-file=ot_api_key.txt --project=cr-status-staging",
|
||||
"do-tests": "source cs-env/bin/activate; curl -X POST 'http://localhost:15606/reset' && python3.11 -m unittest discover -p '*_test.py' -b",
|
||||
"do-tests": ". cs-env/bin/activate; curl -X POST 'http://localhost:15606/reset' && python3.11 -m unittest discover -p '*_test.py' -b",
|
||||
"start-emulator-persist": "gcloud beta emulators datastore start --host-port=:15606 --use-firestore-in-datastore-mode",
|
||||
"start-emulator": "gcloud beta emulators datastore start --host-port=:15606 --no-store-on-disk --use-firestore-in-datastore-mode",
|
||||
"stop-emulator": "curl -X POST 'http://localhost:15606/shutdown'; pkill -f \"CloudDatastore.jar\"",
|
||||
|
@ -25,16 +25,16 @@
|
|||
"watch": "gulp watch",
|
||||
"start-app": "npm run build && curl --retry 4 http://localhost:15606/ --retry-connrefused && ./scripts/start_server.sh",
|
||||
"debug-app": "npm run build && curl --retry 4 http://localhost:15606/ --retry-connrefused && ./scripts/debug_server.sh",
|
||||
"start": "npm stop; source cs-env/bin/activate; (npm run start-emulator-persist > /dev/null 2>&1 &); npm run start-app; status=$?; npm run stop-emulator; exit $status",
|
||||
"start": "npm stop; . cs-env/bin/activate; (npm run start-emulator-persist > /dev/null 2>&1 &); npm run start-app; status=$?; npm run stop-emulator; exit $status",
|
||||
"stop": "npm run pwtests-shutdown --workspace=playwright; kill `pgrep gunicorn`",
|
||||
"test": "(npm run start-emulator > /dev/null 2>&1 &); sleep 6; curl --retry 4 http://localhost:15606/ --retry-connrefused; npm run do-tests; status=$?; npm run stop-emulator; exit $status",
|
||||
"webtest": "web-test-runner \"client-src/**/*_test.js\" --node-resolve --playwright --browsers chromium firefox",
|
||||
"webtest:watch": "web-test-runner \"client-src/**/*_test.js\" --node-resolve --playwright --watch --browsers chromium",
|
||||
"webtest-coverage": "web-test-runner \"client-src/**/*_test.js\" --node-resolve --playwright --coverage --browsers chromium firefox",
|
||||
"do-coverage": "coverage3 erase && coverage3 run -m unittest discover -p '*_test.py' -b && coverage3 html",
|
||||
"coverage": "source cs-env/bin/activate; (npm run start-emulator > /dev/null 2>&1 &); sleep 3; curl --retry 4 http://localhost:15606/ --retry-connrefused; npm run do-coverage; npm run stop-emulator",
|
||||
"coverage": ". cs-env/bin/activate; (npm run start-emulator > /dev/null 2>&1 &); sleep 3; curl --retry 4 http://localhost:15606/ --retry-connrefused; npm run do-coverage; npm run stop-emulator",
|
||||
"view-coverage": "pushd htmlcov/; python3.11 -m http.server 8080; popd",
|
||||
"mypy": "source cs-env/bin/activate; mypy --ignore-missing-imports --exclude cs-env/ --exclude gen/ --exclude appengine_config.py --disable-error-code \"annotation-unchecked\" .",
|
||||
"mypy": ". cs-env/bin/activate; mypy --ignore-missing-imports --exclude cs-env/ --exclude gen/ --exclude appengine_config.py --disable-error-code \"annotation-unchecked\" .",
|
||||
"lint": "gulp lint-fix && lit-analyzer \"client-src/elements/chromedash-!(featurelist)*.js\"",
|
||||
"presubmit": "npm test && npm run webtest && npm run lint && npm run mypy",
|
||||
"pylint": "pylint --output-format=parseable *py api/*py framework/*py internals/*py pages/*py",
|
||||
|
|
Загрузка…
Ссылка в новой задаче