Skip to content

Commit 1a8c70d

Browse files
committed
fix: refactor build output directory handling and update command paths in getSeaCommands function
1 parent db5a61d commit 1a8c70d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

nx-node-sea-e2e/src/nx-node-sea.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,15 @@ function createTestProject() {
9898
);
9999

100100
// mock the build output
101-
mkdirSync(join(projectDirectory, 'dist', projectName), {
102-
recursive: true,
103-
});
101+
const buildOutputDirectory = join(projectDirectory, 'dist', projectName);
102+
mkdirSync(buildOutputDirectory, { recursive: true });
104103
writeFileSync(
105-
join(projectDirectory, 'dist', projectName, 'main.js'),
104+
join(buildOutputDirectory, 'main.js'),
106105
'console.log("Hello World");'
107106
);
108107

108+
console.log(`Created dummy build output in "${buildOutputDirectory}"`);
109+
109110
return projectDirectory;
110111
}
111112

nx-node-sea/src/plugin.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,12 @@ function getSeaCommands(options: {
202202
);
203203
const _blobPath = blobPath.replaceAll(posix.sep, win32.sep);
204204
return [
205-
`node -e "require('fs').copyFileSync(process.execPath, '${_nodeBinPath}')"`,
206-
...(sign ? [`signtool remove /s '${_nodeBinPath}' `] : []),
205+
`node -e "require('fs').copyFileSync(process.execPath, 'node.exe')"`,
206+
...(sign ? [`signtool remove /s 'node.exe' `] : []),
207207
// TODO: check if powershell or command prompt
208-
`npx postject ${_nodeBinPath} NODE_SEA_BLOB ${_blobPath} \` --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8bß5df1996b2`,
209-
...(sign ? [`signtool sign /fd SHA256 ${_nodeBinPath}`] : []),
208+
`npx postject node.exe NODE_SEA_BLOB ${_blobPath} \` --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8bß5df1996b2`,
209+
...(sign ? [`signtool sign /fd SHA256 node.exe`] : []),
210+
`mv node.exe ${_nodeBinPath}`,
210211
];
211212
} else {
212213
throw new Error(`Unsupported platform: ${platform}`);

0 commit comments

Comments
 (0)