@simplysm/sd-cli 11.0.8 → 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.
Files changed (64) hide show
  1. package/dist/build-cluster.js +25 -36
  2. package/dist/build-cluster.js.map +1 -1
  3. package/dist/build-tools/SdCliCordova.d.ts +21 -0
  4. package/dist/build-tools/SdCliCordova.js +182 -0
  5. package/dist/build-tools/SdCliCordova.js.map +1 -0
  6. package/dist/build-tools/SdCliNgRoutesFileGenerator.d.ts +4 -0
  7. package/dist/build-tools/SdCliNgRoutesFileGenerator.js +64 -0
  8. package/dist/build-tools/SdCliNgRoutesFileGenerator.js.map +1 -0
  9. package/dist/build-tools/SdLinter.js +8 -1
  10. package/dist/build-tools/SdLinter.js.map +1 -1
  11. package/dist/build-tools/SdNgBundler.d.ts +16 -5
  12. package/dist/build-tools/SdNgBundler.js +280 -179
  13. package/dist/build-tools/SdNgBundler.js.map +1 -1
  14. package/dist/build-tools/SdTsBundler.d.ts +6 -5
  15. package/dist/build-tools/SdTsBundler.js +78 -80
  16. package/dist/build-tools/SdTsBundler.js.map +1 -1
  17. package/dist/build-tools/SdTsCompiler.d.ts +1 -0
  18. package/dist/build-tools/SdTsCompiler.js +5 -1
  19. package/dist/build-tools/SdTsCompiler.js.map +1 -1
  20. package/dist/builders/SdCliClientBuilder.d.ts +1 -0
  21. package/dist/builders/SdCliClientBuilder.js +62 -27
  22. package/dist/builders/SdCliClientBuilder.js.map +1 -1
  23. package/dist/builders/SdCliServerBuilder.d.ts +6 -2
  24. package/dist/builders/SdCliServerBuilder.js +107 -141
  25. package/dist/builders/SdCliServerBuilder.js.map +1 -1
  26. package/dist/builders/SdCliTsLibBuilder.d.ts +6 -3
  27. package/dist/builders/SdCliTsLibBuilder.js +42 -45
  28. package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
  29. package/dist/commons.d.ts +22 -2
  30. package/dist/entry/SdCliElectron.js +3 -3
  31. package/dist/entry/SdCliElectron.js.map +1 -1
  32. package/dist/entry/SdCliProject.d.ts +0 -3
  33. package/dist/entry/SdCliProject.js +10 -33
  34. package/dist/entry/SdCliProject.js.map +1 -1
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.js +4 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/sd-cli.js +27 -21
  39. package/dist/sd-cli.js.map +1 -1
  40. package/dist/utils/SdMemoryLoadResultCache.d.ts +9 -0
  41. package/dist/utils/SdMemoryLoadResultCache.js +39 -0
  42. package/dist/utils/SdMemoryLoadResultCache.js.map +1 -0
  43. package/dist/utils/SdSourceFileCache.d.ts +5 -0
  44. package/dist/utils/SdSourceFileCache.js +9 -0
  45. package/dist/utils/SdSourceFileCache.js.map +1 -0
  46. package/lib/cordova-entry.js +22 -0
  47. package/package.json +19 -16
  48. package/src/build-cluster.ts +26 -36
  49. package/src/build-tools/SdCliCordova.ts +240 -0
  50. package/src/build-tools/SdCliNgRoutesFileGenerator.ts +80 -0
  51. package/src/build-tools/SdLinter.ts +12 -1
  52. package/src/build-tools/SdNgBundler.ts +428 -288
  53. package/src/build-tools/SdTsBundler.ts +86 -86
  54. package/src/build-tools/SdTsCompiler.ts +6 -1
  55. package/src/builders/SdCliClientBuilder.ts +76 -34
  56. package/src/builders/SdCliServerBuilder.ts +64 -63
  57. package/src/builders/SdCliTsLibBuilder.ts +58 -50
  58. package/src/commons.ts +24 -2
  59. package/src/entry/SdCliElectron.ts +3 -3
  60. package/src/entry/SdCliProject.ts +12 -41
  61. package/src/index.ts +4 -0
  62. package/src/sd-cli.ts +31 -21
  63. package/src/utils/SdMemoryLoadResultCache.ts +44 -0
  64. 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
