From 0c1d09a8a00f82f15f8a77b4002480e1c126f881 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Dec 2025 22:23:14 +0100 Subject: [PATCH] Fix shell cd commands in npm scripts using subshells (#962) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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
Original prompt > The build is still failing, can't cd into app.
--- 💬 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> --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 36a44e2..e0245ed 100644 --- a/package.json +++ b/package.json @@ -12,20 +12,20 @@ "start:server": "npx tsc && node dist/src/server.js", "test": "yarn test:app && yarn test:backend", "test:all": "yarn test:app && yarn test:backend && yarn test:demo-video", - "test:app": "cd app && yarn test", - "test:backend": "cd backend && yarn test", + "test:app": "(cd app && 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: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:ui": "tsc && mocha --require source-map-support/register dist/src/spec/ui-tests.spec.js", "test:ui:vnc": "tsc && ./scripts/uiTestsWithVnc.sh", "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:app": "cd app && npm run dev", + "dev:app": "(cd app && npm run dev)", "dev:electron": "tsc && electron . --development", "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", "lint": "npm-run-all --parallel lint:prettier lint:tslint lint:spellcheck", "lint:fix": "npm-run-all lint:tslint:fix lint:prettier:fix", @@ -34,8 +34,8 @@ "lint:tslint": "tslint -p ./", "lint:tslint:fix": "tslint -p ./ --fix", "lint:spellcheck": "cspell -e ./build -e \"node_modules\" \"**/*.ts{x,}\"", - "build": "tsc && cd app && yarn run build && cd ..", - "build:server": "npx tsc && cd app && npx webpack --config webpack.browser.config.mjs --mode production && cd ..", + "build": "tsc && (cd app && yarn run build)", + "build:server": "npx tsc && (cd app && npx webpack --config webpack.browser.config.mjs --mode production)", "prepare-release": "tsx scripts/prepare-release.ts", "package": "tsx package.ts", "ui-test": "./scripts/uiTests.sh",