Fix shell cd commands in npm scripts using subshells (#962)
The Docker browser build was failing because npm scripts used `cd app && command && cd ..`, which is unreliable in Docker RUN contexts and certain shell environments. ## Changes Updated all scripts using directory changes to use subshell isolation: ```diff -"build:server": "npx tsc && cd app && npx webpack --config webpack.browser.config.mjs --mode production && cd ..", +"build:server": "npx tsc && (cd app && npx webpack --config webpack.browser.config.mjs --mode production)", ``` **Updated scripts:** - `build:server` - Docker browser build (primary fix) - `build` - Electron build - `install` - Dependency installation - `test:app`, `test:backend` - Test runners (used in CI) - `dev:app`, `dev:server:app` - Development servers ## Technical details Subshell approach `(cd dir && command)`: - Isolates directory change to subshell scope - Auto-returns to parent directory on subshell exit - More reliable across sh/bash/docker environments - Eliminates manual `cd ..` restoration <!-- START COPILOT CODING AGENT SUFFIX --> <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > The build is still failing, can't cd into app. </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com>
This commit is contained in:
14
package.json
14
package.json
@@ -12,20 +12,20 @@
|
|||||||
"start:server": "npx tsc && node dist/src/server.js",
|
"start:server": "npx tsc && node dist/src/server.js",
|
||||||
"test": "yarn test:app && yarn test:backend",
|
"test": "yarn test:app && yarn test:backend",
|
||||||
"test:all": "yarn test:app && yarn test:backend && yarn test:demo-video",
|
"test:all": "yarn test:app && yarn test:backend && yarn test:demo-video",
|
||||||
"test:app": "cd app && yarn test",
|
"test:app": "(cd app && yarn test)",
|
||||||
"test:backend": "cd backend && yarn test",
|
"test:backend": "(cd backend && yarn test)",
|
||||||
"test:electron": "tsc && mocha --require source-map-support/register dist/src/spec/ui-tests.spec.js",
|
"test:electron": "tsc && mocha --require source-map-support/register dist/src/spec/ui-tests.spec.js",
|
||||||
"test:browser": "tsc && mocha --require source-map-support/register dist/src/spec/ui-tests.spec.js",
|
"test:browser": "tsc && mocha --require source-map-support/register dist/src/spec/ui-tests.spec.js",
|
||||||
"test:demo-video": "npx tsc && node dist/src/spec/demoVideo.js",
|
"test:demo-video": "npx tsc && node dist/src/spec/demoVideo.js",
|
||||||
"test:ui": "tsc && mocha --require source-map-support/register dist/src/spec/ui-tests.spec.js",
|
"test:ui": "tsc && mocha --require source-map-support/register dist/src/spec/ui-tests.spec.js",
|
||||||
"test:ui:vnc": "tsc && ./scripts/uiTestsWithVnc.sh",
|
"test:ui:vnc": "tsc && ./scripts/uiTestsWithVnc.sh",
|
||||||
"test:mcp": "tsc && node dist/src/spec/testMcpIntrospection.js",
|
"test:mcp": "tsc && node dist/src/spec/testMcpIntrospection.js",
|
||||||
"install": "cd app && yarn && cd ..",
|
"install": "(cd app && yarn)",
|
||||||
"dev": "npm-run-all --parallel dev:*",
|
"dev": "npm-run-all --parallel dev:*",
|
||||||
"dev:app": "cd app && npm run dev",
|
"dev:app": "(cd app && npm run dev)",
|
||||||
"dev:electron": "tsc && electron . --development",
|
"dev:electron": "tsc && electron . --development",
|
||||||
"dev:server": "npm-run-all --parallel dev:server:*",
|
"dev:server": "npm-run-all --parallel dev:server:*",
|
||||||
"dev:server:app": "cd app && npx webpack-dev-server --config webpack.browser.config.mjs --mode development --progress",
|
"dev:server:app": "(cd app && npx webpack-dev-server --config webpack.browser.config.mjs --mode development --progress)",
|
||||||
"dev:server:backend": "tsc && node dist/src/server.js",
|
"dev:server:backend": "tsc && node dist/src/server.js",
|
||||||
"lint": "npm-run-all --parallel lint:prettier lint:tslint lint:spellcheck",
|
"lint": "npm-run-all --parallel lint:prettier lint:tslint lint:spellcheck",
|
||||||
"lint:fix": "npm-run-all lint:tslint:fix lint:prettier:fix",
|
"lint:fix": "npm-run-all lint:tslint:fix lint:prettier:fix",
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
"lint:tslint": "tslint -p ./",
|
"lint:tslint": "tslint -p ./",
|
||||||
"lint:tslint:fix": "tslint -p ./ --fix",
|
"lint:tslint:fix": "tslint -p ./ --fix",
|
||||||
"lint:spellcheck": "cspell -e ./build -e \"node_modules\" \"**/*.ts{x,}\"",
|
"lint:spellcheck": "cspell -e ./build -e \"node_modules\" \"**/*.ts{x,}\"",
|
||||||
"build": "tsc && cd app && yarn run build && cd ..",
|
"build": "tsc && (cd app && yarn run build)",
|
||||||
"build:server": "npx tsc && cd app && npx webpack --config webpack.browser.config.mjs --mode production && cd ..",
|
"build:server": "npx tsc && (cd app && npx webpack --config webpack.browser.config.mjs --mode production)",
|
||||||
"prepare-release": "tsx scripts/prepare-release.ts",
|
"prepare-release": "tsx scripts/prepare-release.ts",
|
||||||
"package": "tsx package.ts",
|
"package": "tsx package.ts",
|
||||||
"ui-test": "./scripts/uiTests.sh",
|
"ui-test": "./scripts/uiTests.sh",
|
||||||
|
|||||||
Reference in New Issue
Block a user