@simplysm/sd-cli 6.0.26 → 6.0.30
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-node/bin/sd-cli.js +19 -4
- package/dist-node/bin/sd-cli.js.map +1 -1
- package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js +102 -49
- package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js.map +1 -1
- package/dist-node/build-tools/metadata/SdAotMetadataReader.js +6 -2
- package/dist-node/build-tools/metadata/SdAotMetadataReader.js.map +1 -1
- package/dist-node/build-tools/metadata/SdIvyMetadataReader.js +22 -5
- package/dist-node/build-tools/metadata/SdIvyMetadataReader.js.map +1 -1
- package/dist-node/build-tools/metadata/SdMetadataError.js +13 -0
- package/dist-node/build-tools/metadata/SdMetadataError.js.map +1 -0
- package/dist-node/build-tools/metadata/SdMyMetadataReader.js +22 -5
- package/dist-node/build-tools/metadata/SdMyMetadataReader.js.map +1 -1
- package/dist-node/builders/SdCliNgClientBuilder.js +73 -66
- package/dist-node/builders/SdCliNgClientBuilder.js.map +1 -1
- package/dist-node/builders/SdCliNgLibraryBuilder.js +52 -24
- package/dist-node/builders/SdCliNgLibraryBuilder.js.map +1 -1
- package/dist-node/builders/SdCliServerBuilder.js +45 -44
- package/dist-node/builders/SdCliServerBuilder.js.map +1 -1
- package/dist-node/builders/SdCliTypescriptBuilder.js +64 -59
- package/dist-node/builders/SdCliTypescriptBuilder.js.map +1 -1
- package/dist-node/entry-points/SdCliLocalUpdater.js +30 -29
- package/dist-node/entry-points/SdCliLocalUpdater.js.map +1 -1
- package/dist-node/entry-points/SdCliProject.js +10 -16
- package/dist-node/entry-points/SdCliProject.js.map +1 -1
- package/dist-node/packages/SdCliClientPackage.js +4 -3
- package/dist-node/packages/SdCliClientPackage.js.map +1 -1
- package/dist-node/packages/SdCliLibraryPackage.js +3 -2
- package/dist-node/packages/SdCliLibraryPackage.js.map +1 -1
- package/dist-node/packages/SdCliServerPackage.js +4 -3
- package/dist-node/packages/SdCliServerPackage.js.map +1 -1
- package/dist-node/utils/SdProjectConfigUtil.js +1 -1
- package/dist-node/utils/SdProjectConfigUtil.js.map +1 -1
- package/dist-node/utils/SdWebpackUtil.js +33 -13
- package/dist-node/utils/SdWebpackUtil.js.map +1 -1
- package/dist-node/workers/client-ng-gen-worker.js +54 -0
- package/dist-node/workers/client-ng-gen-worker.js.map +1 -0
- package/dist-node/workers/lib-build-worker.js +7 -6
- package/dist-node/workers/lib-build-worker.js.map +1 -1
- package/dist-types/build-tools/metadata/SdIvyMetadataReader.d.ts +1 -0
- package/dist-types/build-tools/metadata/SdMetadataError.d.ts +6 -0
- package/dist-types/build-tools/metadata/SdMyMetadataReader.d.ts +1 -0
- package/dist-types/builders/SdCliNgClientBuilder.d.ts +6 -2
- package/dist-types/builders/SdCliNgLibraryBuilder.d.ts +3 -1
- package/dist-types/builders/SdCliServerBuilder.d.ts +2 -1
- package/dist-types/builders/SdCliTypescriptBuilder.d.ts +5 -5
- package/dist-types/commons.d.ts +3 -1
- package/dist-types/entry-points/SdCliLocalUpdater.d.ts +1 -1
- package/dist-types/entry-points/SdCliProject.d.ts +2 -0
- package/dist-types/packages/SdCliClientPackage.d.ts +2 -1
- package/dist-types/packages/SdCliLibraryPackage.d.ts +2 -1
- package/dist-types/packages/SdCliServerPackage.d.ts +2 -1
- package/dist-types/utils/SdWebpackUtil.d.ts +1 -1
- package/dist-types/workers/client-ng-gen-worker.d.ts +1 -0
- package/package.json +7 -7
- package/schema/schema.json +185 -122
- package/sd-tsconfig.node.json +2 -1
- package/src/bin/sd-cli.ts +19 -4
- package/src/build-tools/SdCliNgModuleFilesGenerator.ts +118 -60
- package/src/build-tools/metadata/SdAotMetadataReader.ts +8 -2
- package/src/build-tools/metadata/SdIvyMetadataReader.ts +27 -4
- package/src/build-tools/metadata/SdMetadataError.ts +7 -0
- package/src/build-tools/metadata/SdMyMetadataReader.ts +25 -3
- package/src/builders/SdCliNgClientBuilder.ts +122 -58
- package/src/builders/SdCliNgLibraryBuilder.ts +102 -43
- package/src/builders/SdCliServerBuilder.ts +61 -44
- package/src/builders/SdCliTypescriptBuilder.ts +92 -73
- package/src/commons.ts +1 -1
- package/src/entry-points/SdCliLocalUpdater.ts +40 -33
- package/src/entry-points/SdCliProject.ts +14 -13
- package/src/packages/SdCliClientPackage.ts +3 -2
- package/src/packages/SdCliLibraryPackage.ts +2 -1
- package/src/packages/SdCliServerPackage.ts +4 -3
- package/src/utils/SdCliFileCrypto.ts +1 -1
- package/src/utils/SdProjectConfigUtil.ts +1 -1
- package/src/utils/SdWebpackUtil.ts +42 -22
- package/src/workers/client-ng-gen-worker.ts +60 -0
- package/src/workers/lib-build-worker.ts +7 -6
- package/tsconfig.json +2 -1
|
@@ -34,7 +34,7 @@ export class SdCliProject {
|
|
|
34
34
|
this.npmConfig = FsUtil.readJson(this.npmConfigFilePath);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
public async buildAsync(opt: { watch?: boolean; packages?: string[]; options?: string[]; config?: string }): Promise<void> {
|
|
37
|
+
public async buildAsync(opt: { watch?: boolean; packages?: string[]; options?: string[]; config?: string; skipProcesses?: string[]; localUpdate?: boolean }): Promise<void> {
|
|
38
38
|
this._logger.debug("프로젝트 설정 가져오기...");
|
|
39
39
|
const config = await SdProjectConfigUtil.loadConfigAsync(
|
|
40
40
|
this._rootPath,
|
|
@@ -43,13 +43,13 @@ export class SdCliProject {
|
|
|
43
43
|
opt.config
|
|
44
44
|
);
|
|
45
45
|
|
|
46
|
-
if (opt.watch && config.localUpdates) {
|
|
46
|
+
if (opt.watch && opt.localUpdate && config.localUpdates) {
|
|
47
47
|
this._logger.debug("로컬 라이브러리 업데이트 변경감지 시작...");
|
|
48
48
|
await new SdCliLocalUpdater(this._rootPath).localUpdateAsync(true, opt);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
this._logger.debug("프로젝트 패키지 목록 구성...");
|
|
52
|
-
const allPkgs = await this._getAllPackagesAsync(config, opt.packages);
|
|
52
|
+
const allPkgs = await this._getAllPackagesAsync(config, opt.packages, opt.skipProcesses ?? [], !opt.localUpdate);
|
|
53
53
|
const pkgs = allPkgs.filter((item) => !(item instanceof SdCliUnknownPackage)) as TSdCliBuildablePackage[];
|
|
54
54
|
|
|
55
55
|
this._logger.debug("프로젝트 및 패키지 버전 설정...");
|
|
@@ -174,7 +174,7 @@ export class SdCliProject {
|
|
|
174
174
|
);
|
|
175
175
|
|
|
176
176
|
this._logger.debug("프로젝트 패키지 목록 구성...");
|
|
177
|
-
const allPkgs = await this._getAllPackagesAsync(config, opt.packages);
|
|
177
|
+
const allPkgs = await this._getAllPackagesAsync(config, opt.packages, [], false);
|
|
178
178
|
const pkgs = allPkgs.filter((item) => !(item instanceof SdCliUnknownPackage) && item.config.publish) as TSdCliBuildablePackage[];
|
|
179
179
|
|
|
180
180
|
// 빌드가 필요하면 빌드함
|
|
@@ -239,7 +239,7 @@ export class SdCliProject {
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
private async _getAllPackagesAsync(config: ISdProjectConfig, packages: string[] | undefined): Promise<TSdCliPackage[]> {
|
|
242
|
+
private async _getAllPackagesAsync(config: ISdProjectConfig, packages: string[] | undefined, skipProcesses: string[], useCache: boolean): Promise<TSdCliPackage[]> {
|
|
243
243
|
// package.json에서 workspaces를 통해 패키지 경로 목록 가져오기
|
|
244
244
|
const allPkgPaths = await this.npmConfig.workspaces?.mapManyAsync(async (item) => await FsUtil.globAsync(item));
|
|
245
245
|
if (!allPkgPaths) {
|
|
@@ -268,32 +268,33 @@ export class SdCliProject {
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
// 각 package를 위한 worker 준비
|
|
271
|
-
const workerCount = allPackageInfos.sum((item) => {
|
|
271
|
+
/*const workerCount = allPackageInfos.sum((item) => {
|
|
272
272
|
if (item.config && item.config.type === "library") {
|
|
273
273
|
return item.config.targets?.length ?? 1;
|
|
274
274
|
}
|
|
275
275
|
return 0;
|
|
276
|
-
})
|
|
276
|
+
});*/
|
|
277
277
|
|
|
278
278
|
const processWorkManager = await SdProcessWorkManager.createAsync(
|
|
279
279
|
path.resolve(__dirname, `../workers/lib-build-worker`),
|
|
280
280
|
[],
|
|
281
|
+
this._logger/*,
|
|
281
282
|
Math.min(workerCount, Math.max(os.cpus().length - 2, 1)),
|
|
282
|
-
Math.max(os.cpus().length - 2, 1)
|
|
283
|
+
Math.max(os.cpus().length - 2, 1)*/
|
|
283
284
|
);
|
|
284
285
|
|
|
285
286
|
// 패키지 목록 구성
|
|
286
287
|
const pkgs: TSdCliPackage[] = [];
|
|
287
288
|
for (const pkgInfo of allPackageInfos) {
|
|
288
289
|
if (pkgInfo.config?.type === "library") {
|
|
289
|
-
pkgs.push(new SdCliLibraryPackage(pkgInfo.rootPath, pkgInfo.config, processWorkManager));
|
|
290
|
+
pkgs.push(new SdCliLibraryPackage(pkgInfo.rootPath, pkgInfo.config, skipProcesses as any, processWorkManager));
|
|
290
291
|
}
|
|
291
292
|
else if (pkgInfo.config?.type === "client") {
|
|
292
293
|
const serverPkgInfo = allPackageInfos.single((item) => item.name === (pkgInfo.config as ISdClientPackageConfig).server);
|
|
293
|
-
pkgs.push(new SdCliClientPackage(pkgInfo.rootPath, pkgInfo.config, serverPkgInfo?.rootPath));
|
|
294
|
+
pkgs.push(new SdCliClientPackage(pkgInfo.rootPath, pkgInfo.config, useCache, serverPkgInfo?.rootPath));
|
|
294
295
|
}
|
|
295
296
|
else if (pkgInfo.config?.type === "server") {
|
|
296
|
-
pkgs.push(new SdCliServerPackage(pkgInfo.rootPath, pkgInfo.config));
|
|
297
|
+
pkgs.push(new SdCliServerPackage(pkgInfo.rootPath, pkgInfo.config, useCache));
|
|
297
298
|
}
|
|
298
299
|
else {
|
|
299
300
|
pkgs.push(new SdCliUnknownPackage(pkgInfo.rootPath));
|
|
@@ -322,12 +323,12 @@ export class SdCliProject {
|
|
|
322
323
|
|
|
323
324
|
const warnings = totalResults
|
|
324
325
|
.filter((item) => item.severity === "warning")
|
|
325
|
-
.map((item) => item.message.trim() + "(" + item.pkgName + ")")
|
|
326
|
+
.map((item) => item.message.trim() + " (" + item.pkgName + ")")
|
|
326
327
|
.distinct();
|
|
327
328
|
|
|
328
329
|
const errors = totalResults
|
|
329
330
|
.filter((item) => item.severity === "error")
|
|
330
|
-
.map((item) => item.message.trim() + "(" + item.pkgName + ")")
|
|
331
|
+
.map((item) => item.message.trim() + " (" + item.pkgName + ")")
|
|
331
332
|
.distinct();
|
|
332
333
|
|
|
333
334
|
if (warnings.length > 0) {
|
|
@@ -16,6 +16,7 @@ export class SdCliClientPackage extends SdCliPackageBase {
|
|
|
16
16
|
|
|
17
17
|
public constructor(public readonly rootPath: string,
|
|
18
18
|
public readonly config: ISdClientPackageConfig,
|
|
19
|
+
public readonly useCache: boolean,
|
|
19
20
|
public readonly _serverPath?: string) {
|
|
20
21
|
super(rootPath);
|
|
21
22
|
}
|
|
@@ -24,7 +25,7 @@ export class SdCliClientPackage extends SdCliPackageBase {
|
|
|
24
25
|
await this._genBuildTsconfigAsync();
|
|
25
26
|
|
|
26
27
|
const buildTsconfigFilePath = path.resolve(this.rootPath, `sd-tsconfig.json`);
|
|
27
|
-
const builder = new SdCliNgClientBuilder(this.rootPath, buildTsconfigFilePath, process.cwd(), this.config);
|
|
28
|
+
const builder = new SdCliNgClientBuilder(this.rootPath, buildTsconfigFilePath, process.cwd(), this.config, this.useCache);
|
|
28
29
|
|
|
29
30
|
await builder
|
|
30
31
|
.on("change", () => {
|
|
@@ -40,7 +41,7 @@ export class SdCliClientPackage extends SdCliPackageBase {
|
|
|
40
41
|
await this._genBuildTsconfigAsync();
|
|
41
42
|
|
|
42
43
|
const buildTsconfigFilePath = path.resolve(this.rootPath, `sd-tsconfig.json`);
|
|
43
|
-
const builder = new SdCliNgClientBuilder(this.rootPath, buildTsconfigFilePath, process.cwd(), this.config);
|
|
44
|
+
const builder = new SdCliNgClientBuilder(this.rootPath, buildTsconfigFilePath, process.cwd(), this.config, this.useCache);
|
|
44
45
|
return await builder
|
|
45
46
|
.on("change", () => {
|
|
46
47
|
this.emit("change", undefined);
|
|
@@ -15,6 +15,7 @@ export class SdCliLibraryPackage extends SdCliPackageBase {
|
|
|
15
15
|
|
|
16
16
|
public constructor(public readonly rootPath: string,
|
|
17
17
|
public readonly config: ISdLibraryPackageConfig,
|
|
18
|
+
private readonly _skipProcesses: ("emit" | "check" | "lint" | "genIndex")[],
|
|
18
19
|
private readonly _processWorkManager: SdProcessWorkManager) {
|
|
19
20
|
super(rootPath);
|
|
20
21
|
this._logger = Logger.get(["simplysm", "sd-cli", this.constructor.name, this.npmConfig.name]);
|
|
@@ -66,7 +67,7 @@ export class SdCliLibraryPackage extends SdCliPackageBase {
|
|
|
66
67
|
.on("complete", (results) => {
|
|
67
68
|
this.emit("complete", target, results);
|
|
68
69
|
})
|
|
69
|
-
.sendAsync(this.rootPath, target, watch, autoIndexConfig);
|
|
70
|
+
.sendAsync(this.rootPath, target, watch, this._skipProcesses, autoIndexConfig);
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
private async _genBuildTsconfigAsync(): Promise<void> {
|
|
@@ -15,7 +15,8 @@ export class SdCliServerPackage extends SdCliPackageBase {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
public constructor(public readonly rootPath: string,
|
|
18
|
-
public readonly config: ISdServerPackageConfig
|
|
18
|
+
public readonly config: ISdServerPackageConfig,
|
|
19
|
+
public readonly useCache: boolean) {
|
|
19
20
|
super(rootPath);
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -23,7 +24,7 @@ export class SdCliServerPackage extends SdCliPackageBase {
|
|
|
23
24
|
await this._genBuildTsconfigAsync();
|
|
24
25
|
|
|
25
26
|
const buildTsconfigFilePath = path.resolve(this.rootPath, `sd-tsconfig.json`);
|
|
26
|
-
const builder = new SdCliServerBuilder(this.rootPath, buildTsconfigFilePath, process.cwd(), this.config);
|
|
27
|
+
const builder = new SdCliServerBuilder(this.rootPath, buildTsconfigFilePath, process.cwd(), this.config, this.useCache);
|
|
27
28
|
|
|
28
29
|
await builder
|
|
29
30
|
.on("change", () => {
|
|
@@ -50,7 +51,7 @@ export class SdCliServerPackage extends SdCliPackageBase {
|
|
|
50
51
|
await this._genBuildTsconfigAsync();
|
|
51
52
|
|
|
52
53
|
const buildTsconfigFilePath = path.resolve(this.rootPath, `sd-tsconfig.json`);
|
|
53
|
-
const builder = new SdCliServerBuilder(this.rootPath, buildTsconfigFilePath, process.cwd(), this.config);
|
|
54
|
+
const builder = new SdCliServerBuilder(this.rootPath, buildTsconfigFilePath, process.cwd(), this.config, this.useCache);
|
|
54
55
|
|
|
55
56
|
await builder
|
|
56
57
|
.on("change", () => {
|
|
@@ -5,7 +5,7 @@ import { ObjectUtil } from "@simplysm/sd-core-common";
|
|
|
5
5
|
|
|
6
6
|
export class SdProjectConfigUtil {
|
|
7
7
|
public static async loadConfigAsync(rootPath: string, isDevMode?: boolean, options?: string[], configFilePath?: string): Promise<ISdProjectConfig> {
|
|
8
|
-
const config = await this._loadConfigFileContentAsync(
|
|
8
|
+
const config = await this._loadConfigFileContentAsync(path.resolve(rootPath, configFilePath ?? "simplysm.json"));
|
|
9
9
|
|
|
10
10
|
if (config.packages !== undefined) {
|
|
11
11
|
const mode = isDevMode ? "development" : "production";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ISdPackageBuildResult } from "../commons";
|
|
2
2
|
import * as webpack from "webpack";
|
|
3
|
-
import {
|
|
3
|
+
import { NeverEntryError } from "@simplysm/sd-core-common";
|
|
4
4
|
|
|
5
5
|
export class SdWebpackUtil {
|
|
6
6
|
public static getWebpackResults(stats: Error | webpack.Stats): ISdPackageBuildResult[] {
|
|
@@ -14,37 +14,57 @@ export class SdWebpackUtil {
|
|
|
14
14
|
|
|
15
15
|
const results: ISdPackageBuildResult[] = [];
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
for (const warn of stats.compilation.warnings) {
|
|
18
|
+
if (stats.compilation.options.ignoreWarnings?.some((ignoreWarning) => ignoreWarning(warn, stats.compilation))) continue;
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
message: this._statErrorToMessage(statWarning)
|
|
25
|
-
}))
|
|
26
|
-
);
|
|
20
|
+
results.push({
|
|
21
|
+
filePath: undefined,
|
|
22
|
+
severity: "warning",
|
|
23
|
+
message: this._errorToMessage(warn)
|
|
24
|
+
});
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
results.push(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}))
|
|
36
|
-
);
|
|
27
|
+
for (const err of stats.compilation.errors) {
|
|
28
|
+
results.push({
|
|
29
|
+
filePath: undefined,
|
|
30
|
+
severity: "error",
|
|
31
|
+
message: this._errorToMessage(err)
|
|
32
|
+
});
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
return results;
|
|
40
36
|
}
|
|
41
37
|
|
|
42
|
-
private static
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
private static _errorToMessage(err: Partial<webpack.WebpackError>): string {
|
|
39
|
+
let result = "";
|
|
40
|
+
|
|
41
|
+
if ("error" in err && "originalSassError" in err["error"]) {
|
|
42
|
+
const sassError = err["error"]["originalSassError"];
|
|
43
|
+
result += sassError.file.replace(/^\.\//, "");
|
|
44
|
+
// result += `(${sassError.line as number}${sassError.column !== undefined ? `, ${sassError.column as number}` : ""})`;
|
|
45
|
+
result += ": ";
|
|
46
|
+
result += err.name + ": ";
|
|
47
|
+
result += err.message;
|
|
45
48
|
}
|
|
46
49
|
else {
|
|
47
|
-
|
|
50
|
+
if (err.file !== undefined) {
|
|
51
|
+
result += err.file.replace(/^\.\//, "");
|
|
52
|
+
if (err.loc !== undefined) {
|
|
53
|
+
if ("start" in err.loc) {
|
|
54
|
+
result += `(${err.loc.start.line}${err.loc.start.column !== undefined ? `, ${err.loc.start.column}` : ""})`;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
throw new NeverEntryError();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
result += ": ";
|
|
61
|
+
|
|
62
|
+
result += err.name + ": ";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
result += err.message;
|
|
48
66
|
}
|
|
67
|
+
|
|
68
|
+
return result;
|
|
49
69
|
}
|
|
50
70
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
|
+
import { Logger, LoggerSeverity, SdProcessChildWorker } from "@simplysm/sd-core-node";
|
|
3
|
+
import { SdCliNgLibraryBuilder } from "../builders/SdCliNgLibraryBuilder";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
|
|
6
|
+
EventEmitter.defaultMaxListeners = 0;
|
|
7
|
+
process.setMaxListeners(0);
|
|
8
|
+
|
|
9
|
+
const logger = Logger.get(["simplysm", "sd-cli", "ng-gen-worker"]);
|
|
10
|
+
|
|
11
|
+
if (process.env.SD_CLI_LOGGER_SEVERITY === "DEBUG") {
|
|
12
|
+
Error.stackTraceLimit = 100; //Infinity;
|
|
13
|
+
|
|
14
|
+
Logger.setConfig(["simplysm", "sd-cli"], {
|
|
15
|
+
console: {
|
|
16
|
+
level: LoggerSeverity.debug
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
Logger.setConfig(["simplysm", "sd-cli"], {
|
|
22
|
+
dot: true
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
let ngGenerator: SdCliNgLibraryBuilder | undefined;
|
|
29
|
+
SdProcessChildWorker.defineWorker(async (worker, args) => {
|
|
30
|
+
const rootPath = args[0] as string;
|
|
31
|
+
const watch = args[1] as boolean;
|
|
32
|
+
const changedFilePaths = args[2] as string[] | undefined;
|
|
33
|
+
|
|
34
|
+
const tsconfigFilePath = path.resolve(rootPath, `sd-tsconfig.json`);
|
|
35
|
+
|
|
36
|
+
if (!ngGenerator || !changedFilePaths) {
|
|
37
|
+
ngGenerator = new SdCliNgLibraryBuilder(rootPath, tsconfigFilePath, ["emit", "check", "lint", "genIndex"], undefined);
|
|
38
|
+
const genDirtyFilePaths = await ngGenerator.reloadProgramAsync(watch);
|
|
39
|
+
const genResult = await ngGenerator.generateAdditionalFilesAsync(genDirtyFilePaths, watch);
|
|
40
|
+
worker.send("complete", {
|
|
41
|
+
dirtyFilePaths: [...genDirtyFilePaths, ...genResult.dirtyFilePaths],
|
|
42
|
+
result: genResult.result
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const genDirtyFilePaths = await ngGenerator.reloadChangedProgramAsync(changedFilePaths, watch);
|
|
47
|
+
if (genDirtyFilePaths.length === 0) {
|
|
48
|
+
worker.send("complete", { dirtyFilePaths: [], result: [] });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const genResult = await ngGenerator.generateAdditionalFilesAsync(genDirtyFilePaths.distinct(), watch);
|
|
53
|
+
worker.send("complete", { dirtyFilePaths: genResult.dirtyFilePaths, result: genResult.result });
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
logger.error(err);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
@@ -14,14 +14,14 @@ const logger = Logger.get(["simplysm", "sd-cli", "lib-build-worker"]);
|
|
|
14
14
|
if (process.env.SD_CLI_LOGGER_SEVERITY === "DEBUG") {
|
|
15
15
|
Error.stackTraceLimit = 100; //Infinity;
|
|
16
16
|
|
|
17
|
-
Logger.setConfig({
|
|
17
|
+
Logger.setConfig(["simplysm", "sd-cli"], {
|
|
18
18
|
console: {
|
|
19
19
|
level: LoggerSeverity.debug
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
Logger.setConfig({
|
|
24
|
+
Logger.setConfig(["simplysm", "sd-cli"], {
|
|
25
25
|
dot: true
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -32,13 +32,14 @@ try {
|
|
|
32
32
|
const rootPath = args[0] as string;
|
|
33
33
|
const target = args[1] as "node" | "browser" | "angular" | undefined;
|
|
34
34
|
const watch = args[2] as boolean;
|
|
35
|
+
const skipProcesses = args[3] as ("emit" | "check" | "lint" | "genIndex")[];
|
|
35
36
|
|
|
36
37
|
if (target === undefined) {
|
|
37
38
|
// 1. output를 내놓지 않는 Typescript 라이브러리(types)인 경우, typecheck와 lint만 수행
|
|
38
39
|
if (FsUtil.exists(path.resolve(rootPath, `tsconfig.json`))) {
|
|
39
40
|
const tsconfigFilePath = path.resolve(rootPath, `tsconfig.json`);
|
|
40
41
|
|
|
41
|
-
const builder = new SdCliTypescriptBuilder(rootPath, tsconfigFilePath, ["emit", "genIndex"], undefined);
|
|
42
|
+
const builder = new SdCliTypescriptBuilder(rootPath, tsconfigFilePath, skipProcesses.concat(["emit", "genIndex"]).distinct(), undefined);
|
|
42
43
|
await builder
|
|
43
44
|
.on("change", () => {
|
|
44
45
|
worker.send("change");
|
|
@@ -62,11 +63,11 @@ try {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
else {
|
|
65
|
-
const autoIndexConfig = args[
|
|
66
|
+
const autoIndexConfig = args[4] as ISdAutoIndexConfig | undefined;
|
|
66
67
|
const tsconfigFilePath = path.resolve(rootPath, `sd-tsconfig.${target}.json`);
|
|
67
68
|
|
|
68
69
|
if (target !== "angular") {
|
|
69
|
-
const builder = new SdCliTypescriptBuilder(rootPath, tsconfigFilePath,
|
|
70
|
+
const builder = new SdCliTypescriptBuilder(rootPath, tsconfigFilePath, skipProcesses, autoIndexConfig);
|
|
70
71
|
await builder
|
|
71
72
|
.on("change", () => {
|
|
72
73
|
worker.send("change");
|
|
@@ -77,7 +78,7 @@ try {
|
|
|
77
78
|
.buildAsync(watch);
|
|
78
79
|
}
|
|
79
80
|
else {
|
|
80
|
-
const builder = new SdCliNgLibraryBuilder(rootPath, tsconfigFilePath,
|
|
81
|
+
const builder = new SdCliNgLibraryBuilder(rootPath, tsconfigFilePath, skipProcesses, autoIndexConfig);
|
|
81
82
|
await builder
|
|
82
83
|
.on("change", () => {
|
|
83
84
|
worker.send("change");
|