@simplysm/sd-cli 11.0.9 → 11.0.11
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/build-cluster.js +25 -36
- package/dist/build-cluster.js.map +1 -1
- package/dist/build-tools/SdCliCordova.js +5 -5
- package/dist/build-tools/SdCliCordova.js.map +1 -1
- package/dist/build-tools/SdCliNgRoutesFileGenerator.d.ts +4 -0
- package/dist/build-tools/SdCliNgRoutesFileGenerator.js +64 -0
- package/dist/build-tools/SdCliNgRoutesFileGenerator.js.map +1 -0
- package/dist/build-tools/SdLinter.js +8 -1
- package/dist/build-tools/SdLinter.js.map +1 -1
- package/dist/build-tools/SdNgBundler.d.ts +18 -8
- package/dist/build-tools/SdNgBundler.js +286 -213
- package/dist/build-tools/SdNgBundler.js.map +1 -1
- package/dist/build-tools/SdTsBundler.d.ts +6 -5
- package/dist/build-tools/SdTsBundler.js +78 -80
- package/dist/build-tools/SdTsBundler.js.map +1 -1
- package/dist/build-tools/SdTsCompiler.d.ts +1 -0
- package/dist/build-tools/SdTsCompiler.js +5 -1
- package/dist/build-tools/SdTsCompiler.js.map +1 -1
- package/dist/builders/SdCliClientBuilder.js +51 -36
- package/dist/builders/SdCliClientBuilder.js.map +1 -1
- package/dist/builders/SdCliServerBuilder.d.ts +6 -2
- package/dist/builders/SdCliServerBuilder.js +107 -141
- package/dist/builders/SdCliServerBuilder.js.map +1 -1
- package/dist/builders/SdCliTsLibBuilder.d.ts +6 -3
- package/dist/builders/SdCliTsLibBuilder.js +42 -45
- package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
- package/dist/commons.d.ts +0 -2
- package/dist/entry/SdCliElectron.js +3 -3
- package/dist/entry/SdCliElectron.js.map +1 -1
- package/dist/entry/SdCliProject.d.ts +0 -3
- package/dist/entry/SdCliProject.js +10 -33
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/sd-cli.js +3 -21
- package/dist/sd-cli.js.map +1 -1
- package/dist/utils/SdMemoryLoadResultCache.d.ts +9 -0
- package/dist/utils/SdMemoryLoadResultCache.js +39 -0
- package/dist/utils/SdMemoryLoadResultCache.js.map +1 -0
- package/dist/utils/SdSourceFileCache.d.ts +5 -0
- package/dist/utils/SdSourceFileCache.js +9 -0
- package/dist/utils/SdSourceFileCache.js.map +1 -0
- package/package.json +17 -17
- package/src/build-cluster.ts +26 -36
- package/src/build-tools/SdCliCordova.ts +5 -5
- package/src/build-tools/SdCliNgRoutesFileGenerator.ts +80 -0
- package/src/build-tools/SdLinter.ts +12 -1
- package/src/build-tools/SdNgBundler.ts +431 -333
- package/src/build-tools/SdTsBundler.ts +86 -86
- package/src/build-tools/SdTsCompiler.ts +6 -1
- package/src/builders/SdCliClientBuilder.ts +62 -43
- package/src/builders/SdCliServerBuilder.ts +64 -63
- package/src/builders/SdCliTsLibBuilder.ts +58 -50
- package/src/commons.ts +1 -2
- package/src/entry/SdCliElectron.ts +3 -3
- package/src/entry/SdCliProject.ts +12 -41
- package/src/index.ts +3 -0
- package/src/sd-cli.ts +3 -21
- package/src/utils/SdMemoryLoadResultCache.ts +44 -0
- package/src/utils/SdSourceFileCache.ts +6 -0
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {FsUtil, Logger, SdFsWatcher} from "@simplysm/sd-core-node";
|
|
1
|
+
import {FsUtil, Logger, PathUtil, SdFsWatcher} from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {ISdCliBuilderResult} from "../commons";
|
|
3
|
+
import {ISdCliBuilderResult, ISdCliConfig, ISdCliLibPackageConfig, ISdCliPackageBuildResult} from "../commons";
|
|
4
4
|
import {EventEmitter} from "events";
|
|
5
5
|
import {SdTsCompiler} from "../build-tools/SdTsCompiler";
|
|
6
6
|
import {SdLinter} from "../build-tools/SdLinter";
|
|
7
7
|
import {FunctionQueue} from "@simplysm/sd-core-common";
|
|
8
|
+
import {SdCliIndexFileGenerator} from "../build-tools/SdCliIndexFileGenerator";
|
|
8
9
|
|
|
9
10
|
export class SdCliTsLibBuilder extends EventEmitter {
|
|
10
11
|
private readonly _logger = Logger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
private readonly _pkgConf: ISdCliLibPackageConfig;
|
|
14
|
+
private _builder?: SdTsCompiler;
|
|
15
|
+
|
|
16
|
+
public constructor(private readonly _projConf: ISdCliConfig,
|
|
17
|
+
private readonly _pkgPath: string) {
|
|
14
18
|
super();
|
|
19
|
+
this._pkgConf = this._projConf.packages[path.basename(_pkgPath)] as ISdCliLibPackageConfig;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
public override on(event: "change", listener: () => void): this;
|
|
@@ -25,72 +30,75 @@ export class SdCliTsLibBuilder extends EventEmitter {
|
|
|
25
30
|
this._debug("dist 초기화...");
|
|
26
31
|
await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
|
|
27
32
|
|
|
28
|
-
this._debug(
|
|
29
|
-
|
|
30
|
-
pkgPath: this._pkgPath,
|
|
31
|
-
emit: true,
|
|
32
|
-
emitDts: true,
|
|
33
|
-
globalStyle: true
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
this._debug(`BUILD & CHECK...`);
|
|
37
|
-
const checkResult = await builder.buildAsync();
|
|
38
|
-
|
|
39
|
-
this._debug("LINT...");
|
|
40
|
-
const lintResults = !this._withLint ? [] : await SdLinter.lintAsync(checkResult.affectedFilePaths, builder.program);
|
|
33
|
+
this._debug("GEN index.ts...");
|
|
34
|
+
await SdCliIndexFileGenerator.runAsync(this._pkgPath, this._pkgConf.polyfills);
|
|
41
35
|
|
|
42
|
-
this.
|
|
43
|
-
return {
|
|
44
|
-
affectedFilePaths: checkResult.affectedFilePaths,
|
|
45
|
-
buildResults: [...checkResult.results, ...lintResults]
|
|
46
|
-
};
|
|
36
|
+
return await this._runAsync();
|
|
47
37
|
}
|
|
48
38
|
|
|
49
39
|
public async watchAsync(): Promise<void> {
|
|
40
|
+
this.emit("change");
|
|
41
|
+
|
|
50
42
|
this._debug("dist 초기화...");
|
|
51
43
|
await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
|
|
52
44
|
|
|
53
|
-
this._debug(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
globalStyle: true
|
|
59
|
-
});
|
|
45
|
+
this._debug("WATCH GEN index.ts...");
|
|
46
|
+
await SdCliIndexFileGenerator.watchAsync(this._pkgPath, this._pkgConf.polyfills);
|
|
47
|
+
|
|
48
|
+
const result = await this._runAsync();
|
|
49
|
+
this.emit("complete", result);
|
|
60
50
|
|
|
61
51
|
this._debug("WATCH...");
|
|
62
52
|
const fnQ = new FunctionQueue();
|
|
63
53
|
const watcher = SdFsWatcher
|
|
64
|
-
.watch(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
ignoreInitial: false
|
|
68
|
-
})
|
|
69
|
-
.onChange({
|
|
70
|
-
delay: 100,
|
|
71
|
-
}, (changeInfos) => {
|
|
72
|
-
builder.markChanges(changeInfos.map((item) => item.path));
|
|
54
|
+
.watch(result.watchFilePaths)
|
|
55
|
+
.onChange({delay: 100,}, (changeInfos) => {
|
|
56
|
+
this._builder!.markChanges(changeInfos.map((item) => item.path));
|
|
73
57
|
|
|
74
58
|
fnQ.runLast(async () => {
|
|
75
59
|
this.emit("change");
|
|
76
60
|
|
|
77
|
-
this.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this._debug("LINT...");
|
|
81
|
-
const lintResults = !this._withLint ? [] : await SdLinter.lintAsync(checkResult.affectedFilePaths, builder.program);
|
|
61
|
+
const watchResult = await this._runAsync();
|
|
62
|
+
this.emit("complete", watchResult);
|
|
82
63
|
|
|
83
|
-
|
|
84
|
-
this.emit("complete", {
|
|
85
|
-
affectedFilePaths: checkResult.affectedFilePaths,
|
|
86
|
-
buildResults: [...checkResult.results, ...lintResults]
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
watcher.add(builder.program.getSourceFiles().map((item) => item.fileName).distinct());
|
|
64
|
+
watcher.add(watchResult.watchFilePaths);
|
|
90
65
|
});
|
|
91
66
|
});
|
|
92
67
|
}
|
|
93
68
|
|
|
69
|
+
private async _runAsync(): Promise<{
|
|
70
|
+
watchFilePaths: string[];
|
|
71
|
+
affectedFilePaths: string[];
|
|
72
|
+
buildResults: ISdCliPackageBuildResult[];
|
|
73
|
+
}> {
|
|
74
|
+
this._debug(`BUILD 준비...`);
|
|
75
|
+
this._builder = this._builder ?? new SdTsCompiler({
|
|
76
|
+
pkgPath: this._pkgPath,
|
|
77
|
+
emit: true,
|
|
78
|
+
emitDts: true,
|
|
79
|
+
globalStyle: true
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
this._debug(`BUILD && CHECK...`);
|
|
83
|
+
const buildAndCheckResult = await this._builder.buildAsync();
|
|
84
|
+
|
|
85
|
+
this._debug("LINT...");
|
|
86
|
+
const lintResults = await SdLinter.lintAsync(buildAndCheckResult.affectedFilePaths, this._builder.program);
|
|
87
|
+
|
|
88
|
+
this._debug(`빌드 완료`);
|
|
89
|
+
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {})
|
|
90
|
+
.mapMany((key) => FsUtil.glob(path.resolve(this._pkgPath, "../../node_modules", key)));
|
|
91
|
+
const watchFilePaths = buildAndCheckResult.filePaths.filter(item =>
|
|
92
|
+
PathUtil.isChildPath(item, path.resolve(this._pkgPath, "../")) ||
|
|
93
|
+
localUpdatePaths.some((lu) => PathUtil.isChildPath(item, lu))
|
|
94
|
+
);
|
|
95
|
+
return {
|
|
96
|
+
watchFilePaths,
|
|
97
|
+
affectedFilePaths: buildAndCheckResult.affectedFilePaths,
|
|
98
|
+
buildResults: [...buildAndCheckResult.results, ...lintResults]
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
94
102
|
private _debug(msg: string): void {
|
|
95
103
|
this._logger.debug(`[${path.basename(this._pkgPath)}] ${msg}`);
|
|
96
104
|
}
|
package/src/commons.ts
CHANGED
|
@@ -27,8 +27,7 @@ export interface ISdCliBuildClusterReqMessage {
|
|
|
27
27
|
cmd: "watch" | "build";
|
|
28
28
|
projConf: ISdCliConfig;
|
|
29
29
|
pkgPath: string;
|
|
30
|
-
builderKey?: "web" | "electron";
|
|
31
|
-
withLint: boolean;
|
|
30
|
+
// builderKey?: "web" | "electron";
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
export interface ISdCliBuildClusterResMessage {
|
|
@@ -13,7 +13,7 @@ export class SdCliElectron {
|
|
|
13
13
|
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "runAsync"]);
|
|
14
14
|
|
|
15
15
|
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
16
|
-
const electronPath = path.resolve(pkgPath, ".
|
|
16
|
+
const electronPath = path.resolve(pkgPath, ".electron/dev/src");
|
|
17
17
|
|
|
18
18
|
logger.log("설정 가져오기...");
|
|
19
19
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames) as ISdCliConfig;
|
|
@@ -62,8 +62,8 @@ export class SdCliElectron {
|
|
|
62
62
|
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "buildForDevAsync"]);
|
|
63
63
|
|
|
64
64
|
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
65
|
-
const electronPath = path.resolve(pkgPath, ".
|
|
66
|
-
const electronDistPath = path.resolve(pkgPath, ".
|
|
65
|
+
const electronPath = path.resolve(pkgPath, ".electron/dev/src");
|
|
66
|
+
const electronDistPath = path.resolve(pkgPath, ".electron/dev/dist");
|
|
67
67
|
|
|
68
68
|
logger.log("설정 가져오기...");
|
|
69
69
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames) as ISdCliConfig;
|
|
@@ -13,8 +13,7 @@ import cp from "child_process";
|
|
|
13
13
|
import {fileURLToPath, pathToFileURL} from "url";
|
|
14
14
|
import {SdCliBuildResultUtil} from "../utils/SdCliBuildResultUtil";
|
|
15
15
|
import semver from "semver";
|
|
16
|
-
import {
|
|
17
|
-
import {SdCliIndexFileGenerator} from "../build-tools/SdCliIndexFileGenerator";
|
|
16
|
+
import {NeverEntryError, StringUtil, Wait} from "@simplysm/sd-core-common";
|
|
18
17
|
import {SdStorage} from "@simplysm/sd-storage";
|
|
19
18
|
import {SdCliLocalUpdate} from "./SdCliLocalUpdate";
|
|
20
19
|
|
|
@@ -23,7 +22,6 @@ export class SdCliProject {
|
|
|
23
22
|
confFileRelPath: string;
|
|
24
23
|
optNames: string[];
|
|
25
24
|
pkgNames: string[];
|
|
26
|
-
withLint: boolean;
|
|
27
25
|
}): Promise<void> {
|
|
28
26
|
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "watchAsync"]);
|
|
29
27
|
|
|
@@ -57,14 +55,6 @@ export class SdCliProject {
|
|
|
57
55
|
throw new Error("패키지를 찾을 수 없습니다. (" + notExistsPkgs.join(", ") + ")");
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
logger.debug("라이브러리 INDEX 파일 생성...");
|
|
61
|
-
await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
62
|
-
const pkgConf = projConf.packages[path.basename(pkgPath)]!;
|
|
63
|
-
if (pkgConf.type === "library" && FsUtil.exists(path.resolve(pkgPath, "tsconfig.json"))) {
|
|
64
|
-
await SdCliIndexFileGenerator.watchAsync(pkgPath, pkgConf.polyfills);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
58
|
logger.debug("빌드 프로세스 준비...");
|
|
69
59
|
const cluster = await this._prepareClusterAsync();
|
|
70
60
|
|
|
@@ -202,11 +192,11 @@ export class SdCliProject {
|
|
|
202
192
|
if (pkgConf.type === "client") {
|
|
203
193
|
const builderKeys = Object.keys(pkgConf.builder ?? {web: {}});
|
|
204
194
|
await builderKeys.parallelAsync(async (builderKey) => {
|
|
205
|
-
await this._runCommandAsync(cluster, "watch", projConf, pkgPath,
|
|
195
|
+
await this._runCommandAsync(cluster, "watch", projConf, pkgPath, builderKey);
|
|
206
196
|
});
|
|
207
197
|
}
|
|
208
198
|
else {
|
|
209
|
-
await this._runCommandAsync(cluster, "watch", projConf, pkgPath
|
|
199
|
+
await this._runCommandAsync(cluster, "watch", projConf, pkgPath);
|
|
210
200
|
}
|
|
211
201
|
});
|
|
212
202
|
|
|
@@ -221,7 +211,6 @@ export class SdCliProject {
|
|
|
221
211
|
confFileRelPath: string;
|
|
222
212
|
optNames: string[];
|
|
223
213
|
pkgNames: string[];
|
|
224
|
-
withLint: boolean;
|
|
225
214
|
}): Promise<void> {
|
|
226
215
|
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "buildAsync"]);
|
|
227
216
|
|
|
@@ -244,14 +233,6 @@ export class SdCliProject {
|
|
|
244
233
|
logger.debug("프로젝트 및 패키지 버전 설정...");
|
|
245
234
|
await this._upgradeVersionAsync(projNpmConf, allPkgPaths);
|
|
246
235
|
|
|
247
|
-
logger.debug("라이브러리 INDEX 파일 생성...");
|
|
248
|
-
await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
249
|
-
const pkgConf = projConf.packages[path.basename(pkgPath)]!;
|
|
250
|
-
if (pkgConf.type === "library" && FsUtil.exists(path.resolve(pkgPath, "tsconfig.json"))) {
|
|
251
|
-
await SdCliIndexFileGenerator.runAsync(pkgPath, pkgConf.polyfills);
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
|
|
255
236
|
logger.debug("빌드 프로세스 준비...");
|
|
256
237
|
const cluster = await this._prepareClusterAsync();
|
|
257
238
|
|
|
@@ -262,11 +243,11 @@ export class SdCliProject {
|
|
|
262
243
|
if (pkgConf.type === "client") {
|
|
263
244
|
const builderKeys = Object.keys(pkgConf.builder ?? {web: {}});
|
|
264
245
|
return (await builderKeys.parallelAsync(async (builderKey) => {
|
|
265
|
-
return await this._runCommandAsync(cluster, "build", projConf, pkgPath,
|
|
246
|
+
return await this._runCommandAsync(cluster, "build", projConf, pkgPath, builderKey);
|
|
266
247
|
})).mapMany();
|
|
267
248
|
}
|
|
268
249
|
else {
|
|
269
|
-
return await this._runCommandAsync(cluster, "build", projConf, pkgPath
|
|
250
|
+
return await this._runCommandAsync(cluster, "build", projConf, pkgPath);
|
|
270
251
|
}
|
|
271
252
|
})
|
|
272
253
|
).mapMany();
|
|
@@ -282,7 +263,6 @@ export class SdCliProject {
|
|
|
282
263
|
confFileRelPath: string;
|
|
283
264
|
optNames: string[];
|
|
284
265
|
pkgNames: string[];
|
|
285
|
-
withLint: boolean;
|
|
286
266
|
}): Promise<void> {
|
|
287
267
|
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "publishAsync"]);
|
|
288
268
|
|
|
@@ -321,14 +301,6 @@ export class SdCliProject {
|
|
|
321
301
|
|
|
322
302
|
// 빌드
|
|
323
303
|
if (!opt.noBuild) {
|
|
324
|
-
logger.debug("라이브러리 INDEX 파일 생성...");
|
|
325
|
-
await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
326
|
-
const pkgConf = projConf.packages[path.basename(pkgPath)]!;
|
|
327
|
-
if (pkgConf.type === "library" && FsUtil.exists(path.resolve(pkgPath, "tsconfig.json"))) {
|
|
328
|
-
await SdCliIndexFileGenerator.runAsync(pkgPath, pkgConf.polyfills);
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
|
|
332
304
|
logger.debug("빌드 프로세스 준비...");
|
|
333
305
|
const cluster = await this._prepareClusterAsync();
|
|
334
306
|
|
|
@@ -339,11 +311,11 @@ export class SdCliProject {
|
|
|
339
311
|
if (pkgConf.type === "client") {
|
|
340
312
|
const builderKeys = Object.keys(pkgConf.builder ?? {web: {}});
|
|
341
313
|
return (await builderKeys.parallelAsync(async (builderKey) => {
|
|
342
|
-
return await this._runCommandAsync(cluster, "build", projConf, pkgPath,
|
|
314
|
+
return await this._runCommandAsync(cluster, "build", projConf, pkgPath, builderKey);
|
|
343
315
|
})).mapMany();
|
|
344
316
|
}
|
|
345
317
|
else {
|
|
346
|
-
return await this._runCommandAsync(cluster, "build", projConf, pkgPath
|
|
318
|
+
return await this._runCommandAsync(cluster, "build", projConf, pkgPath);
|
|
347
319
|
}
|
|
348
320
|
})
|
|
349
321
|
).mapMany();
|
|
@@ -417,7 +389,7 @@ export class SdCliProject {
|
|
|
417
389
|
await ftp.closeAsync();
|
|
418
390
|
}
|
|
419
391
|
else {
|
|
420
|
-
throw new
|
|
392
|
+
throw new NeverEntryError();
|
|
421
393
|
}
|
|
422
394
|
}
|
|
423
395
|
|
|
@@ -536,9 +508,9 @@ export class SdCliProject {
|
|
|
536
508
|
});
|
|
537
509
|
}
|
|
538
510
|
|
|
539
|
-
private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "watch", projConf: ISdCliConfig, pkgPath: string,
|
|
540
|
-
private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "build", projConf: ISdCliConfig, pkgPath: string,
|
|
541
|
-
private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "watch" | "build", projConf: ISdCliConfig, pkgPath: string,
|
|
511
|
+
private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "watch", projConf: ISdCliConfig, pkgPath: string, builderKey?: string): Promise<void>;
|
|
512
|
+
private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "build", projConf: ISdCliConfig, pkgPath: string, builderKey?: string): Promise<ISdCliPackageBuildResult[]>;
|
|
513
|
+
private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "watch" | "build", projConf: ISdCliConfig, pkgPath: string, builderKey?: string): Promise<ISdCliPackageBuildResult[] | void> {
|
|
542
514
|
return await new Promise<ISdCliPackageBuildResult[] | void>((resolve) => {
|
|
543
515
|
const cb = (message: ISdCliBuildClusterResMessage): void => {
|
|
544
516
|
if (cmd === "watch" && message.type === "ready" && message.req.cmd === cmd && message.req.pkgPath === pkgPath) {
|
|
@@ -556,8 +528,7 @@ export class SdCliProject {
|
|
|
556
528
|
cmd,
|
|
557
529
|
projConf,
|
|
558
530
|
pkgPath,
|
|
559
|
-
builderKey
|
|
560
|
-
withLint
|
|
531
|
+
builderKey
|
|
561
532
|
} as ISdCliBuildClusterReqMessage);
|
|
562
533
|
});
|
|
563
534
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./build-tools/SdCliCordova";
|
|
2
2
|
export * from "./build-tools/SdCliIndexFileGenerator";
|
|
3
|
+
export * from "./build-tools/SdCliNgRoutesFileGenerator";
|
|
3
4
|
export * from "./build-tools/SdLinter";
|
|
4
5
|
export * from "./build-tools/SdNgBundler";
|
|
5
6
|
export * from "./build-tools/SdTsBundler";
|
|
@@ -13,3 +14,5 @@ export * from "./entry/SdCliElectron";
|
|
|
13
14
|
export * from "./entry/SdCliLocalUpdate";
|
|
14
15
|
export * from "./entry/SdCliProject";
|
|
15
16
|
export * from "./utils/SdCliBuildResultUtil";
|
|
17
|
+
export * from "./utils/SdMemoryLoadResultCache";
|
|
18
|
+
export * from "./utils/SdSourceFileCache";
|
package/src/sd-cli.ts
CHANGED
|
@@ -57,11 +57,6 @@ const argv = (
|
|
|
57
57
|
string: true,
|
|
58
58
|
array: true,
|
|
59
59
|
describe: "수행할 패키지 설정"
|
|
60
|
-
},
|
|
61
|
-
withoutLint: {
|
|
62
|
-
type: "boolean",
|
|
63
|
-
default: false,
|
|
64
|
-
describe: "린트 수행 여부"
|
|
65
60
|
}
|
|
66
61
|
})
|
|
67
62
|
)
|
|
@@ -83,11 +78,6 @@ const argv = (
|
|
|
83
78
|
string: true,
|
|
84
79
|
array: true,
|
|
85
80
|
describe: "수행할 패키지 설정"
|
|
86
|
-
},
|
|
87
|
-
withoutLint: {
|
|
88
|
-
type: "boolean",
|
|
89
|
-
default: false,
|
|
90
|
-
describe: "린트 수행 여부"
|
|
91
81
|
}
|
|
92
82
|
})
|
|
93
83
|
)
|
|
@@ -114,11 +104,6 @@ const argv = (
|
|
|
114
104
|
type: "string",
|
|
115
105
|
array: true,
|
|
116
106
|
describe: "수행할 패키지 설정"
|
|
117
|
-
},
|
|
118
|
-
withoutLint: {
|
|
119
|
-
type: "boolean",
|
|
120
|
-
default: false,
|
|
121
|
-
describe: "린트 수행 여부"
|
|
122
107
|
}
|
|
123
108
|
})
|
|
124
109
|
)
|
|
@@ -212,8 +197,7 @@ else if (argv._[0] === "watch") {
|
|
|
212
197
|
.watchAsync({
|
|
213
198
|
confFileRelPath: argv.config ?? "simplysm.cjs",
|
|
214
199
|
optNames: argv.options ?? [],
|
|
215
|
-
pkgNames: argv.packages ?? []
|
|
216
|
-
withLint: argv.withoutLint !== true
|
|
200
|
+
pkgNames: argv.packages ?? []
|
|
217
201
|
});
|
|
218
202
|
}
|
|
219
203
|
else if (argv._[0] === "build") {
|
|
@@ -221,8 +205,7 @@ else if (argv._[0] === "build") {
|
|
|
221
205
|
.buildAsync({
|
|
222
206
|
confFileRelPath: argv.config ?? "simplysm.cjs",
|
|
223
207
|
optNames: argv.options ?? [],
|
|
224
|
-
pkgNames: argv.packages ?? []
|
|
225
|
-
withLint: argv.withoutLint !== true
|
|
208
|
+
pkgNames: argv.packages ?? []
|
|
226
209
|
});
|
|
227
210
|
}
|
|
228
211
|
else if (argv._[0] === "publish") {
|
|
@@ -231,8 +214,7 @@ else if (argv._[0] === "publish") {
|
|
|
231
214
|
noBuild: argv.noBuild,
|
|
232
215
|
confFileRelPath: argv.config ?? "simplysm.cjs",
|
|
233
216
|
optNames: argv.options ?? [],
|
|
234
|
-
pkgNames: argv.packages ?? []
|
|
235
|
-
withLint: argv.withoutLint !== true
|
|
217
|
+
pkgNames: argv.packages ?? []
|
|
236
218
|
});
|
|
237
219
|
}
|
|
238
220
|
else if (argv._[0] === "run-electron") {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {MemoryLoadResultCache} from "@angular-devkit/build-angular/src/tools/esbuild/load-result-cache";
|
|
2
|
+
import {OnLoadResult} from 'esbuild';
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
export class SdMemoryLoadResultCache extends MemoryLoadResultCache {
|
|
6
|
+
loadResults = new Map<string, OnLoadResult>();
|
|
7
|
+
fileDependencies = new Map<string, Set<string>>();
|
|
8
|
+
|
|
9
|
+
override get(getPath: string): OnLoadResult | undefined {
|
|
10
|
+
return this.loadResults.get(getPath);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
override put(putPath: string, result: OnLoadResult): Promise<void> {
|
|
14
|
+
this.loadResults.set(putPath, result);
|
|
15
|
+
if (result.watchFiles) {
|
|
16
|
+
for (const watchFile of result.watchFiles) {
|
|
17
|
+
// Normalize the watch file path to ensure OS consistent paths
|
|
18
|
+
const watchFilePath = path.resolve(watchFile);
|
|
19
|
+
let affected = this.fileDependencies.get(watchFilePath);
|
|
20
|
+
if (affected === undefined) {
|
|
21
|
+
affected = new Set();
|
|
22
|
+
this.fileDependencies.set(watchFilePath, affected);
|
|
23
|
+
}
|
|
24
|
+
affected.add(putPath);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return Promise.resolve();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override invalidate(invalidatePath: string): boolean {
|
|
32
|
+
const affected = this.fileDependencies.get(invalidatePath);
|
|
33
|
+
let found = false;
|
|
34
|
+
|
|
35
|
+
if (affected) {
|
|
36
|
+
affected.forEach((a) => (found ||= this.loadResults.delete(a)));
|
|
37
|
+
this.fileDependencies.delete(invalidatePath);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
found ||= this.loadResults.delete(invalidatePath);
|
|
41
|
+
|
|
42
|
+
return found;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import {SourceFileCache} from "@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin";
|
|
2
|
+
import {SdMemoryLoadResultCache} from "./SdMemoryLoadResultCache";
|
|
3
|
+
|
|
4
|
+
export class SdSourceFileCache extends SourceFileCache {
|
|
5
|
+
override readonly loadResultCache = new SdMemoryLoadResultCache();
|
|
6
|
+
}
|