- public constructor(private readonly _pkgPath: string,
13
- private readonly _withLint: boolean) {
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(`BUILD 준비...`);
29
- const builder = new SdTsCompiler({
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._debug(`빌드 완료`);
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(`BUILD 준비...`);
54
- const builder = new SdTsCompiler({
55
- pkgPath: this._pkgPath,
56
- emit: true,
57
- emitDts: true,
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
- path.resolve(this._pkgPath, "src/**/*.*")
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._debug(`CHECK & BUILD...`);
78
- const checkResult = await builder.buildAsync();
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
- this._debug(`빌드 완료`);
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 {
@@ -94,6 +93,7 @@ export interface ISdCliClientPackageConfig {
94
93
  builder?: {
95
94
  web?: ISdCliClientBuilderWebConfig;
96
95
  electron?: ISdCliClientBuilderElectronConfig;
96
+ cordova?: ISdCliClientBuilderCordovaConfig;
97
97
  }
98
98
  }
99
99
 
@@ -126,3 +126,25 @@ export interface ISdCliClientBuilderWebConfig {
126
126
  devServerPort?: number;
127
127
  env?: Record<string, string>;
128
128
  }
129
+
130
+ export interface ISdCliClientBuilderCordovaConfig {
131
+ appId: string;
132
+ appName: string;
133
+ plugins?: string[];
134
+ icon?: string;
135
+ debug?: boolean;
136
+ platform?: {
137
+ browser?: {};
138
+ android?: {
139
+ bundle?: boolean;
140
+ sign?: {
141
+ keystore: string;
142
+ storePassword: string;
143
+ alias: string;
144
+ password: string;
145
+ keystoreType: string;
146
+ };
147
+ }
148
+ }
149
+ env?: Record<string, string>;
150
+ }
@@ -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, ".cache/dev/electron/src");
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, ".cache/dev/electron/src");
66
- const electronDistPath = path.resolve(pkgPath, ".cache/dev/electron/dist");
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 {NotImplementError, StringUtil, Wait} from "@simplysm/sd-core-common";
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, opt.withLint, builderKey);
195
+ await this._runCommandAsync(cluster, "watch", projConf, pkgPath, builderKey);
206
196
  });
207
197
  }
208
198
  else {
209
- await this._runCommandAsync(cluster, "watch", projConf, pkgPath, opt.withLint);
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, opt.withLint, builderKey);
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, opt.withLint);
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, opt.withLint, builderKey);
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, opt.withLint);
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 NotImplementError();
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, withLint: boolean, builderKey?: string): Promise<void>;
540
- private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "build", projConf: ISdCliConfig, pkgPath: string, withLint: boolean, builderKey?: string): Promise<ISdCliPackageBuildResult[]>;
541
- private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "watch" | "build", projConf: ISdCliConfig, pkgPath: string, withLint: boolean, builderKey?: string): Promise<ISdCliPackageBuildResult[] | void> {
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,4 +1,6 @@
1
+ export * from "./build-tools/SdCliCordova";
1
2
  export * from "./build-tools/SdCliIndexFileGenerator";
3
+ export * from "./build-tools/SdCliNgRoutesFileGenerator";
2
4
  export * from "./build-tools/SdLinter";
3
5
  export * from "./build-tools/SdNgBundler";
4
6
  export * from "./build-tools/SdTsBundler";
@@ -12,3 +14,5 @@ export * from "./entry/SdCliElectron";
12
14
  export * from "./entry/SdCliLocalUpdate";
13
15
  export * from "./entry/SdCliProject";
14
16
  export * from "./utils/SdCliBuildResultUtil";
17
+ export * from "./utils/SdMemoryLoadResultCache";
18
+ export * from "./utils/SdSourceFileCache";
package/src/sd-cli.ts CHANGED
@@ -7,6 +7,7 @@ import {Logger, LoggerSeverity} from "@simplysm/sd-core-node";
7
7
  import {EventEmitter} from "events";
8
8
  import {SdCliElectron} from "./entry/SdCliElectron";
9
9
  import {SdCliLocalUpdate} from "./entry/SdCliLocalUpdate";
10
+ import {SdCliCordova} from "./build-tools/SdCliCordova";
10
11
 
11
12
  Error.stackTraceLimit = Infinity;
12
13
  EventEmitter.defaultMaxListeners = 0;
@@ -56,11 +57,6 @@ const argv = (
56
57
  string: true,
57
58
  array: true,
58
59
  describe: "수행할 패키지 설정"
59
- },
60
- withoutLint: {
61
- type: "boolean",
62
- default: false,
63
- describe: "린트 수행 여부"
64
60
  }
65
61
  })
