@simplysm/sd-cli 13.0.68 → 13.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -957
- package/dist/builders/BaseBuilder.d.ts +23 -23
- package/dist/builders/BaseBuilder.d.ts.map +1 -1
- package/dist/builders/BaseBuilder.js +15 -15
- package/dist/builders/DtsBuilder.d.ts +4 -4
- package/dist/builders/DtsBuilder.js +1 -1
- package/dist/builders/LibraryBuilder.d.ts +3 -3
- package/dist/builders/types.d.ts +10 -10
- package/dist/capacitor/capacitor.d.ts +36 -36
- package/dist/capacitor/capacitor.js +63 -63
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/add-client.d.ts +8 -8
- package/dist/commands/add-client.js +15 -15
- package/dist/commands/add-client.js.map +1 -1
- package/dist/commands/add-server.d.ts +9 -9
- package/dist/commands/add-server.js +13 -13
- package/dist/commands/add-server.js.map +1 -1
- package/dist/commands/build.d.ts +9 -9
- package/dist/commands/check.js +3 -3
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/dev.d.ts +9 -9
- package/dist/commands/device.d.ts +9 -9
- package/dist/commands/device.d.ts.map +1 -1
- package/dist/commands/device.js +17 -17
- package/dist/commands/device.js.map +1 -1
- package/dist/commands/init.d.ts +6 -6
- package/dist/commands/init.js +12 -12
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/lint.d.ts +23 -23
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +25 -25
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/publish.d.ts +13 -13
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +61 -61
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/replace-deps.d.ts +3 -3
- package/dist/commands/replace-deps.d.ts.map +1 -1
- package/dist/commands/replace-deps.js +1 -1
- package/dist/commands/replace-deps.js.map +1 -1
- package/dist/commands/typecheck.d.ts +20 -20
- package/dist/commands/typecheck.d.ts.map +1 -1
- package/dist/commands/typecheck.js +20 -20
- package/dist/commands/typecheck.js.map +1 -1
- package/dist/commands/watch.d.ts +7 -7
- package/dist/electron/electron.d.ts +27 -27
- package/dist/electron/electron.js +32 -32
- package/dist/electron/electron.js.map +1 -1
- package/dist/infra/ResultCollector.d.ts +9 -9
- package/dist/infra/ResultCollector.js +5 -5
- package/dist/infra/SignalHandler.d.ts +7 -7
- package/dist/infra/SignalHandler.js +4 -4
- package/dist/infra/WorkerManager.d.ts +14 -14
- package/dist/infra/WorkerManager.js +11 -11
- package/dist/orchestrators/BuildOrchestrator.d.ts +19 -19
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +26 -26
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevOrchestrator.d.ts +25 -25
- package/dist/orchestrators/DevOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/DevOrchestrator.js +30 -30
- package/dist/orchestrators/DevOrchestrator.js.map +1 -1
- package/dist/orchestrators/WatchOrchestrator.d.ts +13 -13
- package/dist/orchestrators/WatchOrchestrator.js +17 -17
- package/dist/orchestrators/WatchOrchestrator.js.map +1 -1
- package/dist/sd-cli-entry.d.ts +2 -2
- package/dist/sd-cli-entry.js +38 -38
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.d.ts +2 -2
- package/dist/sd-cli.js +1 -1
- package/dist/sd-cli.js.map +1 -1
- package/dist/sd-config.types.d.ts +84 -84
- package/dist/sd-config.types.d.ts.map +1 -1
- package/dist/utils/build-env.d.ts +1 -1
- package/dist/utils/config-editor.d.ts +5 -5
- package/dist/utils/config-editor.js +2 -2
- package/dist/utils/config-editor.js.map +1 -1
- package/dist/utils/copy-public.d.ts +9 -9
- package/dist/utils/copy-src.d.ts +9 -9
- package/dist/utils/esbuild-config.d.ts +30 -30
- package/dist/utils/esbuild-config.d.ts.map +1 -1
- package/dist/utils/output-utils.d.ts +6 -6
- package/dist/utils/package-utils.d.ts +6 -6
- package/dist/utils/package-utils.js +1 -1
- package/dist/utils/package-utils.js.map +1 -1
- package/dist/utils/rebuild-manager.js +3 -3
- package/dist/utils/rebuild-manager.js.map +1 -1
- package/dist/utils/replace-deps.d.ts +25 -25
- package/dist/utils/replace-deps.js +3 -3
- package/dist/utils/replace-deps.js.map +1 -1
- package/dist/utils/sd-config.d.ts +3 -3
- package/dist/utils/sd-config.js +3 -3
- package/dist/utils/sd-config.js.map +1 -1
- package/dist/utils/tailwind-config-deps.d.ts +3 -3
- package/dist/utils/template.d.ts +8 -8
- package/dist/utils/tsconfig.d.ts +16 -16
- package/dist/utils/tsconfig.js +2 -2
- package/dist/utils/tsconfig.js.map +1 -1
- package/dist/utils/typecheck-serialization.d.ts +8 -8
- package/dist/utils/vite-config.d.ts +8 -8
- package/dist/utils/vite-config.d.ts.map +1 -1
- package/dist/utils/vite-config.js +3 -3
- package/dist/utils/worker-events.d.ts +12 -12
- package/dist/utils/worker-events.d.ts.map +1 -1
- package/dist/utils/worker-utils.d.ts +3 -3
- package/dist/utils/worker-utils.js +2 -2
- package/dist/utils/worker-utils.js.map +1 -1
- package/dist/workers/client.worker.d.ts +14 -14
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +1 -1
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/dts.worker.d.ts +13 -13
- package/dist/workers/dts.worker.d.ts.map +1 -1
- package/dist/workers/dts.worker.js +3 -3
- package/dist/workers/dts.worker.js.map +1 -1
- package/dist/workers/library.worker.d.ts +12 -12
- package/dist/workers/library.worker.js +1 -1
- package/dist/workers/library.worker.js.map +1 -1
- package/dist/workers/lint.worker.d.ts +1 -1
- package/dist/workers/server-runtime.worker.d.ts +6 -6
- package/dist/workers/server-runtime.worker.js +6 -6
- package/dist/workers/server-runtime.worker.js.map +1 -1
- package/dist/workers/server.worker.d.ts +20 -20
- package/dist/workers/server.worker.d.ts.map +1 -1
- package/dist/workers/server.worker.js +6 -6
- package/dist/workers/server.worker.js.map +1 -1
- package/package.json +8 -7
- package/src/builders/BaseBuilder.ts +33 -33
- package/src/builders/DtsBuilder.ts +5 -5
- package/src/builders/LibraryBuilder.ts +9 -9
- package/src/builders/types.ts +10 -10
- package/src/capacitor/capacitor.ts +119 -119
- package/src/commands/add-client.ts +31 -31
- package/src/commands/add-server.ts +34 -34
- package/src/commands/build.ts +9 -9
- package/src/commands/check.ts +5 -5
- package/src/commands/dev.ts +9 -9
- package/src/commands/device.ts +30 -30
- package/src/commands/init.ts +25 -25
- package/src/commands/lint.ts +64 -64
- package/src/commands/publish.ts +139 -139
- package/src/commands/replace-deps.ts +4 -4
- package/src/commands/typecheck.ts +74 -74
- package/src/commands/watch.ts +7 -7
- package/src/electron/electron.ts +51 -51
- package/src/infra/ResultCollector.ts +9 -9
- package/src/infra/SignalHandler.ts +7 -7
- package/src/infra/WorkerManager.ts +14 -14
- package/src/orchestrators/BuildOrchestrator.ts +76 -76
- package/src/orchestrators/DevOrchestrator.ts +88 -88
- package/src/orchestrators/WatchOrchestrator.ts +39 -39
- package/src/sd-cli-entry.ts +43 -43
- package/src/sd-cli.ts +15 -15
- package/src/sd-config.types.ts +85 -85
- package/src/utils/build-env.ts +1 -1
- package/src/utils/config-editor.ts +19 -19
- package/src/utils/copy-public.ts +17 -17
- package/src/utils/copy-src.ts +11 -11
- package/src/utils/esbuild-config.ts +33 -33
- package/src/utils/output-utils.ts +11 -11
- package/src/utils/package-utils.ts +12 -12
- package/src/utils/rebuild-manager.ts +3 -3
- package/src/utils/replace-deps.ts +361 -361
- package/src/utils/sd-config.ts +44 -44
- package/src/utils/tailwind-config-deps.ts +98 -98
- package/src/utils/template.ts +56 -56
- package/src/utils/tsconfig.ts +127 -127
- package/src/utils/typecheck-serialization.ts +86 -86
- package/src/utils/vite-config.ts +341 -341
- package/src/utils/worker-events.ts +16 -16
- package/src/utils/worker-utils.ts +45 -45
- package/src/workers/client.worker.ts +34 -34
- package/src/workers/dts.worker.ts +467 -467
- package/src/workers/library.worker.ts +314 -314
- package/src/workers/lint.worker.ts +16 -16
- package/src/workers/server-runtime.worker.ts +157 -157
- package/src/workers/server.worker.ts +572 -572
- package/templates/add-client/__CLIENT__/package.json.hbs +1 -1
- package/templates/add-server/__SERVER__/package.json.hbs +2 -2
- package/templates/init/package.json.hbs +3 -3
- package/tests/config-editor.spec.ts +160 -0
- package/tests/copy-src.spec.ts +50 -0
- package/tests/get-compiler-options-for-package.spec.ts +139 -0
- package/tests/get-package-source-files.spec.ts +181 -0
- package/tests/get-types-from-package-json.spec.ts +107 -0
- package/tests/infra/ResultCollector.spec.ts +39 -0
- package/tests/infra/SignalHandler.spec.ts +38 -0
- package/tests/infra/WorkerManager.spec.ts +97 -0
- package/tests/load-ignore-patterns.spec.ts +188 -0
- package/tests/load-sd-config.spec.ts +137 -0
- package/tests/package-utils.spec.ts +188 -0
- package/tests/parse-root-tsconfig.spec.ts +89 -0
- package/tests/replace-deps.spec.ts +308 -0
- package/tests/run-lint.spec.ts +415 -0
- package/tests/run-typecheck.spec.ts +653 -0
- package/tests/run-watch.spec.ts +75 -0
- package/tests/sd-cli.spec.ts +330 -0
- package/tests/tailwind-config-deps.spec.ts +30 -0
- package/tests/template.spec.ts +70 -0
- package/tests/utils/rebuild-manager.spec.ts +43 -0
- package/tests/write-changed-output-files.spec.ts +97 -0
package/src/electron/electron.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { SdElectronConfig } from "../sd-config.types";
|
|
|
8
8
|
import { execa } from "execa";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* package.json
|
|
11
|
+
* package.json type
|
|
12
12
|
*/
|
|
13
13
|
interface NpmConfig {
|
|
14
14
|
name: string;
|
|
@@ -18,11 +18,11 @@ interface NpmConfig {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Electron
|
|
21
|
+
* Electron project management class
|
|
22
22
|
*
|
|
23
|
-
* - Electron
|
|
24
|
-
* - Windows
|
|
25
|
-
* -
|
|
23
|
+
* - Initialize Electron project (create package.json, install dependencies, rebuild native modules)
|
|
24
|
+
* - Build Windows executable (electron-builder)
|
|
25
|
+
* - Run in development mode (load Vite dev server URL)
|
|
26
26
|
*/
|
|
27
27
|
export class Electron {
|
|
28
28
|
private static readonly _logger = consola.withTag("sd:cli:electron");
|
|
@@ -40,7 +40,7 @@ export class Electron {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Electron
|
|
43
|
+
* Create Electron instance (with configuration validation)
|
|
44
44
|
*/
|
|
45
45
|
static async create(pkgPath: string, config: SdElectronConfig): Promise<Electron> {
|
|
46
46
|
Electron._validateConfig(config);
|
|
@@ -50,16 +50,16 @@ export class Electron {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Validate configuration
|
|
54
54
|
*/
|
|
55
55
|
private static _validateConfig(config: SdElectronConfig): void {
|
|
56
56
|
if (typeof config.appId !== "string" || config.appId.trim() === "") {
|
|
57
|
-
throw new Error("electron.appId
|
|
57
|
+
throw new Error("electron.appId is required.");
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* Execute command (with logging)
|
|
63
63
|
*/
|
|
64
64
|
private async _exec(
|
|
65
65
|
cmd: string,
|
|
@@ -67,31 +67,31 @@ export class Electron {
|
|
|
67
67
|
cwd: string,
|
|
68
68
|
env?: Record<string, string>,
|
|
69
69
|
): Promise<string> {
|
|
70
|
-
Electron._logger.debug(
|
|
70
|
+
Electron._logger.debug(`executed command: ${cmd} ${args.join(" ")}`);
|
|
71
71
|
const { stdout: result } = await execa(cmd, args, { cwd, env: { ...process.env, ...env } });
|
|
72
|
-
Electron._logger.debug(
|
|
72
|
+
Electron._logger.debug(`execution result: ${result}`);
|
|
73
73
|
return result;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
//#region Public Methods
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* Electron
|
|
79
|
+
* Initialize Electron project
|
|
80
80
|
*
|
|
81
|
-
* 1. .electron/src/package.json
|
|
82
|
-
* 2. npm install
|
|
83
|
-
* 3. electron-rebuild
|
|
81
|
+
* 1. Create .electron/src/package.json
|
|
82
|
+
* 2. Run npm install
|
|
83
|
+
* 3. Run electron-rebuild (rebuild native modules)
|
|
84
84
|
*/
|
|
85
85
|
async initialize(): Promise<void> {
|
|
86
86
|
const srcPath = path.resolve(this._electronPath, "src");
|
|
87
87
|
|
|
88
|
-
// 1. package.json
|
|
88
|
+
// 1. Create package.json
|
|
89
89
|
await this._setupPackageJson(srcPath);
|
|
90
90
|
|
|
91
91
|
// 2. npm install
|
|
92
92
|
await this._exec("npm", ["install"], srcPath);
|
|
93
93
|
|
|
94
|
-
// 3. native
|
|
94
|
+
// 3. Rebuild native modules
|
|
95
95
|
const reinstallDeps = this._config.reinstallDependencies ?? [];
|
|
96
96
|
if (reinstallDeps.length > 0) {
|
|
97
97
|
await this._exec("npx", ["electron-rebuild"], srcPath);
|
|
@@ -99,44 +99,44 @@ export class Electron {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* Production build
|
|
103
103
|
*
|
|
104
|
-
* 1.
|
|
105
|
-
* 2.
|
|
106
|
-
* 3. electron-builder
|
|
107
|
-
* 4. electron-builder
|
|
108
|
-
* 5.
|
|
104
|
+
* 1. Bundle electron-main.ts with esbuild
|
|
105
|
+
* 2. Copy web assets
|
|
106
|
+
* 3. Create electron-builder configuration
|
|
107
|
+
* 4. Run electron-builder
|
|
108
|
+
* 5. Copy build output
|
|
109
109
|
*/
|
|
110
110
|
async build(outPath: string): Promise<void> {
|
|
111
111
|
const srcPath = path.resolve(this._electronPath, "src");
|
|
112
112
|
|
|
113
|
-
// 1. electron-main.ts
|
|
113
|
+
// 1. Bundle electron-main.ts
|
|
114
114
|
await this._bundleMainProcess(srcPath);
|
|
115
115
|
|
|
116
|
-
// 2.
|
|
116
|
+
// 2. Copy web assets (outPath → .electron/src/)
|
|
117
117
|
await this._copyWebAssets(outPath, srcPath);
|
|
118
118
|
|
|
119
|
-
// 3. electron-builder
|
|
119
|
+
// 3. Create electron-builder configuration and run
|
|
120
120
|
await this._runElectronBuilder(srcPath);
|
|
121
121
|
|
|
122
|
-
// 4.
|
|
122
|
+
// 4. Copy build output
|
|
123
123
|
await this._copyBuildOutput(outPath);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
127
|
+
* Run in development mode
|
|
128
128
|
*
|
|
129
|
-
* 1.
|
|
130
|
-
* 2. dist/electron/package.json
|
|
131
|
-
* 3. npx electron .
|
|
129
|
+
* 1. Bundle electron-main.ts with esbuild
|
|
130
|
+
* 2. Create dist/electron/package.json
|
|
131
|
+
* 3. Run npx electron .
|
|
132
132
|
*/
|
|
133
133
|
async run(url?: string): Promise<void> {
|
|
134
134
|
const electronRunPath = path.resolve(this._pkgPath, "dist/electron");
|
|
135
135
|
|
|
136
|
-
// 1. electron-main.ts
|
|
136
|
+
// 1. Bundle electron-main.ts
|
|
137
137
|
await this._bundleMainProcess(electronRunPath);
|
|
138
138
|
|
|
139
|
-
// 2. package.json
|
|
139
|
+
// 2. Create package.json
|
|
140
140
|
await fsMkdir(electronRunPath);
|
|
141
141
|
await fsWriteJson(
|
|
142
142
|
path.resolve(electronRunPath, "package.json"),
|
|
@@ -144,7 +144,7 @@ export class Electron {
|
|
|
144
144
|
{ space: 2 },
|
|
145
145
|
);
|
|
146
146
|
|
|
147
|
-
// 3. Electron
|
|
147
|
+
// 3. Run Electron
|
|
148
148
|
const runEnv: Record<string, string> = {
|
|
149
149
|
NODE_ENV: "development",
|
|
150
150
|
...this._config.env,
|
|
@@ -159,17 +159,17 @@ export class Electron {
|
|
|
159
159
|
|
|
160
160
|
//#endregion
|
|
161
161
|
|
|
162
|
-
//#region Private -
|
|
162
|
+
//#region Private - Initialization
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
|
-
* .electron/src/package.json
|
|
165
|
+
* Create .electron/src/package.json
|
|
166
166
|
*/
|
|
167
167
|
private async _setupPackageJson(srcPath: string): Promise<void> {
|
|
168
168
|
await fsMkdir(srcPath);
|
|
169
169
|
|
|
170
170
|
const reinstallDeps = this._config.reinstallDependencies ?? [];
|
|
171
171
|
|
|
172
|
-
//
|
|
172
|
+
// Extract versions from main package.json that match reinstallDependencies
|
|
173
173
|
const dependencies: Record<string, string> = {};
|
|
174
174
|
for (const dep of reinstallDeps) {
|
|
175
175
|
const version = this._npmConfig.dependencies?.[dep];
|
|
@@ -195,17 +195,17 @@ export class Electron {
|
|
|
195
195
|
|
|
196
196
|
//#endregion
|
|
197
197
|
|
|
198
|
-
//#region Private -
|
|
198
|
+
//#region Private - Bundling
|
|
199
199
|
|
|
200
200
|
/**
|
|
201
|
-
*
|
|
201
|
+
* Bundle electron-main.ts with esbuild
|
|
202
202
|
*/
|
|
203
203
|
private async _bundleMainProcess(outDir: string): Promise<void> {
|
|
204
204
|
const esbuild = await import("esbuild");
|
|
205
205
|
const entryPoint = path.resolve(this._pkgPath, "src/electron-main.ts");
|
|
206
206
|
|
|
207
207
|
if (!(await fsExists(entryPoint))) {
|
|
208
|
-
throw new Error(`electron-main.ts
|
|
208
|
+
throw new Error(`electron-main.ts file not found: ${entryPoint}`);
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
const builtinModules = module.builtinModules.flatMap((m) => [m, `node:${m}`]);
|
|
@@ -226,15 +226,15 @@ export class Electron {
|
|
|
226
226
|
|
|
227
227
|
//#endregion
|
|
228
228
|
|
|
229
|
-
//#region Private -
|
|
229
|
+
//#region Private - Build
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
|
-
*
|
|
232
|
+
* Copy web assets (build output → .electron/src/)
|
|
233
233
|
*/
|
|
234
234
|
private async _copyWebAssets(outPath: string, srcPath: string): Promise<void> {
|
|
235
235
|
const items = await fsReaddir(outPath);
|
|
236
236
|
for (const item of items) {
|
|
237
|
-
// electron/
|
|
237
|
+
// Exclude electron/ subdirectory (prevent self-copying)
|
|
238
238
|
if (item === "electron") continue;
|
|
239
239
|
|
|
240
240
|
const source = path.resolve(outPath, item);
|
|
@@ -244,7 +244,7 @@ export class Electron {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
/**
|
|
247
|
-
*
|
|
247
|
+
* Check if symlink creation is possible (Windows build requirement)
|
|
248
248
|
*/
|
|
249
249
|
private static _canCreateSymlink(): boolean {
|
|
250
250
|
const tmpDir = os.tmpdir();
|
|
@@ -264,12 +264,12 @@ export class Electron {
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
/**
|
|
267
|
-
* electron-builder
|
|
267
|
+
* Run electron-builder
|
|
268
268
|
*/
|
|
269
269
|
private async _runElectronBuilder(srcPath: string): Promise<void> {
|
|
270
270
|
if (!Electron._canCreateSymlink()) {
|
|
271
271
|
throw new Error(
|
|
272
|
-
"
|
|
272
|
+
"Symlink creation permission is required to build Electron. Enable Developer mode on Windows.",
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
275
|
|
|
@@ -307,7 +307,7 @@ export class Electron {
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
|
-
*
|
|
310
|
+
* Copy build output (.electron/dist/ → dist/electron/)
|
|
311
311
|
*/
|
|
312
312
|
private async _copyBuildOutput(outPath: string): Promise<void> {
|
|
313
313
|
const distPath = path.resolve(this._electronPath, "dist");
|
|
@@ -318,21 +318,21 @@ export class Electron {
|
|
|
318
318
|
const version = this._npmConfig.version;
|
|
319
319
|
const isPortable = this._config.portable === true;
|
|
320
320
|
|
|
321
|
-
// electron-builder
|
|
321
|
+
// electron-builder output filename
|
|
322
322
|
const builderFileName = `${description} ${isPortable ? "" : "Setup "}${version}.exe`;
|
|
323
323
|
const sourcePath = path.resolve(distPath, builderFileName);
|
|
324
324
|
|
|
325
325
|
if (await fsExists(sourcePath)) {
|
|
326
|
-
// latest
|
|
326
|
+
// Copy latest file
|
|
327
327
|
const latestFileName = `${description}${isPortable ? "-portable" : ""}-latest.exe`;
|
|
328
328
|
await fsCopy(sourcePath, path.resolve(electronOutPath, latestFileName));
|
|
329
329
|
|
|
330
|
-
//
|
|
330
|
+
// Copy per-version file to updates/
|
|
331
331
|
const updatesPath = path.resolve(electronOutPath, "updates");
|
|
332
332
|
await fsMkdir(updatesPath);
|
|
333
333
|
await fsCopy(sourcePath, path.resolve(updatesPath, `${version}.exe`));
|
|
334
334
|
} else {
|
|
335
|
-
Electron._logger.warn(
|
|
335
|
+
Electron._logger.warn(`build output not found: ${sourcePath}`);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Build result status
|
|
3
3
|
*/
|
|
4
4
|
export interface BuildResult {
|
|
5
5
|
name: string;
|
|
@@ -11,17 +11,17 @@ export interface BuildResult {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Class that collects and manages build results
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Manages build results from multiple Builders at a central location and
|
|
17
|
+
* provides filtering and output functionality by status.
|
|
18
18
|
*/
|
|
19
19
|
export class ResultCollector {
|
|
20
20
|
private readonly _results = new Map<string, BuildResult>();
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @param result
|
|
23
|
+
* Add result
|
|
24
|
+
* @param result build result
|
|
25
25
|
*/
|
|
26
26
|
add(result: BuildResult): void {
|
|
27
27
|
const key = `${result.name}:${result.type}`;
|
|
@@ -29,15 +29,15 @@ export class ResultCollector {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @param key
|
|
32
|
+
* Get result by key
|
|
33
|
+
* @param key result key (e.g., "core-common:build")
|
|
34
34
|
*/
|
|
35
35
|
get(key: string): BuildResult | undefined {
|
|
36
36
|
return this._results.get(key);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Return internal Map (for backward compatibility)
|
|
41
41
|
*/
|
|
42
42
|
toMap(): Map<string, BuildResult> {
|
|
43
43
|
return this._results;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Class that handles process termination signals
|
|
3
3
|
*
|
|
4
|
-
* SIGINT (Ctrl+C)
|
|
5
|
-
*
|
|
4
|
+
* Detects SIGINT (Ctrl+C) and SIGTERM signals and
|
|
5
|
+
* provides a Promise that waits until termination.
|
|
6
6
|
*/
|
|
7
7
|
export class SignalHandler {
|
|
8
8
|
private _terminateResolver: (() => void) | null = null;
|
|
@@ -26,22 +26,22 @@ export class SignalHandler {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Wait until termination signal is received
|
|
30
30
|
*/
|
|
31
31
|
waitForTermination(): Promise<void> {
|
|
32
32
|
return this._terminatePromise;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Check if terminated
|
|
37
37
|
*/
|
|
38
38
|
isTerminated(): boolean {
|
|
39
39
|
return this._terminated;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
* (
|
|
43
|
+
* Request termination programmatically
|
|
44
|
+
* (used when triggering termination from tests or externally)
|
|
45
45
|
*/
|
|
46
46
|
requestTermination(): void {
|
|
47
47
|
if (!this._terminated) {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Worker, type WorkerProxy, type WorkerModule } from "@simplysm/core-node";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Class that manages Worker lifecycle
|
|
5
5
|
*
|
|
6
|
-
* Worker
|
|
7
|
-
*
|
|
6
|
+
* Centrally manages Worker creation, lookup, and termination
|
|
7
|
+
* to prevent resource leaks and provide consistent Worker management.
|
|
8
8
|
*/
|
|
9
9
|
export class WorkerManager {
|
|
10
10
|
private readonly _workers = new Map<string, WorkerProxy<WorkerModule>>();
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @param id Worker
|
|
15
|
-
* @param workerPath Worker
|
|
16
|
-
* @returns
|
|
13
|
+
* Create a new Worker
|
|
14
|
+
* @param id Worker identifier (e.g., "core-common:build")
|
|
15
|
+
* @param workerPath Worker file path
|
|
16
|
+
* @returns Created WorkerProxy
|
|
17
17
|
*/
|
|
18
18
|
create<TModule extends WorkerModule>(id: string, workerPath: string): WorkerProxy<TModule> {
|
|
19
19
|
const worker = Worker.create<TModule>(workerPath);
|
|
@@ -22,16 +22,16 @@ export class WorkerManager {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @param id Worker
|
|
25
|
+
* Lookup Worker by ID
|
|
26
|
+
* @param id Worker identifier
|
|
27
27
|
*/
|
|
28
28
|
get<TModule extends WorkerModule>(id: string): WorkerProxy<TModule> | undefined {
|
|
29
29
|
return this._workers.get(id) as WorkerProxy<TModule> | undefined;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @param id Worker
|
|
33
|
+
* Terminate and remove a specific Worker
|
|
34
|
+
* @param id Worker identifier
|
|
35
35
|
*/
|
|
36
36
|
async terminate(id: string): Promise<void> {
|
|
37
37
|
const worker = this._workers.get(id);
|
|
@@ -42,7 +42,7 @@ export class WorkerManager {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Terminate all Workers
|
|
46
46
|
*/
|
|
47
47
|
async terminateAll(): Promise<void> {
|
|
48
48
|
await Promise.all([...this._workers.values()].map((w) => w.terminate()));
|
|
@@ -50,14 +50,14 @@ export class WorkerManager {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Number of managed Workers
|
|
54
54
|
*/
|
|
55
55
|
get size(): number {
|
|
56
56
|
return this._workers.size;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* List of all Worker IDs
|
|
61
61
|
*/
|
|
62
62
|
get ids(): string[] {
|
|
63
63
|
return [...this._workers.keys()];
|