@simplysm/sd-cli 14.0.7 → 14.0.9
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/dist/angular/client-transform-stylesheet.d.ts.map +1 -1
- package/dist/angular/client-transform-stylesheet.js.map +1 -1
- package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
- package/dist/angular/vite-angular-plugin.js +15 -8
- package/dist/angular/vite-angular-plugin.js.map +1 -1
- package/dist/angular/vite-postcss-inline-plugin.d.ts.map +1 -1
- package/dist/angular/vite-postcss-inline-plugin.js.map +1 -1
- package/dist/capacitor/capacitor.d.ts +1 -1
- package/dist/capacitor/capacitor.d.ts.map +1 -1
- package/dist/capacitor/capacitor.js +43 -44
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +2 -2
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +12 -13
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/replace-deps.d.ts.map +1 -1
- package/dist/commands/replace-deps.js.map +1 -1
- package/dist/commands/typecheck.d.ts.map +1 -1
- package/dist/commands/typecheck.js +12 -12
- package/dist/commands/typecheck.js.map +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js.map +1 -1
- package/dist/electron/electron.d.ts.map +1 -1
- package/dist/electron/electron.js +42 -37
- package/dist/electron/electron.js.map +1 -1
- package/dist/engines/BaseEngine.d.ts +1 -5
- package/dist/engines/BaseEngine.d.ts.map +1 -1
- package/dist/engines/BaseEngine.js +7 -16
- package/dist/engines/BaseEngine.js.map +1 -1
- package/dist/engines/NgtscEngine.d.ts.map +1 -1
- package/dist/engines/NgtscEngine.js +10 -11
- package/dist/engines/NgtscEngine.js.map +1 -1
- package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -1
- package/dist/engines/ServerEsbuildEngine.js +10 -11
- package/dist/engines/ServerEsbuildEngine.js.map +1 -1
- package/dist/engines/TscEngine.d.ts.map +1 -1
- package/dist/engines/TscEngine.js +10 -11
- package/dist/engines/TscEngine.js.map +1 -1
- package/dist/engines/ViteEngine.d.ts.map +1 -1
- package/dist/engines/ViteEngine.js +3 -13
- package/dist/engines/ViteEngine.js.map +1 -1
- package/dist/engines/index.d.ts.map +1 -1
- package/dist/engines/index.js.map +1 -1
- package/dist/engines/types.d.ts +3 -6
- package/dist/engines/types.d.ts.map +1 -1
- package/dist/engines/types.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/ResultCollector.d.ts +1 -1
- package/dist/infra/ResultCollector.d.ts.map +1 -1
- package/dist/infra/ResultCollector.js.map +1 -1
- package/dist/infra/SignalHandler.d.ts.map +1 -1
- package/dist/infra/SignalHandler.js.map +1 -1
- package/dist/infra/WorkerManager.d.ts.map +1 -1
- package/dist/infra/WorkerManager.js.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +30 -61
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevWatchOrchestrator.d.ts +2 -0
- package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/DevWatchOrchestrator.js +40 -44
- package/dist/orchestrators/DevWatchOrchestrator.js.map +1 -1
- package/dist/sd-cli-entry.d.ts.map +1 -1
- package/dist/sd-cli-entry.js +2 -13
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.d.ts.map +1 -1
- package/dist/sd-cli.js +5 -5
- package/dist/sd-cli.js.map +1 -1
- package/dist/sd-config.types.d.ts.map +1 -1
- package/dist/sd-config.types.js.map +1 -1
- package/dist/utils/SdCliReporter.d.ts +18 -0
- package/dist/utils/SdCliReporter.d.ts.map +1 -0
- package/dist/utils/SdCliReporter.js +144 -0
- package/dist/utils/SdCliReporter.js.map +1 -0
- package/dist/utils/angular-build.d.ts.map +1 -1
- package/dist/utils/angular-build.js.map +1 -1
- package/dist/utils/angular-compiler.d.ts.map +1 -1
- package/dist/utils/angular-compiler.js +11 -4
- package/dist/utils/angular-compiler.js.map +1 -1
- package/dist/utils/build-env.d.ts.map +1 -1
- package/dist/utils/build-env.js +2 -1
- package/dist/utils/build-env.js.map +1 -1
- package/dist/utils/concurrency.d.ts.map +1 -1
- package/dist/utils/concurrency.js.map +1 -1
- package/dist/utils/copy-public.d.ts.map +1 -1
- package/dist/utils/copy-public.js +21 -21
- package/dist/utils/copy-public.js.map +1 -1
- package/dist/utils/copy-src.d.ts.map +1 -1
- package/dist/utils/copy-src.js +12 -12
- package/dist/utils/copy-src.js.map +1 -1
- package/dist/utils/diagnostic-utils.d.ts.map +1 -1
- package/dist/utils/diagnostic-utils.js +3 -2
- package/dist/utils/diagnostic-utils.js.map +1 -1
- package/dist/utils/engine-stop.d.ts.map +1 -1
- package/dist/utils/engine-stop.js.map +1 -1
- package/dist/utils/esbuild-config.d.ts.map +1 -1
- package/dist/utils/esbuild-config.js +2 -0
- package/dist/utils/esbuild-config.js.map +1 -1
- package/dist/utils/generate-pwa-icons.d.ts.map +1 -1
- package/dist/utils/generate-pwa-icons.js.map +1 -1
- package/dist/utils/hmr-candidates.d.ts.map +1 -1
- package/dist/utils/hmr-candidates.js.map +1 -1
- package/dist/utils/lint-utils.d.ts.map +1 -1
- package/dist/utils/lint-utils.js.map +1 -1
- package/dist/utils/lint-with-program.d.ts.map +1 -1
- package/dist/utils/lint-with-program.js +7 -3
- package/dist/utils/lint-with-program.js.map +1 -1
- package/dist/utils/ngtsc-build-core.d.ts +2 -10
- package/dist/utils/ngtsc-build-core.d.ts.map +1 -1
- package/dist/utils/ngtsc-build-core.js +16 -15
- package/dist/utils/ngtsc-build-core.js.map +1 -1
- package/dist/utils/orchestrator-utils.d.ts.map +1 -1
- package/dist/utils/orchestrator-utils.js.map +1 -1
- package/dist/utils/output-path-rewriter.d.ts.map +1 -1
- package/dist/utils/output-path-rewriter.js +7 -7
- package/dist/utils/output-path-rewriter.js.map +1 -1
- package/dist/utils/output-utils.d.ts.map +1 -1
- package/dist/utils/output-utils.js +1 -1
- package/dist/utils/output-utils.js.map +1 -1
- package/dist/utils/package-utils.d.ts +4 -0
- package/dist/utils/package-utils.d.ts.map +1 -1
- package/dist/utils/package-utils.js +34 -13
- package/dist/utils/package-utils.js.map +1 -1
- package/dist/utils/rebuild-manager.d.ts +1 -1
- package/dist/utils/rebuild-manager.d.ts.map +1 -1
- package/dist/utils/rebuild-manager.js +3 -1
- package/dist/utils/rebuild-manager.js.map +1 -1
- package/dist/utils/replace-deps.d.ts.map +1 -1
- package/dist/utils/replace-deps.js +10 -10
- package/dist/utils/replace-deps.js.map +1 -1
- package/dist/utils/scss-compiler.d.ts.map +1 -1
- package/dist/utils/scss-compiler.js.map +1 -1
- package/dist/utils/sd-config.d.ts.map +1 -1
- package/dist/utils/sd-config.js +2 -3
- package/dist/utils/sd-config.js.map +1 -1
- package/dist/utils/tsc-build.d.ts +3 -1
- package/dist/utils/tsc-build.d.ts.map +1 -1
- package/dist/utils/tsc-build.js +7 -4
- package/dist/utils/tsc-build.js.map +1 -1
- package/dist/utils/tsconfig.d.ts.map +1 -1
- package/dist/utils/tsconfig.js.map +1 -1
- package/dist/utils/typecheck-non-package.d.ts.map +1 -1
- package/dist/utils/typecheck-non-package.js +10 -5
- package/dist/utils/typecheck-non-package.js.map +1 -1
- package/dist/utils/typecheck-serialization.d.ts.map +1 -1
- package/dist/utils/typecheck-serialization.js.map +1 -1
- package/dist/utils/vite-config.d.ts.map +1 -1
- package/dist/utils/vite-config.js +2 -1
- package/dist/utils/vite-config.js.map +1 -1
- package/dist/utils/vite-scope-watch-plugin.d.ts.map +1 -1
- package/dist/utils/vite-scope-watch-plugin.js.map +1 -1
- package/dist/utils/worker-events.d.ts +1 -1
- package/dist/utils/worker-events.d.ts.map +1 -1
- package/dist/utils/worker-events.js +1 -0
- package/dist/utils/worker-events.js.map +1 -1
- package/dist/utils/worker-utils.d.ts +1 -1
- package/dist/utils/worker-utils.d.ts.map +1 -1
- package/dist/utils/worker-utils.js +3 -1
- package/dist/utils/worker-utils.js.map +1 -1
- package/dist/vitest-plugin.d.ts.map +1 -1
- package/dist/vitest-plugin.js +2 -0
- package/dist/vitest-plugin.js.map +1 -1
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +4 -0
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/library-build.worker.d.ts +2 -10
- package/dist/workers/library-build.worker.d.ts.map +1 -1
- package/dist/workers/library-build.worker.js +38 -14
- package/dist/workers/library-build.worker.js.map +1 -1
- package/dist/workers/lint.worker.d.ts.map +1 -1
- package/dist/workers/lint.worker.js.map +1 -1
- package/dist/workers/ngtsc-build.worker.d.ts.map +1 -1
- package/dist/workers/ngtsc-build.worker.js +40 -14
- package/dist/workers/ngtsc-build.worker.js.map +1 -1
- package/dist/workers/server-build.worker.d.ts +2 -10
- package/dist/workers/server-build.worker.d.ts.map +1 -1
- package/dist/workers/server-build.worker.js +30 -22
- package/dist/workers/server-build.worker.js.map +1 -1
- package/dist/workers/server-runtime.worker.d.ts.map +1 -1
- package/dist/workers/server-runtime.worker.js.map +1 -1
- package/package.json +4 -5
- package/src/angular/vite-angular-plugin.ts +18 -9
- package/src/capacitor/capacitor.ts +43 -44
- package/src/commands/check.ts +2 -2
- package/src/commands/publish.ts +12 -13
- package/src/commands/typecheck.ts +12 -12
- package/src/electron/electron.ts +44 -38
- package/src/engines/BaseEngine.ts +8 -19
- package/src/engines/NgtscEngine.ts +11 -11
- package/src/engines/ServerEsbuildEngine.ts +11 -11
- package/src/engines/TscEngine.ts +11 -11
- package/src/engines/ViteEngine.ts +3 -14
- package/src/engines/types.ts +3 -6
- package/src/infra/ResultCollector.ts +1 -1
- package/src/orchestrators/BuildOrchestrator.ts +31 -62
- package/src/orchestrators/DevWatchOrchestrator.ts +41 -44
- package/src/sd-cli-entry.ts +2 -12
- package/src/sd-cli.ts +8 -5
- package/src/utils/SdCliReporter.ts +177 -0
- package/src/utils/angular-compiler.ts +11 -4
- package/src/utils/build-env.ts +2 -1
- package/src/utils/copy-public.ts +21 -21
- package/src/utils/copy-src.ts +12 -12
- package/src/utils/diagnostic-utils.ts +3 -2
- package/src/utils/esbuild-config.ts +2 -0
- package/src/utils/lint-with-program.ts +7 -3
- package/src/utils/ngtsc-build-core.ts +18 -18
- package/src/utils/output-path-rewriter.ts +7 -7
- package/src/utils/output-utils.ts +1 -1
- package/src/utils/package-utils.ts +37 -13
- package/src/utils/rebuild-manager.ts +4 -2
- package/src/utils/replace-deps.ts +10 -10
- package/src/utils/sd-config.ts +2 -3
- package/src/utils/tsc-build.ts +9 -4
- package/src/utils/typecheck-non-package.ts +10 -5
- package/src/utils/vite-config.ts +2 -1
- package/src/utils/worker-events.ts +2 -1
- package/src/utils/worker-utils.ts +3 -1
- package/src/vitest-plugin.ts +5 -0
- package/src/workers/client.worker.ts +4 -0
- package/src/workers/library-build.worker.ts +48 -18
- package/src/workers/ngtsc-build.worker.ts +48 -13
- package/src/workers/server-build.worker.ts +32 -26
- package/tests/angular/vite-angular-plugin-hmr-fallback.spec.ts +11 -7
- package/tests/angular/vite-angular-plugin-lint.spec.ts +6 -1
- package/tests/capacitor/capacitor-build.spec.ts +14 -7
- package/tests/capacitor/capacitor-icon.spec.ts +14 -7
- package/tests/capacitor/capacitor-init.spec.ts +13 -6
- package/tests/capacitor/capacitor-run.spec.ts +18 -11
- package/tests/capacitor/capacitor-workspace.spec.ts +13 -6
- package/tests/commands/check.spec.ts +5 -2
- package/tests/commands/publish.spec.ts +4 -4
- package/tests/commands/typecheck.spec.ts +20 -31
- package/tests/electron/electron.spec.ts +32 -23
- package/tests/engines/base-engine.spec.ts +15 -21
- package/tests/engines/engine-lint-integration.spec.ts +5 -10
- package/tests/engines/ngtsc-engine.spec.ts +27 -41
- package/tests/engines/server-esbuild-engine.spec.ts +18 -29
- package/tests/engines/tsc-engine.spec.ts +14 -23
- package/tests/engines/vite-engine.spec.ts +10 -15
- package/tests/infra/result-collector.spec.ts +2 -2
- package/tests/orchestrators/build-orchestrator.spec.ts +19 -29
- package/tests/orchestrators/dev-watch-orchestrator.spec.ts +110 -95
- package/tests/utils/copy-src.spec.ts +25 -19
- package/tests/utils/diagnostic-utils.spec.ts +72 -0
- package/tests/utils/ngtsc-build-core-angular-compiler.spec.ts +2 -3
- package/tests/utils/output-path-rewriter.spec.ts +7 -6
- package/tests/utils/output-utils.spec.ts +5 -5
- package/tests/utils/rebuild-manager.spec.ts +1 -1
- package/tests/utils/sd-config.spec.ts +4 -0
- package/tests/utils/tsc-build.spec.ts +23 -5
- package/tests/workers/library-build-worker.spec.ts +113 -20
- package/tests/workers/ngtsc-build-lint.spec.ts +3 -6
- package/tests/workers/ngtsc-build-worker.spec.ts +11 -13
- package/tests/workers/server-build-lint.spec.ts +4 -1
- package/tests/workers/server-build-worker.spec.ts +25 -25
- package/tests/angular/migration-cleanup.spec.ts +0 -59
package/src/electron/electron.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import path from "path";
|
|
2
1
|
import os from "os";
|
|
3
2
|
import fs from "fs";
|
|
4
3
|
import module from "module";
|
|
5
|
-
import { fsx } from "@simplysm/core-node";
|
|
4
|
+
import { cpx, fsx, pathx } from "@simplysm/core-node";
|
|
6
5
|
import { consola } from "consola";
|
|
7
|
-
import { execa } from "execa";
|
|
8
6
|
import type { SdElectronConfig } from "../sd-config.types.js";
|
|
9
7
|
import { createEnvBanner } from "../utils/esbuild-config.js";
|
|
10
8
|
|
|
@@ -26,7 +24,7 @@ export class Electron {
|
|
|
26
24
|
private readonly _npmConfig: NpmConfig,
|
|
27
25
|
private readonly _exclude: string[],
|
|
28
26
|
) {
|
|
29
|
-
this._electronPath =
|
|
27
|
+
this._electronPath = pathx.posixResolve(this._pkgPath, ".electron");
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
static async create(
|
|
@@ -36,7 +34,7 @@ export class Electron {
|
|
|
36
34
|
): Promise<Electron> {
|
|
37
35
|
Electron._validateConfig(config);
|
|
38
36
|
|
|
39
|
-
const npmConfig = await fsx.readJson<NpmConfig>(
|
|
37
|
+
const npmConfig = await fsx.readJson<NpmConfig>(pathx.posixResolve(pkgPath, "package.json"));
|
|
40
38
|
return new Electron(pkgPath, config, npmConfig, exclude ?? []);
|
|
41
39
|
}
|
|
42
40
|
|
|
@@ -47,7 +45,7 @@ export class Electron {
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
private _localBin(name: string): string {
|
|
50
|
-
return
|
|
48
|
+
return pathx.posixResolve(this._pkgPath, "node_modules/.bin", name);
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
private async _exec(
|
|
@@ -57,7 +55,7 @@ export class Electron {
|
|
|
57
55
|
env?: Record<string, string>,
|
|
58
56
|
): Promise<string> {
|
|
59
57
|
Electron._logger.debug(`실행: ${cmd} ${args.join(" ")}`);
|
|
60
|
-
const { stdout: result } = await
|
|
58
|
+
const { stdout: result } = await cpx.exec(cmd, args, { cwd, env, shell: true });
|
|
61
59
|
Electron._logger.debug(`결과: ${result}`);
|
|
62
60
|
return result;
|
|
63
61
|
}
|
|
@@ -65,7 +63,7 @@ export class Electron {
|
|
|
65
63
|
//#region Public Methods
|
|
66
64
|
|
|
67
65
|
async initialize(): Promise<void> {
|
|
68
|
-
const srcPath =
|
|
66
|
+
const srcPath = pathx.posixResolve(this._electronPath, "src");
|
|
69
67
|
|
|
70
68
|
await this._setupPackageJson(srcPath);
|
|
71
69
|
await this._exec("npm", ["install"], srcPath);
|
|
@@ -77,12 +75,12 @@ export class Electron {
|
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
async run(url: string): Promise<void> {
|
|
80
|
-
const srcPath =
|
|
78
|
+
const srcPath = pathx.posixResolve(this._electronPath, "src");
|
|
81
79
|
|
|
82
80
|
await this.initialize();
|
|
83
81
|
|
|
84
82
|
const esbuild = await import("esbuild");
|
|
85
|
-
const entryPoint =
|
|
83
|
+
const entryPoint = pathx.posixResolve(this._pkgPath, "src/electron-main.ts");
|
|
86
84
|
|
|
87
85
|
if (!(await fsx.exists(entryPoint))) {
|
|
88
86
|
throw new Error(`electron-main.ts 파일을 찾을 수 없습니다: ${entryPoint}`);
|
|
@@ -92,12 +90,12 @@ export class Electron {
|
|
|
92
90
|
const reinstallDeps = this._config.reinstallDependencies ?? [];
|
|
93
91
|
await fsx.mkdir(srcPath);
|
|
94
92
|
|
|
95
|
-
let currentElectron:
|
|
93
|
+
let currentElectron: cpx.ExecProcess | null = null;
|
|
96
94
|
let isRestarting = false;
|
|
97
95
|
let resolveTermination: (() => void) | null = null;
|
|
98
96
|
|
|
99
97
|
const spawnElectron = () => {
|
|
100
|
-
currentElectron =
|
|
98
|
+
currentElectron = cpx.exec(this._localBin("electron"), ["."], {
|
|
101
99
|
cwd: srcPath,
|
|
102
100
|
stdio: "inherit",
|
|
103
101
|
reject: false,
|
|
@@ -116,12 +114,12 @@ export class Electron {
|
|
|
116
114
|
|
|
117
115
|
const ctx = await esbuild.context({
|
|
118
116
|
entryPoints: [entryPoint],
|
|
119
|
-
outfile:
|
|
117
|
+
outfile: pathx.posixResolve(srcPath, "electron-main.js"),
|
|
120
118
|
platform: "node",
|
|
121
119
|
target: "node20",
|
|
122
120
|
format: "cjs",
|
|
123
121
|
bundle: true,
|
|
124
|
-
external: ["electron", ...builtinModules, ...reinstallDeps],
|
|
122
|
+
external: ["electron", ...builtinModules, ...reinstallDeps, ...this._exclude],
|
|
125
123
|
banner: { js: envBanner },
|
|
126
124
|
plugins: [
|
|
127
125
|
{
|
|
@@ -155,15 +153,22 @@ export class Electron {
|
|
|
155
153
|
await ctx.watch();
|
|
156
154
|
|
|
157
155
|
await new Promise<void>((resolve) => {
|
|
158
|
-
|
|
156
|
+
let disposed = false;
|
|
157
|
+
|
|
158
|
+
const cleanup = () => {
|
|
159
|
+
if (disposed) return;
|
|
160
|
+
disposed = true;
|
|
161
|
+
process.removeListener("SIGINT", signalHandler);
|
|
162
|
+
process.removeListener("SIGTERM", signalHandler);
|
|
159
163
|
void ctx.dispose();
|
|
160
164
|
resolve();
|
|
161
165
|
};
|
|
162
166
|
|
|
167
|
+
resolveTermination = cleanup;
|
|
168
|
+
|
|
163
169
|
const signalHandler = () => {
|
|
164
170
|
if (currentElectron != null) currentElectron.kill();
|
|
165
|
-
|
|
166
|
-
resolve();
|
|
171
|
+
cleanup();
|
|
167
172
|
};
|
|
168
173
|
|
|
169
174
|
process.once("SIGINT", signalHandler);
|
|
@@ -172,7 +177,7 @@ export class Electron {
|
|
|
172
177
|
}
|
|
173
178
|
|
|
174
179
|
async build(outPath: string): Promise<void> {
|
|
175
|
-
const srcPath =
|
|
180
|
+
const srcPath = pathx.posixResolve(this._electronPath, "src");
|
|
176
181
|
|
|
177
182
|
await this._bundleMainProcess(srcPath);
|
|
178
183
|
await this._copyWebAssets(outPath, srcPath);
|
|
@@ -218,7 +223,7 @@ export class Electron {
|
|
|
218
223
|
packageJson["scripts"] = { postinstall: this._config.postInstallScript };
|
|
219
224
|
}
|
|
220
225
|
|
|
221
|
-
await fsx.writeJson(
|
|
226
|
+
await fsx.writeJson(pathx.posixResolve(srcPath, "package.json"), packageJson, { space: 2 });
|
|
222
227
|
}
|
|
223
228
|
|
|
224
229
|
//#endregion
|
|
@@ -227,7 +232,7 @@ export class Electron {
|
|
|
227
232
|
|
|
228
233
|
private async _bundleMainProcess(outDir: string): Promise<void> {
|
|
229
234
|
const esbuild = await import("esbuild");
|
|
230
|
-
const entryPoint =
|
|
235
|
+
const entryPoint = pathx.posixResolve(this._pkgPath, "src/electron-main.ts");
|
|
231
236
|
|
|
232
237
|
if (!(await fsx.exists(entryPoint))) {
|
|
233
238
|
throw new Error(`electron-main.ts 파일을 찾을 수 없습니다: ${entryPoint}`);
|
|
@@ -242,12 +247,12 @@ export class Electron {
|
|
|
242
247
|
|
|
243
248
|
await esbuild.build({
|
|
244
249
|
entryPoints: [entryPoint],
|
|
245
|
-
outfile:
|
|
250
|
+
outfile: pathx.posixResolve(outDir, "electron-main.js"),
|
|
246
251
|
platform: "node",
|
|
247
252
|
target: "node20",
|
|
248
253
|
format: "cjs",
|
|
249
254
|
bundle: true,
|
|
250
|
-
external: ["electron", ...builtinModules, ...reinstallDeps],
|
|
255
|
+
external: ["electron", ...builtinModules, ...reinstallDeps, ...this._exclude],
|
|
251
256
|
banner: { js: envBanner },
|
|
252
257
|
});
|
|
253
258
|
}
|
|
@@ -261,16 +266,16 @@ export class Electron {
|
|
|
261
266
|
for (const item of items) {
|
|
262
267
|
if (item === "electron") continue;
|
|
263
268
|
|
|
264
|
-
const source =
|
|
265
|
-
const dest =
|
|
269
|
+
const source = pathx.posixResolve(outPath, item);
|
|
270
|
+
const dest = pathx.posixResolve(srcPath, item);
|
|
266
271
|
await fsx.copy(source, dest);
|
|
267
272
|
}
|
|
268
273
|
}
|
|
269
274
|
|
|
270
275
|
private static _canCreateSymlink(): boolean {
|
|
271
276
|
const tmpDir = os.tmpdir();
|
|
272
|
-
const testTarget =
|
|
273
|
-
const testLink =
|
|
277
|
+
const testTarget = pathx.posixResolve(tmpDir, "sd-electron-symlink-test-target.txt");
|
|
278
|
+
const testLink = pathx.posixResolve(tmpDir, "sd-electron-symlink-test-link.txt");
|
|
274
279
|
|
|
275
280
|
try {
|
|
276
281
|
fs.writeFileSync(testTarget, "test");
|
|
@@ -291,11 +296,11 @@ export class Electron {
|
|
|
291
296
|
);
|
|
292
297
|
}
|
|
293
298
|
|
|
294
|
-
const distPath =
|
|
299
|
+
const distPath = pathx.posixResolve(this._electronPath, "dist");
|
|
295
300
|
|
|
296
301
|
const builderConfig: Record<string, unknown> = {
|
|
297
302
|
appId: this._config.appId,
|
|
298
|
-
productName: this._npmConfig.description,
|
|
303
|
+
productName: this._npmConfig.description ?? this._npmConfig.name,
|
|
299
304
|
asar: false,
|
|
300
305
|
win: {
|
|
301
306
|
target: this._config.portable === true ? "portable" : "nsis",
|
|
@@ -311,10 +316,10 @@ export class Electron {
|
|
|
311
316
|
};
|
|
312
317
|
|
|
313
318
|
if (this._config.installerIcon != null) {
|
|
314
|
-
builderConfig["icon"] =
|
|
319
|
+
builderConfig["icon"] = pathx.posixResolve(this._pkgPath, this._config.installerIcon);
|
|
315
320
|
}
|
|
316
321
|
|
|
317
|
-
const configFilePath =
|
|
322
|
+
const configFilePath = pathx.posixResolve(this._electronPath, "builder-config.json");
|
|
318
323
|
await fsx.writeJson(configFilePath, builderConfig, { space: 2 });
|
|
319
324
|
|
|
320
325
|
await this._exec(
|
|
@@ -325,16 +330,17 @@ export class Electron {
|
|
|
325
330
|
}
|
|
326
331
|
|
|
327
332
|
private async _copyBuildOutput(outPath: string): Promise<void> {
|
|
328
|
-
const distPath =
|
|
329
|
-
const electronOutPath =
|
|
333
|
+
const distPath = pathx.posixResolve(this._electronPath, "dist");
|
|
334
|
+
const electronOutPath = pathx.posixResolve(outPath, "electron");
|
|
330
335
|
await fsx.mkdir(electronOutPath);
|
|
331
336
|
|
|
332
|
-
const
|
|
337
|
+
const rawName = this._npmConfig.description ?? this._npmConfig.name;
|
|
338
|
+
const safeName = rawName.replace(/[<>:"/\\|?*]/g, "");
|
|
333
339
|
const version = this._npmConfig.version;
|
|
334
340
|
const isPortable = this._config.portable === true;
|
|
335
341
|
|
|
336
342
|
// exe 파일 동적 탐색 — Setup 또는 portable exe를 우선 선택
|
|
337
|
-
const allExeFiles = await fsx.glob("*.exe"
|
|
343
|
+
const allExeFiles = await fsx.glob(pathx.posixResolve(distPath, "*.exe"));
|
|
338
344
|
if (allExeFiles.length === 0) {
|
|
339
345
|
Electron._logger.warn(`빌드 산출물(.exe)을 찾을 수 없습니다: ${distPath}`);
|
|
340
346
|
return;
|
|
@@ -343,12 +349,12 @@ export class Electron {
|
|
|
343
349
|
const sourcePath =
|
|
344
350
|
allExeFiles.find((f) => f.toLowerCase().includes(keyword.toLowerCase())) ?? allExeFiles[0];
|
|
345
351
|
|
|
346
|
-
const latestFileName = `${
|
|
347
|
-
await fsx.copy(sourcePath,
|
|
352
|
+
const latestFileName = `${safeName}${isPortable ? "-portable" : ""}-latest.exe`;
|
|
353
|
+
await fsx.copy(sourcePath, pathx.posixResolve(electronOutPath, latestFileName));
|
|
348
354
|
|
|
349
|
-
const updatesPath =
|
|
355
|
+
const updatesPath = pathx.posixResolve(electronOutPath, "updates");
|
|
350
356
|
await fsx.mkdir(updatesPath);
|
|
351
|
-
await fsx.copy(sourcePath,
|
|
357
|
+
await fsx.copy(sourcePath, pathx.posixResolve(updatesPath, `${version}.exe`));
|
|
352
358
|
}
|
|
353
359
|
|
|
354
360
|
//#endregion
|
|
@@ -15,8 +15,7 @@ const logger = consola.withTag("sd:cli:engine");
|
|
|
15
15
|
export interface CommonBuildWorkerEvents extends Record<string, unknown> {
|
|
16
16
|
buildStart: Record<string, never>;
|
|
17
17
|
build: {
|
|
18
|
-
|
|
19
|
-
dts: { success: boolean; errors?: string[] };
|
|
18
|
+
build: { success: boolean; errors?: string[]; warnings?: string[] };
|
|
20
19
|
lint?: LintWithProgramResult;
|
|
21
20
|
};
|
|
22
21
|
error: { message: string };
|
|
@@ -132,7 +131,7 @@ export abstract class BaseEngine<
|
|
|
132
131
|
const workerKey = `${this._pkg.name}:build`;
|
|
133
132
|
|
|
134
133
|
this._worker!.on("buildStart", () => {
|
|
135
|
-
if (
|
|
134
|
+
if (this._rebuildManager != null) {
|
|
136
135
|
resolver = this._rebuildManager.registerBuild(
|
|
137
136
|
workerKey,
|
|
138
137
|
`${this._pkg.name} (${this._getTarget()})`,
|
|
@@ -143,30 +142,20 @@ export abstract class BaseEngine<
|
|
|
143
142
|
this._worker!.on("build", (data) => {
|
|
144
143
|
const event = data;
|
|
145
144
|
|
|
146
|
-
if (event.
|
|
147
|
-
logger.warn(`${this._pkg.name}: ${event.
|
|
145
|
+
if (event.build.warnings != null && event.build.warnings.length > 0) {
|
|
146
|
+
logger.warn(`${this._pkg.name}: ${event.build.warnings.join(", ")}`);
|
|
148
147
|
}
|
|
149
148
|
|
|
150
|
-
//
|
|
149
|
+
// 빌드 결과 보고
|
|
151
150
|
const buildResult: BuildResult = {
|
|
152
151
|
name: this._pkg.name,
|
|
153
152
|
target: this._getTarget(),
|
|
154
153
|
type: "build",
|
|
155
|
-
status: event.
|
|
156
|
-
message: event.
|
|
154
|
+
status: event.build.success ? "success" : "error",
|
|
155
|
+
message: event.build.errors?.join("\n"),
|
|
157
156
|
};
|
|
158
157
|
this._resultCollector?.add(buildResult);
|
|
159
158
|
|
|
160
|
-
// DTS 결과 보고
|
|
161
|
-
const dtsResult: BuildResult = {
|
|
162
|
-
name: this._pkg.name,
|
|
163
|
-
target: this._getTarget(),
|
|
164
|
-
type: "dts",
|
|
165
|
-
status: event.dts.success ? "success" : "error",
|
|
166
|
-
message: event.dts.errors?.join("\n"),
|
|
167
|
-
};
|
|
168
|
-
this._resultCollector?.add(dtsResult);
|
|
169
|
-
|
|
170
159
|
// 린트 결과 보고 (있는 경우)
|
|
171
160
|
if (event.lint != null) {
|
|
172
161
|
const lintResult: BuildResult = {
|
|
@@ -184,7 +173,7 @@ export abstract class BaseEngine<
|
|
|
184
173
|
|
|
185
174
|
if (isInitialBuild) {
|
|
186
175
|
isInitialBuild = false;
|
|
187
|
-
logger.debug(`[${this._pkg.name}] 초기 빌드 완료 (success: ${event.
|
|
176
|
+
logger.debug(`[${this._pkg.name}] 초기 빌드 완료 (success: ${event.build.success})`);
|
|
188
177
|
resolve();
|
|
189
178
|
}
|
|
190
179
|
});
|
|
@@ -3,6 +3,9 @@ import type { ResultCollector } from "../infra/ResultCollector";
|
|
|
3
3
|
import type { RebuildManager } from "../utils/rebuild-manager";
|
|
4
4
|
import type { BuildOutput, BuildPackageInfo, EngineResult } from "./types";
|
|
5
5
|
import { BaseEngine, type CommonBuildWorkerModule } from "./BaseEngine";
|
|
6
|
+
import { consola } from "consola";
|
|
7
|
+
|
|
8
|
+
const logger = consola.withTag("sd:cli:engine:ngtsc");
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* NgtscEngine options
|
|
@@ -41,6 +44,7 @@ export class NgtscEngine extends BaseEngine<
|
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
protected async _callBuild(output: BuildOutput): Promise<EngineResult> {
|
|
47
|
+
logger.debug(`[${this._pkg.name}] worker.build 호출`);
|
|
44
48
|
const result = await this._worker!.build({
|
|
45
49
|
name: this._pkg.name,
|
|
46
50
|
cwd: this._cwd,
|
|
@@ -49,23 +53,19 @@ export class NgtscEngine extends BaseEngine<
|
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
return {
|
|
52
|
-
success: result.
|
|
53
|
-
|
|
54
|
-
success: result.
|
|
55
|
-
errors: result.
|
|
56
|
-
warnings: result.
|
|
57
|
-
|
|
58
|
-
dts: {
|
|
59
|
-
success: result.dts.success,
|
|
60
|
-
errors: result.dts.errors ?? [],
|
|
61
|
-
warnings: [],
|
|
62
|
-
diagnostics: result.dts.diagnostics,
|
|
56
|
+
success: result.build.success,
|
|
57
|
+
build: {
|
|
58
|
+
success: result.build.success,
|
|
59
|
+
errors: result.build.errors ?? [],
|
|
60
|
+
warnings: result.build.warnings ?? [],
|
|
61
|
+
diagnostics: result.build.diagnostics,
|
|
63
62
|
},
|
|
64
63
|
lint: result.lint,
|
|
65
64
|
};
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
protected async _callStartWatch(output: BuildOutput): Promise<void> {
|
|
68
|
+
logger.debug(`[${this._pkg.name}] worker.startWatch 호출`);
|
|
69
69
|
await this._worker!.startWatch({
|
|
70
70
|
name: this._pkg.name,
|
|
71
71
|
cwd: this._cwd,
|
|
@@ -3,6 +3,9 @@ import type { ResultCollector } from "../infra/ResultCollector";
|
|
|
3
3
|
import type { RebuildManager } from "../utils/rebuild-manager";
|
|
4
4
|
import type { BuildOutput, EngineResult, ServerPackageInfo } from "./types";
|
|
5
5
|
import { BaseEngine, type CommonBuildWorkerModule } from "./BaseEngine";
|
|
6
|
+
import { consola } from "consola";
|
|
7
|
+
|
|
8
|
+
const logger = consola.withTag("sd:cli:engine:server");
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* ServerEsbuildEngine options
|
|
@@ -41,6 +44,7 @@ export class ServerEsbuildEngine extends BaseEngine<
|
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
protected async _callBuild(output: BuildOutput): Promise<EngineResult> {
|
|
47
|
+
logger.debug(`[${this._pkg.name}] worker.build 호출`);
|
|
44
48
|
const result = await this._worker!.build({
|
|
45
49
|
name: this._pkg.name,
|
|
46
50
|
cwd: this._cwd,
|
|
@@ -54,23 +58,19 @@ export class ServerEsbuildEngine extends BaseEngine<
|
|
|
54
58
|
});
|
|
55
59
|
|
|
56
60
|
return {
|
|
57
|
-
success: result.
|
|
58
|
-
|
|
59
|
-
success: result.
|
|
60
|
-
errors: result.
|
|
61
|
-
warnings: result.
|
|
62
|
-
|
|
63
|
-
dts: {
|
|
64
|
-
success: result.dts.success,
|
|
65
|
-
errors: result.dts.errors ?? [],
|
|
66
|
-
warnings: [],
|
|
67
|
-
diagnostics: result.dts.diagnostics,
|
|
61
|
+
success: result.build.success,
|
|
62
|
+
build: {
|
|
63
|
+
success: result.build.success,
|
|
64
|
+
errors: result.build.errors ?? [],
|
|
65
|
+
warnings: result.build.warnings ?? [],
|
|
66
|
+
diagnostics: result.build.diagnostics,
|
|
68
67
|
},
|
|
69
68
|
lint: result.lint,
|
|
70
69
|
};
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
protected async _callStartWatch(output: BuildOutput): Promise<void> {
|
|
73
|
+
logger.debug(`[${this._pkg.name}] worker.startWatch 호출`);
|
|
74
74
|
await this._worker!.startWatch({
|
|
75
75
|
name: this._pkg.name,
|
|
76
76
|
cwd: this._cwd,
|
package/src/engines/TscEngine.ts
CHANGED
|
@@ -3,6 +3,9 @@ import type { ResultCollector } from "../infra/ResultCollector";
|
|
|
3
3
|
import type { RebuildManager } from "../utils/rebuild-manager";
|
|
4
4
|
import type { BuildOutput, BuildPackageInfo, EngineResult } from "./types";
|
|
5
5
|
import { BaseEngine, type CommonBuildWorkerModule } from "./BaseEngine";
|
|
6
|
+
import { consola } from "consola";
|
|
7
|
+
|
|
8
|
+
const logger = consola.withTag("sd:cli:engine:tsc");
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* TscEngine options
|
|
@@ -41,6 +44,7 @@ export class TscEngine extends BaseEngine<
|
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
protected async _callBuild(output: BuildOutput): Promise<EngineResult> {
|
|
47
|
+
logger.debug(`[${this._pkg.name}] worker.build 호출`);
|
|
44
48
|
const result = await this._worker!.build({
|
|
45
49
|
name: this._pkg.name,
|
|
46
50
|
config: this._pkg.config,
|
|
@@ -50,23 +54,19 @@ export class TscEngine extends BaseEngine<
|
|
|
50
54
|
});
|
|
51
55
|
|
|
52
56
|
return {
|
|
53
|
-
success: result.
|
|
54
|
-
|
|
55
|
-
success: result.
|
|
56
|
-
errors: result.
|
|
57
|
-
warnings: result.
|
|
58
|
-
|
|
59
|
-
dts: {
|
|
60
|
-
success: result.dts.success,
|
|
61
|
-
errors: result.dts.errors ?? [],
|
|
62
|
-
warnings: [],
|
|
63
|
-
diagnostics: result.dts.diagnostics,
|
|
57
|
+
success: result.build.success,
|
|
58
|
+
build: {
|
|
59
|
+
success: result.build.success,
|
|
60
|
+
errors: result.build.errors ?? [],
|
|
61
|
+
warnings: result.build.warnings ?? [],
|
|
62
|
+
diagnostics: result.build.diagnostics,
|
|
64
63
|
},
|
|
65
64
|
lint: result.lint,
|
|
66
65
|
};
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
protected async _callStartWatch(output: BuildOutput): Promise<void> {
|
|
69
|
+
logger.debug(`[${this._pkg.name}] worker.startWatch 호출`);
|
|
70
70
|
await this._worker!.startWatch({
|
|
71
71
|
name: this._pkg.name,
|
|
72
72
|
config: this._pkg.config,
|
|
@@ -69,15 +69,10 @@ export class ViteEngine implements BuildEngine {
|
|
|
69
69
|
logger.debug(`[${this._pkg.name}] ViteEngine.run 완료 (success: ${result.success})`);
|
|
70
70
|
return {
|
|
71
71
|
success: result.success,
|
|
72
|
-
|
|
72
|
+
build: {
|
|
73
73
|
success: result.success,
|
|
74
74
|
errors: result.errors ?? [],
|
|
75
75
|
warnings: result.warnings ?? [],
|
|
76
|
-
},
|
|
77
|
-
dts: {
|
|
78
|
-
success: true,
|
|
79
|
-
errors: [],
|
|
80
|
-
warnings: [],
|
|
81
76
|
diagnostics: [],
|
|
82
77
|
},
|
|
83
78
|
lint: result.lint,
|
|
@@ -185,22 +180,16 @@ export class ViteEngine implements BuildEngine {
|
|
|
185
180
|
message: result.errors?.join("\n"),
|
|
186
181
|
};
|
|
187
182
|
this._resultCollector?.add(buildResult);
|
|
188
|
-
|
|
189
|
-
const dtsResult: BuildResult = {
|
|
190
|
-
name: this._pkg.name,
|
|
191
|
-
target: "client",
|
|
192
|
-
type: "dts",
|
|
193
|
-
status: "success",
|
|
194
|
-
};
|
|
195
|
-
this._resultCollector?.add(dtsResult);
|
|
196
183
|
}
|
|
197
184
|
|
|
198
185
|
/**
|
|
199
186
|
* 엔진을 중지하고 리소스를 정리한다
|
|
200
187
|
*/
|
|
201
188
|
async stop(): Promise<void> {
|
|
189
|
+
logger.debug(`[${this._pkg.name}] ViteEngine stop 시작`);
|
|
202
190
|
await stopEngineWorker(this._worker, this._isWatchMode);
|
|
203
191
|
this._worker = undefined;
|
|
192
|
+
logger.debug(`[${this._pkg.name}] ViteEngine stop 완료`);
|
|
204
193
|
}
|
|
205
194
|
|
|
206
195
|
/**
|
package/src/engines/types.ts
CHANGED
|
@@ -37,6 +37,8 @@ export interface BuildOutput {
|
|
|
37
37
|
lint?: boolean;
|
|
38
38
|
/** Typecheck environment. When set, adjusts compilerOptions via getCompilerOptionsForEnv(). */
|
|
39
39
|
env?: TypecheckEnv;
|
|
40
|
+
/** Include tests/ files in typecheck scope. Only used by check command. */
|
|
41
|
+
includeTests?: boolean;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -44,12 +46,7 @@ export interface BuildOutput {
|
|
|
44
46
|
*/
|
|
45
47
|
export interface EngineResult {
|
|
46
48
|
success: boolean;
|
|
47
|
-
|
|
48
|
-
success: boolean;
|
|
49
|
-
errors: string[];
|
|
50
|
-
warnings: string[];
|
|
51
|
-
};
|
|
52
|
-
dts: {
|
|
49
|
+
build: {
|
|
53
50
|
success: boolean;
|
|
54
51
|
errors: string[];
|
|
55
52
|
warnings: string[];
|