66
62
  )
@@ -82,11 +78,6 @@ const argv = (
82
78
  string: true,
83
79
  array: true,
84
80
  describe: "수행할 패키지 설정"
85
- },
86
- withoutLint: {
87
- type: "boolean",
88
- default: false,
89
- describe: "린트 수행 여부"
90
81
  }
91
82
  })
92
83
  )
@@ -113,11 +104,6 @@ const argv = (
113
104
  type: "string",
114
105
  array: true,
115
106
  describe: "수행할 패키지 설정"
116
- },
117
- withoutLint: {
118
- type: "boolean",
119
- default: false,
120
- describe: "린트 수행 여부"
121
107
  }
122
108
  })
123
109
  )
@@ -163,6 +149,26 @@ const argv = (
163
149
  }
164
150
  })
165
151
  )
152
+ .command(
153
+ "run-cordova <platform> <package> <url>",
154
+ "변경감지중인 플랫폼을 코도바 디바이스에 앱 형태로 띄웁니다.",
155
+ (cmd) => cmd
156
+ .positional("platform", {
157
+ type: "string",
158
+ describe: "빌드 플랫폼(android,...)",
159
+ demandOption: true
160
+ })
161
+ .positional("package", {
162
+ type: "string",
163
+ describe: "패키지명",
164
+ demandOption: true
165
+ })
166
+ .positional("url", {
167
+ type: "string",
168
+ describe: "Webview로 오픈할 URL",
169
+ demandOption: true
170
+ })
171
+ )
166
172
  .parseAsync()
167
173
  ) as any;
168
174
 
@@ -191,8 +197,7 @@ else if (argv._[0] === "watch") {
191
197
  .watchAsync({
192
198
  confFileRelPath: argv.config ?? "simplysm.cjs",
193
199
  optNames: argv.options ?? [],
194
- pkgNames: argv.packages ?? [],
195
- withLint: argv.withoutLint !== true
200
+ pkgNames: argv.packages ?? []
196
201
  });
197
202
  }
198
203
  else if (argv._[0] === "build") {
@@ -200,8 +205,7 @@ else if (argv._[0] === "build") {
200
205
  .buildAsync({
201
206
  confFileRelPath: argv.config ?? "simplysm.cjs",
202
207
  optNames: argv.options ?? [],
203
- pkgNames: argv.packages ?? [],
204
- withLint: argv.withoutLint !== true
208
+ pkgNames: argv.packages ?? []
205
209
  });
206
210
  }
207
211
  else if (argv._[0] === "publish") {
@@ -210,8 +214,7 @@ else if (argv._[0] === "publish") {
210
214
  noBuild: argv.noBuild,
211
215
  confFileRelPath: argv.config ?? "simplysm.cjs",
212
216
  optNames: argv.options ?? [],
213
- pkgNames: argv.packages ?? [],
214
- withLint: argv.withoutLint !== true
217
+ pkgNames: argv.packages ?? []
215
218
  });
216
219
  }
217
220
  else if (argv._[0] === "run-electron") {
@@ -230,6 +233,13 @@ else if (argv._[0] === "build-electron-for-dev") {
230
233
  pkgName: argv.package
231
234
  });
232
235
  }
236
+ else if (argv._[0] === "run-cordova") {
237
+ await SdCliCordova.runWebviewOnDeviceAsync({
238
+ platform: argv.platform,
239
+ pkgName: argv.package,
240
+ url: argv.url
241
+ });
242
+ }
233
243
  else {
234
244
  throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
235
245
  }
@@ -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
+ }