Skip to content

Commit 1773487

Browse files
committed
fix: use cross-env for Windows-compatible env variables and fix vitest electron path
Unix-style `VAR=value` syntax in npm scripts doesn't work on Windows. Added cross-env to build:production, test, test:extension, and test:webview scripts. Changed vitest.nodeExecutable to point to the actual electron binary instead of the .bin shim, which doesn't resolve on Windows (only electron.cmd exists there).
1 parent 0d52e7d commit 1773487

3 files changed

Lines changed: 38 additions & 19 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
"vitest.nodeEnv": {
1515
"ELECTRON_RUN_AS_NODE": "1"
1616
},
17-
"vitest.nodeExecutable": "node_modules/.bin/electron"
17+
"vitest.nodeExecutable": "node_modules/electron/dist/electron"
1818
}

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@
1919
"main": "./dist/extension.js",
2020
"scripts": {
2121
"build": "concurrently -g -n webviews,extension \"pnpm build:webviews\" \"node esbuild.mjs\"",
22-
"build:production": "NODE_ENV=production pnpm build",
22+
"build:production": "cross-env NODE_ENV=production pnpm build",
2323
"build:webviews": "pnpm -r --filter \"./packages/*\" --parallel build",
2424
"format": "prettier --write --cache --cache-strategy content .",
2525
"format:check": "prettier --check --cache --cache-strategy content .",
2626
"lint": "eslint --cache --cache-strategy content .",
2727
"lint:fix": "pnpm lint --fix",
2828
"package": "pnpm build:production && vsce package --no-dependencies",
2929
"package:prerelease": "pnpm build:production && vsce package --pre-release --no-dependencies",
30-
"test": "CI=true ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs",
31-
"test:extension": "ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs --project extension",
30+
"test": "cross-env CI=true ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs",
31+
"test:extension": "cross-env ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs --project extension",
3232
"test:integration": "tsc -p test/integration --outDir out --noCheck && node esbuild.mjs && vscode-test",
33-
"test:webview": "ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs --project webview",
33+
"test:webview": "cross-env ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs --project webview",
3434
"typecheck": "concurrently -g -n extension,tests,packages \"tsc --noEmit\" \"tsc --noEmit -p test\" \"pnpm typecheck:packages\"",
3535
"typecheck:packages": "pnpm -r --filter \"./packages/*\" --parallel typecheck",
3636
"watch": "concurrently -g -n extension,webviews \"pnpm watch:extension\" \"pnpm watch:webviews\"",
@@ -609,8 +609,9 @@
609609
"bufferutil": "^4.1.0",
610610
"coder": "catalog:",
611611
"concurrently": "^9.2.1",
612+
"cross-env": "^10.1.0",
612613
"dayjs": "^1.11.20",
613-
"electron": "39.8.1",
614+
"electron": "39.8.5",
614615
"esbuild": "^0.28.0",
615616
"eslint": "^10.2.0",
616617
"eslint-config-prettier": "^10.1.8",

pnpm-lock.yaml

Lines changed: 31 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)