@simplysm/sd-cli 6.0.27 → 6.0.36

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.
Files changed (78) hide show
  1. package/dist-node/bin/sd-cli.js +19 -4
  2. package/dist-node/bin/sd-cli.js.map +1 -1
  3. package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js +98 -57
  4. package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js.map +1 -1
  5. package/dist-node/build-tools/metadata/SdAotMetadataReader.js +16 -12
  6. package/dist-node/build-tools/metadata/SdAotMetadataReader.js.map +1 -1
  7. package/dist-node/build-tools/metadata/SdIvyMetadataReader.js +23 -6
  8. package/dist-node/build-tools/metadata/SdIvyMetadataReader.js.map +1 -1
  9. package/dist-node/build-tools/metadata/SdMetadataError.js +13 -0
  10. package/dist-node/build-tools/metadata/SdMetadataError.js.map +1 -0
  11. package/dist-node/build-tools/metadata/SdMyMetadataReader.js +22 -5
  12. package/dist-node/build-tools/metadata/SdMyMetadataReader.js.map +1 -1
  13. package/dist-node/builders/SdCliNgClientBuilder.js +74 -74
  14. package/dist-node/builders/SdCliNgClientBuilder.js.map +1 -1
  15. package/dist-node/builders/SdCliNgLibraryBuilder.js +38 -34
  16. package/dist-node/builders/SdCliNgLibraryBuilder.js.map +1 -1
  17. package/dist-node/builders/SdCliServerBuilder.js +46 -45
  18. package/dist-node/builders/SdCliServerBuilder.js.map +1 -1
  19. package/dist-node/builders/SdCliTypescriptBuilder.js +65 -60
  20. package/dist-node/builders/SdCliTypescriptBuilder.js.map +1 -1
  21. package/dist-node/entry-points/SdCliLocalUpdater.js +30 -29
  22. package/dist-node/entry-points/SdCliLocalUpdater.js.map +1 -1
  23. package/dist-node/entry-points/SdCliProject.js +10 -16
  24. package/dist-node/entry-points/SdCliProject.js.map +1 -1
  25. package/dist-node/packages/SdCliClientPackage.js +6 -4
  26. package/dist-node/packages/SdCliClientPackage.js.map +1 -1
  27. package/dist-node/packages/SdCliLibraryPackage.js +5 -3
  28. package/dist-node/packages/SdCliLibraryPackage.js.map +1 -1
  29. package/dist-node/packages/SdCliServerPackage.js +4 -3
  30. package/dist-node/packages/SdCliServerPackage.js.map +1 -1
  31. package/dist-node/utils/SdProjectConfigUtil.js +1 -1
  32. package/dist-node/utils/SdProjectConfigUtil.js.map +1 -1
  33. package/dist-node/utils/SdWebpackUtil.js +33 -13
  34. package/dist-node/utils/SdWebpackUtil.js.map +1 -1
  35. package/dist-node/workers/client-ng-gen-worker.js +54 -0
  36. package/dist-node/workers/client-ng-gen-worker.js.map +1 -0
  37. package/dist-node/workers/lib-build-worker.js +7 -6
  38. package/dist-node/workers/lib-build-worker.js.map +1 -1
  39. package/dist-types/build-tools/metadata/SdIvyMetadataReader.d.ts +1 -0
  40. package/dist-types/build-tools/metadata/SdMetadataError.d.ts +6 -0
  41. package/dist-types/build-tools/metadata/SdMyMetadataReader.d.ts +1 -0
  42. package/dist-types/builders/SdCliNgClientBuilder.d.ts +6 -2
  43. package/dist-types/builders/SdCliNgLibraryBuilder.d.ts +1 -1
  44. package/dist-types/builders/SdCliServerBuilder.d.ts +2 -1
  45. package/dist-types/builders/SdCliTypescriptBuilder.d.ts +5 -5
  46. package/dist-types/commons.d.ts +4 -1
  47. package/dist-types/entry-points/SdCliLocalUpdater.d.ts +1 -1
  48. package/dist-types/entry-points/SdCliProject.d.ts +2 -0
  49. package/dist-types/packages/SdCliClientPackage.d.ts +2 -1
  50. package/dist-types/packages/SdCliLibraryPackage.d.ts +2 -1
  51. package/dist-types/packages/SdCliServerPackage.d.ts +2 -1
  52. package/dist-types/utils/SdWebpackUtil.d.ts +1 -1
  53. package/dist-types/workers/client-ng-gen-worker.d.ts +1 -0
  54. package/package.json +7 -7
  55. package/schema/schema.json +185 -122
  56. package/sd-tsconfig.node.json +2 -1
  57. package/src/bin/sd-cli.ts +19 -4
  58. package/src/build-tools/SdCliNgModuleFilesGenerator.ts +114 -70
  59. package/src/build-tools/metadata/SdAotMetadataReader.ts +8 -2
  60. package/src/build-tools/metadata/SdIvyMetadataReader.ts +27 -4
  61. package/src/build-tools/metadata/SdMetadataError.ts +7 -0
  62. package/src/build-tools/metadata/SdMyMetadataReader.ts +25 -3
  63. package/src/builders/SdCliNgClientBuilder.ts +123 -66
  64. package/src/builders/SdCliNgLibraryBuilder.ts +79 -39
  65. package/src/builders/SdCliServerBuilder.ts +61 -44
  66. package/src/builders/SdCliTypescriptBuilder.ts +92 -73
  67. package/src/commons.ts +3 -2
  68. package/src/entry-points/SdCliLocalUpdater.ts +40 -33
  69. package/src/entry-points/SdCliProject.ts +14 -13
  70. package/src/packages/SdCliClientPackage.ts +5 -3
  71. package/src/packages/SdCliLibraryPackage.ts +4 -2
  72. package/src/packages/SdCliServerPackage.ts +4 -3
  73. package/src/utils/SdCliFileCrypto.ts +1 -1
  74. package/src/utils/SdProjectConfigUtil.ts +1 -1
  75. package/src/utils/SdWebpackUtil.ts +42 -22
  76. package/src/workers/client-ng-gen-worker.ts +60 -0
  77. package/src/workers/lib-build-worker.ts +7 -6
  78. package/tsconfig.json +2 -1
