Skip to content

Commit 85b5948

Browse files
committed
fix: update path handling for Windows in getSeaCommands function
1 parent 090965c commit 85b5948

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

nx-node-sea/src/plugin.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '@nx/devkit';
1010
import { calculateHashForCreateNodes } from '@nx/devkit/src/utils/calculate-hash-for-create-nodes';
1111
import { existsSync } from 'node:fs';
12-
import { dirname, join } from 'node:path';
12+
import { dirname, join, posix, win32 } from 'node:path';
1313
import { platform, versions } from 'node:process';
1414
import { combineGlobPatterns } from 'nx/src/utils/globs';
1515
import { workspaceDataDirectory } from 'nx/src/utils/cache-directory';
@@ -196,14 +196,17 @@ function getSeaCommands(options: {
196196
`npx postject ${nodeBinPath} NODE_SEA_BLOB ${blobPath} --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2`,
197197
];
198198
} else if (platform === 'win32') {
199-
const _nodeBinPath = 'node.exe';
199+
const _nodeBinPath = join(
200+
dirname(nodeBinPath.replaceAll(posix.sep, win32.sep)),
201+
'node.exe'
202+
);
203+
const _blobPath = blobPath.replaceAll(posix.sep, win32.sep);
200204
return [
201205
`node -e "require('fs').copyFileSync(process.execPath, '${_nodeBinPath}')"`,
202206
...(sign ? [`signtool remove /s '${_nodeBinPath}' `] : []),
203207
// TODO: check if powershell or command prompt
204-
`npx postject ${_nodeBinPath} NODE_SEA_BLOB ${blobPath} \` --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8bß5df1996b2`,
208+
`npx postject ${_nodeBinPath} NODE_SEA_BLOB ${_blobPath} \` --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8bß5df1996b2`,
205209
...(sign ? [`signtool sign /fd SHA256 ${_nodeBinPath}`] : []),
206-
`mv ${_nodeBinPath} ${join(dirname(nodeBinPath), _nodeBinPath)}`,
207210
];
208211
} else {
209212
throw new Error(`Unsupported platform: ${platform}`);

tsconfig.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"importHelpers": true,
1111
"target": "es2015",
1212
"module": "esnext",
13-
"lib": ["es2020", "dom"],
13+
"lib": ["es2021", "dom"],
1414
"skipLibCheck": true,
1515
"skipDefaultLibCheck": true,
1616
"baseUrl": ".",

0 commit comments

Comments
 (0)