@@ -13,30 +13,29 @@ import { ParserOptions } from "@typescript-eslint/types";
13
13
  export class SdCliTypescriptBuilder extends EventEmitter {
14
14
  protected readonly _logger: Logger;
15
15
 
16
- protected _parsedTsconfig: ts.ParsedCommandLine;
16
+ protected _tsconfig: ITsconfig;
17
17
  public readonly npmConfig: INpmConfig;
18
18
 
19
19
  protected _moduleResolutionCache?: ts.ModuleResolutionCache;
20
20
  protected _cacheCompilerHost?: ts.CompilerHost;
21
21
  protected _program?: ts.Program;
22
- protected _builder?: ts.BuilderProgram | ts.EmitAndSemanticDiagnosticsBuilderProgram;
22
+ protected _builder?: ts.BuilderProgram | ts.SemanticDiagnosticsBuilderProgram;
23
23
  protected readonly _fileCache = new Map<string, ITsBuildFileCache>();
24
24
 
25
25
  private readonly _indexFileGenerator?: SdCliIndexFileGenerator;
26
26
 
27
27
  private _watcher?: SdFsWatcher;
28
28
 
29
- public ignoreProcesses: string[];
29
+ public skipProcesses: string[];
30
30
 
31
31
  public constructor(public rootPath: string,
32
32
  public tsconfigFilePath: string,
33
- ignoreProcesses: ("emit" | "check" | "lint" | "genIndex")[],
33
+ skipProcesses: ("emit" | "check" | "lint" | "genIndex")[],
34
34
  public autoIndexConfig: ISdAutoIndexConfig | undefined) {
35
35
  super();
36
- this.ignoreProcesses = ignoreProcesses;
36
+ this.skipProcesses = skipProcesses;
37
37
 
38
- const tsconfig: ITsconfig = FsUtil.readJson(this.tsconfigFilePath);
39
- this._parsedTsconfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, this.rootPath);
38
+ this._tsconfig = FsUtil.readJson(this.tsconfigFilePath);
40
39
 
41
40
  this.npmConfig = FsUtil.readJson(path.resolve(this.rootPath, "package.json"));
42
41
  this._logger = Logger.get(["simplysm", "sd-cli", this.constructor.name, this.npmConfig.name]);
@@ -55,10 +54,12 @@ export class SdCliTypescriptBuilder extends EventEmitter {
55
54
  public async buildAsync(watch: boolean): Promise<void> {
56
55
  this.emit("change");
57
56
 
57
+ const parsedTsconfig = ts.parseJsonConfigFileContent(this._tsconfig, ts.sys, this.rootPath);
58
+
58
59
  // DIST 비우기
59
- await FsUtil.removeAsync(this._parsedTsconfig.options.outDir!);
60
- if (this._parsedTsconfig.options.declarationDir !== undefined) {
61
- await FsUtil.removeAsync(this._parsedTsconfig.options.declarationDir);
60
+ await FsUtil.removeAsync(parsedTsconfig.options.outDir!);
61
+ if (parsedTsconfig.options.declarationDir !== undefined) {
62
+ await FsUtil.removeAsync(parsedTsconfig.options.declarationDir);
62
63
  }
63
64
 
64
65
  // 프로그램 리로드
@@ -163,7 +164,7 @@ export class SdCliTypescriptBuilder extends EventEmitter {
163
164
 
164
165
  const result: ITsGenResult = { dirtyFilePaths: [], result: [] };
165
166
 
166
- if (!this.ignoreProcesses.includes("genIndex") && this._indexFileGenerator && this.autoIndexConfig) {
167
+ if (!this.skipProcesses.includes("genIndex") && this._indexFileGenerator && this.autoIndexConfig) {
167
168
  const generateResult = await this._indexFileGenerator.generateAsync();
168
169
  result.result.push(...generateResult.result);
169
170
  if (generateResult.changed) {
@@ -192,54 +193,58 @@ export class SdCliTypescriptBuilder extends EventEmitter {
192
193
  }
193
194
 
194
195
  protected async _lintAsync(dirtyFilePaths: string[]): Promise<ISdPackageBuildResult[]> {
195
- this._logger.debug("LINT");
196
-
197
- const linter = new ESLint({
198
- overrideConfig: {
199
- overrides: [
200
- {
201
- files: ["*.ts"],
202
- parserOptions: {
203
- program: this._program
204
- } as ParserOptions,
205
- settings: {
206
- "import/resolver": {
207
- typescript: {
208
- project: this.tsconfigFilePath
196
+ if (!this.skipProcesses.includes("lint")) {
197
+ this._logger.debug("LINT");
198
+
199
+ const linter = new ESLint({
200
+ overrideConfig: {
201
+ overrides: [
202
+ {
203
+ files: ["*.ts"],
204
+ parserOptions: {
205
+ program: this._program
206
+ } as ParserOptions,
207
+ settings: {
208
+ "import/resolver": {
209
+ typescript: {
210
+ project: this.tsconfigFilePath
211
+ }
209
212
  }
210
213
  }
211
214
  }
212
- }
213
- ]
214
- }
215
- });
216
-
217
- const filePaths = await dirtyFilePaths
218
- .filterAsync(async (item) => (
219
- !item.includes("node_modules")
220
- && PathUtil.isChildPath(item, this.rootPath)
221
- && FsUtil.exists(item)
222
- && !FsUtil.isDirectory(item)
223
- && !await linter.isPathIgnored(item)
224
- ));
225
-
226
- const lintResults = await linter.lintFiles(filePaths);
215
+ ]
216
+ }
217
+ });
227
218
 
228
- const result = lintResults.mapMany((report) => (
229
- report.messages.map((msg) => {
230
- const severity: "warning" | "error" = msg.severity === 1 ? "warning" : "error";
219
+ const filePaths = await dirtyFilePaths
220
+ .filterAsync(async (item) => (
221
+ !item.includes("node_modules")
222
+ && PathUtil.isChildPath(item, this.rootPath)
223
+ && FsUtil.exists(item)
224
+ && !FsUtil.isDirectory(item)
225
+ && !await linter.isPathIgnored(item)
226
+ ));
227
+
228
+ const lintResults = await linter.lintFiles(filePaths);
229
+
230
+ const result = lintResults.mapMany((report) => (
231
+ report.messages.map((msg) => {
232
+ const severity: "warning" | "error" = msg.severity === 1 ? "warning" : "error";
233
+
234
+ return {
235
+ filePath: report.filePath,
236
+ severity,
237
+ message: `${report.filePath}(${msg.line}, ${msg.column}): ${msg.ruleId ?? ""}: ${severity} ${msg.message}`
238
+ };
239
+ })
240
+ ));
231
241
 
232
- return {
233
- filePath: report.filePath,
234
- severity,
235
- message: `${report.filePath}(${msg.line}, ${msg.column}): ${msg.ruleId ?? ""}: ${severity} ${msg.message}`
236
- };
237
- })
238
- ));
242
+ this._logger.debug("LINT 결과", result);
239
243
 
240
- this._logger.debug("LINT 결과", result);
244
+ return result;
245
+ }
241
246
 
242
- return result;
247
+ return [];
243
248
  }
244
249
 
245
250
  /*protected _getAllDependencies(filePath: string): string[] {
@@ -257,10 +262,10 @@ export class SdCliTypescriptBuilder extends EventEmitter {
257
262
  }*/
258
263
 
259
264
  public getWatchPaths(): string[] {
260
- const builder = this._builder as ts.EmitAndSemanticDiagnosticsBuilderProgram;
265
+ // const builder = this._builder as ts.SemanticDiagnosticsBuilderProgram;
261
266
 
262
267
  const result: string[] = [];
263
- for (const sourceFile of builder.getSourceFiles()) {
268
+ for (const sourceFile of this._builder!.getSourceFiles()) {
264
269
  // result.push(sourceFile.fileName, ...this._getAllDependencies(sourceFile.fileName));
265
270
  result.push(sourceFile.fileName);
266
271
  }
@@ -295,15 +300,16 @@ export class SdCliTypescriptBuilder extends EventEmitter {
295
300
 
296
301
  const diagnostics: ts.Diagnostic[] = [];
297
302
 
298
- if (!this.ignoreProcesses.includes("check")) {
303
+ if (!this.skipProcesses.includes("check")) {
299
304
  diagnostics.push(
300
305
  ...this._builder.getOptionsDiagnostics(),
301
306
  ...this._builder.getGlobalDiagnostics()
302
307
  );
303
308
 
304
- for (const dirtyFilePath of dirtyFilePaths) {
305
- const sourceFile = this._builder.getSourceFile(dirtyFilePath);
306
- if (!sourceFile) continue;
309
+ for (const sourceFile of this._builder.getSourceFiles()) {
310
+ /*for (const dirtyFilePath of dirtyFilePaths) {
311
+ const sourceFile = this._builder.getSourceFile(dirtyFilePath);
312
+ if (!sourceFile) continue;*/
307
313
 
308
314
  if (sourceFile.isDeclarationFile) continue;
309
315
 
@@ -314,7 +320,7 @@ export class SdCliTypescriptBuilder extends EventEmitter {
314
320
  }
315
321
  }
316
322
 
317
- if (!this.ignoreProcesses.includes("emit")) {
323
+ if (!this.skipProcesses.includes("emit")) {
318
324
  for (const dirtyFilePath of dirtyFilePaths) {
319
325
  const sourceFile = this._builder.getSourceFile(dirtyFilePath);
320
326
  if (!sourceFile) continue;
@@ -347,8 +353,8 @@ export class SdCliTypescriptBuilder extends EventEmitter {
347
353
  this._reloadWatchPaths();
348
354
  }
349
355
 
350
- dirtyFilePaths.push(...changedFilePaths.filter((key) => this._fileCache.has(key)));
351
- dirtyFilePaths.distinctThis();
356
+ /*dirtyFilePaths.push(...changedFilePaths.filter((key) => this._fileCache.has(key)));
357
+ dirtyFilePaths.distinctThis();*/
352
358
 
353
359
  this._logger.debug("변경 프로그램 리로드 결과", dirtyFilePaths);
354
360
  return dirtyFilePaths;
@@ -357,12 +363,14 @@ export class SdCliTypescriptBuilder extends EventEmitter {
357
363
  public async reloadProgramAsync(watch: boolean): Promise<string[]> {
358
364
  this._logger.debug("프로그램 리로드");
359
365
 
360
- this._moduleResolutionCache = ts.createModuleResolutionCache(this.rootPath, (s) => s, this._parsedTsconfig.options);
361
- this._cacheCompilerHost = await this._createCacheCompilerHostAsync(this._parsedTsconfig, this._moduleResolutionCache);
366
+ const parsedTsconfig = ts.parseJsonConfigFileContent(this._tsconfig, ts.sys, this.rootPath);
367
+
368
+ this._moduleResolutionCache = ts.createModuleResolutionCache(this.rootPath, (s) => s, parsedTsconfig.options);
369
+ this._cacheCompilerHost = await this._createCacheCompilerHostAsync(parsedTsconfig, this._moduleResolutionCache);
362
370
 
363
371
  this._program = ts.createProgram(
364
- this._parsedTsconfig.fileNames,
365
- this._parsedTsconfig.options,
372
+ parsedTsconfig.fileNames,
373
+ parsedTsconfig.options,
366
374
  this._cacheCompilerHost,
367
375
  this._program
368
376
  );
@@ -381,12 +389,21 @@ export class SdCliTypescriptBuilder extends EventEmitter {
381
389
  };
382
390
 
383
391
  if (watch) {
384
- const builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(
385
- this._program,
386
- this._cacheCompilerHost,
387
- this._builder as ts.EmitAndSemanticDiagnosticsBuilderProgram
388
- );
389
- this._builder = builder;
392
+ if (this.skipProcesses.includes("emit")) {
393
+ this._builder = ts.createSemanticDiagnosticsBuilderProgram(
394
+ this._program,
395
+ this._cacheCompilerHost,
396
+ this._builder as ts.SemanticDiagnosticsBuilderProgram
397
+ );
398
+ }
399
+ else {
400
+ this._builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(
401
+ this._program,
402
+ this._cacheCompilerHost,
403
+ this._builder as ts.EmitAndSemanticDiagnosticsBuilderProgram
404
+ );
405
+ }
406
+ const builder = this._builder as ts.SemanticDiagnosticsBuilderProgram;
390
407
 
391
408
  const affectedFilePaths: string[] = [];
392
409
  while (true) {
@@ -417,7 +434,7 @@ export class SdCliTypescriptBuilder extends EventEmitter {
417
434
 
418
435
  // eslint-disable-next-line @typescript-eslint/require-await
419
436
  protected async _createCacheCompilerHostAsync(parsedTsconfig: ts.ParsedCommandLine, moduleResolutionCache: ts.ModuleResolutionCache): Promise<ts.CompilerHost> {
420
- const compilerHost = ts.createCompilerHost(parsedTsconfig.options);
437
+ const compilerHost = ts.createIncrementalCompilerHost(parsedTsconfig.options);
421
438
 
422
439
  const cacheCompilerHost = { ...compilerHost };
423
440
  cacheCompilerHost.fileExists = (fileName: string) => {
@@ -448,7 +465,9 @@ export class SdCliTypescriptBuilder extends EventEmitter {
448
465
  });
449
466
  }
450
467
 
451
- compilerHost.writeFile.call(cacheCompilerHost, fileName, data, writeByteOrderMark, onError, sourceFiles);
468
+ if (!FsUtil.exists(fileName) || FsUtil.readFile(fileName) !== data) {
469
+ compilerHost.writeFile.call(cacheCompilerHost, fileName, data, writeByteOrderMark, onError, sourceFiles);
470
+ }
452
471
  };
453
472
 
454
473
  cacheCompilerHost.readFile = (fileName: string) => {
package/src/commons.ts CHANGED
@@ -32,7 +32,7 @@ export interface ISdServerPackageConfig {
32
32
  externalDependencies?: string[];
33
33
  configs?: Record<string, any>;
34
34
  pm2?: Record<string, any> | boolean;
35
- iis?: boolean;
35
+ iis?: boolean | { serverExeFilePath?: string };
36
36
  publish?: TSdPublishConfig;
37
37
  }
38
38
 
@@ -73,7 +73,8 @@ export interface ITsconfig {
73
73
  strictTemplates?: boolean;
74
74
  strictInputTypes?: boolean;
75
75
  strictOutputEventTypes?: boolean;
76
- compilationMode?: "partial" | "full";
76
+ compilationMode?: "partial" | "full",
77
+ disableTypeScriptVersionCheck?: boolean
77
78
  };
78
79
  files?: string[];
79
80
  include?: string[];
@@ -1,4 +1,4 @@
1
- import { FsUtil, Logger, SdFsWatcher } from "@simplysm/sd-core-node";
1
+ import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
2
2
  import { SdProjectConfigUtil } from "../utils/SdProjectConfigUtil";
3
3
  import * as path from "path";
4
4
 
@@ -13,46 +13,53 @@ export class SdCliLocalUpdater {
13
13
  const config = await SdProjectConfigUtil.loadConfigAsync(this._rootPath, watch, undefined, opt?.config);
14
14
 
15
15
  if (config.localUpdates) {
16
- const updatePathInfos = await this._getUpdatePathsAsync(config.localUpdates);
17
- await updatePathInfos.parallelAsync(async (updatePathInfo) => {
18
- if (watch) {
19
- const watchPaths = await this._getWatchPathsAsync(updatePathInfo.source);
20
-
21
- const watcher = new SdFsWatcher();
22
- watcher
23
- .onChange(async (changedInfos) => {
24
- this._logger.log("로컬 라이브러리 변경감지...");
25
-
26
- const watchPaths2 = await this._getWatchPathsAsync(updatePathInfo.source);
27
- watcher.replaceWatchPaths(watchPaths2);
28
-
29
- const changedFilePaths = changedInfos.map((item) => item.filePath).distinct();
30
- for (const changedFilePath of changedFilePaths) {
31
- if (changedFilePath.includes("node_modules") || changedFilePath.endsWith("package.json")) {
32
- continue;
33
- }
16
+ const updatePathInfos = await this._getUpdatePathInfosAsync(config.localUpdates);
17
+
18
+ if (watch) {
19
+ const watchPaths = (await updatePathInfos.mapManyAsync(async (item) => await this._getWatchPathsAsync(item.source))).distinct();
20
+
21
+ const watcher = new SdFsWatcher();
22
+ watcher
23
+ .onChange(async (changedInfos) => {
24
+ this._logger.log("로컬 라이브러리 변경감지...");
25
+
26
+ const watchPaths2 = (await updatePathInfos.mapManyAsync(async (item) => await this._getWatchPathsAsync(item.source))).distinct();
27
+ watcher.replaceWatchPaths(watchPaths2);
28
+
29
+ const changedFilePaths = changedInfos.map((item) => item.filePath).distinct();
30
+ for (const changedFilePath of changedFilePaths) {
31
+ if (changedFilePath.includes("node_modules") || changedFilePath.endsWith("package.json")) {
32
+ continue;
33
+ }
34
34
 
35
- const targetFilePath = path.resolve(updatePathInfo.target, path.relative(updatePathInfo.source, changedFilePath));
35
+ const currentUpdatePathInfos = updatePathInfos.filter((item) => PathUtil.isChildPath(changedFilePath, item.source));
36
+ const targetFilePaths = currentUpdatePathInfos.map((item) => path.resolve(item.target, path.relative(item.source, changedFilePath)));
36
37
 
37
- if (FsUtil.exists(changedFilePath)) {
38
- this._logger.debug(`변경파일감지(복사): ${changedFilePath}`);
38
+ if (FsUtil.exists(changedFilePath)) {
39
+ this._logger.debug(`변경파일감지(복사): ${changedFilePath}`);
40
+ for (const targetFilePath of targetFilePaths) {
39
41
  await FsUtil.copyAsync(changedFilePath, targetFilePath);
40
42
  }
41
- else {
42
- this._logger.debug(`변경파일감지(삭제): ${changedFilePath}`);
43
+ }
44
+ /*else {
45
+ this._logger.debug(`변경파일감지(삭제): ${changedFilePath}`);
46
+ for (const targetFilePath of targetFilePaths) {
43
47
  await FsUtil.removeAsync(targetFilePath);
44
48
  }
45
- }
46
-
47
- this._logger.info("로컬 라이브러리 변경감지 및 복사 완료");
48
- })
49
- .watch(watchPaths);
50
- }
49
+ }*/
50
+ }
51
51
 
52
+ this._logger.info("로컬 라이브러리 변경감지 및 복사 완료");
53
+ })
54
+ .watch(watchPaths);
55
+ }
56
+ else {
52
57
  this._logger.log("로컬 라이브러리 업데이트 시작...");
53
- await this._runAsync(updatePathInfo);
58
+ for (const updatePathInfo of updatePathInfos) {
59
+ await this._runAsync(updatePathInfo);
60
+ }
54
61
  this._logger.info("로컬 라이브러리 업데이트 완료");
55
- });
62
+ }
56
63
  }
57
64
  }
58
65
 
@@ -77,7 +84,7 @@ export class SdCliLocalUpdater {
77
84
  ));
78
85
  }
79
86
 
80
- private async _getUpdatePathsAsync(record: Record<string, string>): Promise<{ source: string; target: string }[]> {
87
+ private async _getUpdatePathInfosAsync(record: Record<string, string>): Promise<{ source: string; target: string }[]> {
81
88
  return (
82
89
  await Object.keys(record).parallelAsync(async (packageGlobPath) => {
83
90
  // "node_modules'에서 로컬업데이트 설정에 맞는 패키지를 "glob"하여 대상 패키지경로 목록 가져오기
@@ -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);
@@ -86,7 +87,8 @@ export class SdCliClientPackage extends SdCliPackageBase {
86
87
  strictInputAccessModifiers: true,
87
88
  strictTemplates: true,
88
89
  strictInputTypes: false,
89
- strictOutputEventTypes: false
90
+ strictOutputEventTypes: false,
91
+ disableTypeScriptVersionCheck: true
90
92
  };
91
93
 
92
94
  const buildTsconfigFilePath = path.resolve(this.rootPath, `sd-tsconfig.json`);
@@ -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> {
@@ -105,7 +106,8 @@ export class SdCliLibraryPackage extends SdCliPackageBase {
105
106
  strictInputAccessModifiers: true,
106
107
  strictTemplates: true,
107
108
  strictInputTypes: false,
108
- strictOutputEventTypes: false
109
+ strictOutputEventTypes: false,
110
+ disableTypeScriptVersionCheck: true
109
111
  };
110
112
  }
111
113
 
@@ -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", () => {
@@ -84,4 +84,4 @@ export class SdCliFileCrypto {
84
84
  });
85
85
  });
86
86
  }
87
- }
87
+ }
@@ -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(configFilePath ?? path.resolve(rootPath, "simplysm.json"));
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";