@simplysm/sd-cli 12.13.36 → 12.13.38
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/entry/SdCliLocalUpdate.js +12 -12
- package/dist/entry/SdCliLocalUpdate.js.map +1 -1
- package/dist/entry/SdCliProject.js +3 -3
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/pkg-builders/SdBuildRunnerBase.d.ts +14 -0
- package/dist/pkg-builders/SdBuildRunnerBase.js +23 -0
- package/dist/pkg-builders/SdBuildRunnerBase.js.map +1 -0
- package/dist/pkg-builders/SdProjectBuildRunner.js +19 -15
- package/dist/pkg-builders/SdProjectBuildRunner.js.map +1 -1
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.d.ts +1 -1
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js +5 -4
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +1 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.js +17 -36
- package/dist/pkg-builders/client/SdClientBuildRunner.js.map +1 -1
- package/dist/pkg-builders/client/SdNgBundler.d.ts +10 -16
- package/dist/pkg-builders/client/SdNgBundler.js +59 -54
- package/dist/pkg-builders/client/SdNgBundler.js.map +1 -1
- package/dist/pkg-builders/client/createSdNgPlugin.d.ts +2 -11
- package/dist/pkg-builders/client/createSdNgPlugin.js +16 -25
- package/dist/pkg-builders/client/createSdNgPlugin.js.map +1 -1
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.d.ts +1 -1
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.js +4 -3
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.js.map +1 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.d.ts +1 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js +5 -4
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +1 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +5 -5
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +1 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +6 -6
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +1 -1
- package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +3 -3
- package/dist/pkg-builders/lib/SdTsLibBuilder.js +6 -15
- package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +1 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.js +25 -42
- package/dist/pkg-builders/server/SdServerBuildRunner.js.map +1 -1
- package/dist/pkg-builders/server/SdServerBundler.d.ts +4 -10
- package/dist/pkg-builders/server/SdServerBundler.js +15 -22
- package/dist/pkg-builders/server/SdServerBundler.js.map +1 -1
- package/dist/pkg-builders/server/createSdServerPlugin.d.ts +2 -11
- package/dist/pkg-builders/server/createSdServerPlugin.js +10 -19
- package/dist/pkg-builders/server/createSdServerPlugin.js.map +1 -1
- package/dist/sd-cli-entry.js +1 -1
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/ts-compiler/ScopePathSet.js.map +1 -0
- package/dist/ts-compiler/SdDepAnalyzer.d.ts +1 -1
- package/dist/ts-compiler/SdStyleBundler.d.ts +8 -5
- package/dist/ts-compiler/SdStyleBundler.js +30 -15
- package/dist/ts-compiler/SdStyleBundler.js.map +1 -1
- package/dist/ts-compiler/SdTsCompiler.d.ts +2 -1
- package/dist/ts-compiler/SdTsCompiler.js +73 -53
- package/dist/ts-compiler/SdTsCompiler.js.map +1 -1
- package/dist/types/build/ISdTsCompilerOptions.d.ts +6 -9
- package/dist/types/worker/ISdBuildRunnerWorkerType.d.ts +4 -7
- package/dist/workers/build-runner.worker.js +4 -5
- package/dist/workers/build-runner.worker.js.map +1 -1
- package/package.json +5 -5
- package/src/entry/SdCliLocalUpdate.ts +12 -12
- package/src/entry/SdCliProject.ts +3 -3
- package/src/pkg-builders/SdBuildRunnerBase.ts +36 -0
- package/src/pkg-builders/SdProjectBuildRunner.ts +26 -17
- package/src/pkg-builders/client/SdCliNgRoutesFileGenerator.ts +5 -4
- package/src/pkg-builders/client/SdClientBuildRunner.ts +28 -46
- package/src/pkg-builders/client/SdNgBundler.ts +69 -73
- package/src/pkg-builders/client/createSdNgPlugin.ts +21 -35
- package/src/pkg-builders/lib/SdCliDbContextFileGenerator.ts +4 -3
- package/src/pkg-builders/lib/SdCliIndexFileGenerator.ts +5 -4
- package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +5 -5
- package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +12 -13
- package/src/pkg-builders/lib/SdTsLibBuilder.ts +7 -23
- package/src/pkg-builders/server/SdServerBuildRunner.ts +32 -50
- package/src/pkg-builders/server/SdServerBundler.ts +16 -32
- package/src/pkg-builders/server/createSdServerPlugin.ts +15 -29
- package/src/sd-cli-entry.ts +1 -1
- package/src/ts-compiler/SdDepAnalyzer.ts +1 -1
- package/src/ts-compiler/SdStyleBundler.ts +34 -15
- package/src/ts-compiler/SdTsCompiler.ts +80 -63
- package/src/types/build/ISdTsCompilerOptions.ts +6 -9
- package/src/types/worker/ISdBuildRunnerWorkerType.ts +4 -9
- package/src/workers/build-runner.worker.ts +7 -16
- package/dist/fix/convert-extends-sd-modal-base-to-interface.d.ts +0 -1
- package/dist/fix/convert-extends-sd-modal-base-to-interface.js +0 -289
- package/dist/fix/convert-extends-sd-modal-base-to-interface.js.map +0 -1
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.d.ts +0 -1
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.js +0 -179
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.js.map +0 -1
- package/dist/fix/convert-flat-pages-to-flat-menus.d.ts +0 -1
- package/dist/fix/convert-flat-pages-to-flat-menus.js +0 -68
- package/dist/fix/convert-flat-pages-to-flat-menus.js.map +0 -1
- package/dist/fix/convert-get-menus-to-usable-menus.d.ts +0 -1
- package/dist/fix/convert-get-menus-to-usable-menus.js +0 -48
- package/dist/fix/convert-get-menus-to-usable-menus.js.map +0 -1
- package/dist/fix/convert-modal-show-params.d.ts +0 -1
- package/dist/fix/convert-modal-show-params.js +0 -29
- package/dist/fix/convert-modal-show-params.js.map +0 -1
- package/dist/fix/convert-print-params.d.ts +0 -1
- package/dist/fix/convert-print-params.js +0 -37
- package/dist/fix/convert-print-params.js.map +0 -1
- package/dist/fix/convert-sd-icon-to-fa-icon.d.ts +0 -1
- package/dist/fix/convert-sd-icon-to-fa-icon.js +0 -80
- package/dist/fix/convert-sd-icon-to-fa-icon.js.map +0 -1
- package/dist/fix/convert-sd-sheet-bindings-safety.d.ts +0 -1
- package/dist/fix/convert-sd-sheet-bindings-safety.js +0 -57
- package/dist/fix/convert-sd-sheet-bindings-safety.js.map +0 -1
- package/dist/fix/convert-select-modal-button-to-select-button.d.ts +0 -1
- package/dist/fix/convert-select-modal-button-to-select-button.js +0 -64
- package/dist/fix/convert-select-modal-button-to-select-button.js.map +0 -1
- package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.d.ts +0 -1
- package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js +0 -38
- package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js.map +0 -1
- package/dist/fix/convert-to-use-perms-signal.d.ts +0 -1
- package/dist/fix/convert-to-use-perms-signal.js +0 -99
- package/dist/fix/convert-to-use-perms-signal.js.map +0 -1
- package/dist/fix/core/remove-named-import.d.ts +0 -1
- package/dist/fix/core/remove-named-import.js +0 -14
- package/dist/fix/core/remove-named-import.js.map +0 -1
- package/dist/pkg-builders/commons/ScopePathSet.js.map +0 -1
- package/dist/pkg-builders/commons/SdBuildRunnerBase.d.ts +0 -20
- package/dist/pkg-builders/commons/SdBuildRunnerBase.js +0 -30
- package/dist/pkg-builders/commons/SdBuildRunnerBase.js.map +0 -1
- package/src/fix/convert-extends-sd-modal-base-to-interface.ts +0 -324
- package/src/fix/convert-extends-sd-print-template-base-to-interface.ts +0 -201
- package/src/fix/convert-flat-pages-to-flat-menus.ts +0 -83
- package/src/fix/convert-get-menus-to-usable-menus.ts +0 -60
- package/src/fix/convert-modal-show-params.ts +0 -37
- package/src/fix/convert-print-params.ts +0 -51
- package/src/fix/convert-sd-icon-to-fa-icon.ts +0 -95
- package/src/fix/convert-sd-sheet-bindings-safety.ts +0 -73
- package/src/fix/convert-select-modal-button-to-select-button.ts +0 -91
- package/src/fix/convert-setup-cumulate-selected-keys-to-object-param.ts +0 -44
- package/src/fix/convert-to-use-perms-signal.ts +0 -133
- package/src/fix/core/remove-named-import.ts +0 -14
- package/src/pkg-builders/commons/SdBuildRunnerBase.ts +0 -47
- /package/dist/{pkg-builders/commons → ts-compiler}/ScopePathSet.d.ts +0 -0
- /package/dist/{pkg-builders/commons → ts-compiler}/ScopePathSet.js +0 -0
- /package/src/{pkg-builders/commons → ts-compiler}/ScopePathSet.ts +0 -0
|
@@ -22,15 +22,14 @@ else {
|
|
|
22
22
|
let buildRunner;
|
|
23
23
|
createSdWorker({
|
|
24
24
|
initialize(req) {
|
|
25
|
-
const
|
|
26
|
-
const buildRunnerType = pkgConf.type === "server"
|
|
25
|
+
const buildRunnerType = req.pkgConf.type === "server"
|
|
27
26
|
? SdServerBuildRunner
|
|
28
|
-
: pkgConf.type === "client"
|
|
27
|
+
: req.pkgConf.type === "client"
|
|
29
28
|
? SdClientBuildRunner
|
|
30
|
-
: FsUtils.exists(path.resolve(req.pkgPath, "tsconfig.json"))
|
|
29
|
+
: FsUtils.exists(path.resolve(req.options.pkgPath, "tsconfig.json"))
|
|
31
30
|
? SdTsLibBuildRunner
|
|
32
31
|
: SdJsLibBuildRunner;
|
|
33
|
-
buildRunner = new buildRunnerType(req.
|
|
32
|
+
buildRunner = new buildRunnerType(req.options, req.pkgConf);
|
|
34
33
|
},
|
|
35
34
|
async rebuild(modifiedFileSet) {
|
|
36
35
|
return await buildRunner.rebuildAsync(modifiedFileSet);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-runner.worker.js","sourceRoot":"","sources":["../../src/workers/build-runner.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,OAAO,EACP,QAAQ,EACR,gBAAgB,GAEjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"build-runner.worker.js","sourceRoot":"","sources":["../../src/workers/build-runner.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,OAAO,EACP,QAAQ,EACR,gBAAgB,GAEjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAG5E,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;AACjC,YAAY,CAAC,mBAAmB,GAAG,CAAC,CAAC;AAErC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;IACpC,QAAQ,CAAC,SAAS,CAAC;QACjB,OAAO,EAAE;YACP,KAAK,EAAE,gBAAgB,CAAC,KAAK;SAC9B;KACF,CAAC,CAAC;AACL,CAAC;KAAM,CAAC;IACN,QAAQ,CAAC,SAAS,CAAC;QACjB,GAAG,EAAE,IAAI;KACV,CAAC,CAAC;AACL,CAAC;AAED,IAAI,WAAmC,CAAC;AAExC,cAAc,CAA2B;IACvC,UAAU,CAAC,GAAoC;QAC7C,MAAM,eAAe,GACnB,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ;YAC3B,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ;gBAC7B,CAAC,CAAC,mBAAmB;gBACrB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;oBAClE,CAAC,CAAC,kBAAkB;oBACpB,CAAC,CAAC,kBAAkB,CAAC;QAE7B,WAAW,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,eAAgC;QAC5C,OAAO,MAAM,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACzD,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/sd-cli",
|
|
3
|
-
"version": "12.13.
|
|
3
|
+
"version": "12.13.38",
|
|
4
4
|
"description": "심플리즘 패키지 - CLI",
|
|
5
5
|
"author": "김석래",
|
|
6
6
|
"repository": {
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"@angular/compiler-cli": "^20.2.4",
|
|
18
18
|
"@anthropic-ai/sdk": "^0.61.0",
|
|
19
19
|
"@electron/rebuild": "^4.0.1",
|
|
20
|
-
"@simplysm/sd-core-common": "12.13.
|
|
21
|
-
"@simplysm/sd-core-node": "12.13.
|
|
22
|
-
"@simplysm/sd-service-server": "12.13.
|
|
23
|
-
"@simplysm/sd-storage": "12.13.
|
|
20
|
+
"@simplysm/sd-core-common": "12.13.38",
|
|
21
|
+
"@simplysm/sd-core-node": "12.13.38",
|
|
22
|
+
"@simplysm/sd-service-server": "12.13.38",
|
|
23
|
+
"@simplysm/sd-storage": "12.13.38",
|
|
24
24
|
"browserslist": "^4.25.4",
|
|
25
25
|
"cordova": "^12.0.0",
|
|
26
26
|
"electron": "^38.0.0",
|
|
@@ -14,17 +14,17 @@ export class SdCliLocalUpdate {
|
|
|
14
14
|
logger.debug("로컬 업데이트 구성");
|
|
15
15
|
|
|
16
16
|
logger.log("로컬 라이브러리 업데이트 시작...");
|
|
17
|
-
|
|
17
|
+
await updatePathInfos.parallelAsync(async (updatePathInfo) => {
|
|
18
18
|
if (!FsUtils.exists(updatePathInfo.source)) {
|
|
19
19
|
logger.warn(`소스경로를 찾을 수 없어 무시됩니다(${updatePathInfo.source})`);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
// 소스경로에서 대상경로로 파일 복사
|
|
24
|
-
FsUtils.
|
|
24
|
+
await FsUtils.copyAsync(updatePathInfo.source, updatePathInfo.target, (src) => {
|
|
25
25
|
return !src.includes("node_modules") && !src.endsWith("package.json");
|
|
26
26
|
});
|
|
27
|
-
}
|
|
27
|
+
});
|
|
28
28
|
logger.info("로컬 라이브러리 업데이트 완료");
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -38,8 +38,8 @@ export class SdCliLocalUpdate {
|
|
|
38
38
|
const updatePathInfos = this.#getUpdatePathInfos(projConf.localUpdates);
|
|
39
39
|
logger.debug("로컬 업데이트 구성");
|
|
40
40
|
|
|
41
|
-
const watcher = SdFsWatcher.
|
|
42
|
-
watcher.onChange({ delay:
|
|
41
|
+
const watcher = await SdFsWatcher.watchAsync(updatePathInfos.map((item) => item.source));
|
|
42
|
+
watcher.onChange({ delay: 300 }, async (changedInfos) => {
|
|
43
43
|
const changedFileInfos = changedInfos.filter((item) =>
|
|
44
44
|
["add", "change", "unlink"].includes(item.event),
|
|
45
45
|
);
|
|
@@ -47,22 +47,22 @@ export class SdCliLocalUpdate {
|
|
|
47
47
|
|
|
48
48
|
logger.log("로컬 라이브러리 변경감지...");
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (!PathUtils.isChildPath(changedFileInfo.path, updatePathInfo.source))
|
|
50
|
+
await changedFileInfos.parallelAsync(async (changedFileInfo) => {
|
|
51
|
+
await updatePathInfos.parallelAsync(async (updatePathInfo) => {
|
|
52
|
+
if (!PathUtils.isChildPath(changedFileInfo.path, updatePathInfo.source)) return;
|
|
53
53
|
|
|
54
54
|
const sourceRelPath = path.relative(updatePathInfo.source, changedFileInfo.path);
|
|
55
55
|
const targetFilePath = path.resolve(updatePathInfo.target, sourceRelPath);
|
|
56
56
|
|
|
57
57
|
if (changedFileInfo.event === "unlink") {
|
|
58
58
|
logger.debug(`변경파일감지(삭제): ${targetFilePath}`);
|
|
59
|
-
FsUtils.
|
|
59
|
+
await FsUtils.removeAsync(targetFilePath);
|
|
60
60
|
} else {
|
|
61
61
|
logger.debug(`변경파일감지(복사): ${changedFileInfo.path} => ${targetFilePath}`);
|
|
62
|
-
FsUtils.
|
|
62
|
+
await FsUtils.copyAsync(changedFileInfo.path, targetFilePath);
|
|
63
63
|
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
66
|
|
|
67
67
|
logger.info("로컬 라이브러리 복사 완료");
|
|
68
68
|
});
|
|
@@ -273,11 +273,11 @@ export class SdCliProject {
|
|
|
273
273
|
nodir: true,
|
|
274
274
|
});
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
await filePaths.parallelAsync(async (filePath) => {
|
|
277
277
|
const relativeFilePath = path.relative(path.resolve(pkgPath, "dist"), filePath);
|
|
278
278
|
const targetPath = PathUtils.posix(targetRootPath, relativeFilePath);
|
|
279
|
-
FsUtils.
|
|
280
|
-
}
|
|
279
|
+
await FsUtils.copyAsync(filePath, targetPath);
|
|
280
|
+
});
|
|
281
281
|
} else if (
|
|
282
282
|
pkgPubConf?.type === "ftp" ||
|
|
283
283
|
pkgPubConf?.type === "ftps" ||
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FsUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { TSdPackageConfig } from "../types/config/ISdProjectConfig";
|
|
4
|
+
import { ISdBuildResult } from "../types/build/ISdBuildResult";
|
|
5
|
+
import { ISdTsCompilerOptions } from "../types/build/ISdTsCompilerOptions";
|
|
6
|
+
|
|
7
|
+
export abstract class SdBuildRunnerBase<T extends "server" | "library" | "client"> {
|
|
8
|
+
protected abstract _logger: SdLogger;
|
|
9
|
+
|
|
10
|
+
protected _pkgName: string;
|
|
11
|
+
|
|
12
|
+
constructor(
|
|
13
|
+
protected _opt: ISdTsCompilerOptions,
|
|
14
|
+
protected _pkgConf: TSdPackageConfig<T>,
|
|
15
|
+
) {
|
|
16
|
+
this._pkgName = path.basename(_opt.pkgPath);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async rebuildAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
20
|
+
if (!modifiedFileSet && !this._opt.watch?.noEmit) {
|
|
21
|
+
const distPath = path.resolve(this._opt.pkgPath, "dist");
|
|
22
|
+
if (FsUtils.exists(distPath)) {
|
|
23
|
+
this._debug("dist 초기화...");
|
|
24
|
+
FsUtils.remove(distPath);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return await this._runAsync(modifiedFileSet);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected abstract _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult>;
|
|
32
|
+
|
|
33
|
+
protected _debug(msg: string): void {
|
|
34
|
+
this._logger.debug(`[${path.basename(this._opt.pkgPath)}] ${msg}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -54,19 +54,24 @@ export class SdProjectBuildRunner {
|
|
|
54
54
|
Object.keys(opt.projConf.localUpdates ?? {}),
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
const watcher = SdFsWatcher.
|
|
57
|
+
const watcher = await SdFsWatcher.watchAsync(Array.from(scopePathSet), {
|
|
58
58
|
ignoreInitial: false,
|
|
59
59
|
});
|
|
60
60
|
watcher.onChange({ delay: 300 }, async (changeInfos) => {
|
|
61
61
|
// 변경된 패키지 정보 구성
|
|
62
62
|
const changeFiles = changeInfos.map((item) => PathUtils.norm(item.path));
|
|
63
|
+
|
|
63
64
|
const changedPkgInfos = opt.pkgPaths
|
|
64
65
|
.map((pkgPath) => {
|
|
65
66
|
let buildInfo = this.#buildInfoMap.get(pkgPath);
|
|
66
67
|
if (!buildInfo) return { pkgPath };
|
|
67
68
|
|
|
68
69
|
const modifiedFileSet = new Set(
|
|
69
|
-
changeFiles.filter(
|
|
70
|
+
changeFiles.filter(
|
|
71
|
+
(item) =>
|
|
72
|
+
buildInfo.watchFileSet.has(item) ||
|
|
73
|
+
PathUtils.isChildPath(item, path.resolve(pkgPath, "src")),
|
|
74
|
+
),
|
|
70
75
|
);
|
|
71
76
|
|
|
72
77
|
if (modifiedFileSet.size < 1) return;
|
|
@@ -81,18 +86,23 @@ export class SdProjectBuildRunner {
|
|
|
81
86
|
const buildResults = await changedPkgInfos.parallelAsync(async (changedPkgInfo) => {
|
|
82
87
|
// 처음
|
|
83
88
|
if (!changedPkgInfo.buildInfo) {
|
|
89
|
+
const pkgConf = opt.projConf.packages[path.basename(changedPkgInfo.pkgPath)]!;
|
|
90
|
+
|
|
84
91
|
const buildWorker = new SdWorker<ISdBuildRunnerWorkerType>(
|
|
85
92
|
import.meta.resolve("../workers/build-runner.worker"),
|
|
86
93
|
);
|
|
87
94
|
await buildWorker.run("initialize", [
|
|
88
95
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
options: {
|
|
97
|
+
pkgPath: changedPkgInfo.pkgPath,
|
|
98
|
+
scopePathSet,
|
|
99
|
+
watch: {
|
|
100
|
+
dev: !pkgConf.forceProductionMode,
|
|
101
|
+
emitOnly: opt.emitOnly,
|
|
102
|
+
noEmit: opt.noEmit,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
pkgConf,
|
|
96
106
|
},
|
|
97
107
|
]);
|
|
98
108
|
|
|
@@ -279,15 +289,16 @@ export class SdProjectBuildRunner {
|
|
|
279
289
|
);
|
|
280
290
|
|
|
281
291
|
const buildResults = await opt.pkgPaths.parallelAsync(async (pkgPath) => {
|
|
292
|
+
const pkgConf = opt.projConf.packages[path.basename(pkgPath)]!;
|
|
293
|
+
|
|
282
294
|
const worker = new SdWorker<ISdBuildRunnerWorkerType>(
|
|
283
295
|
import.meta.resolve("../workers/build-runner.worker"),
|
|
284
296
|
);
|
|
285
297
|
|
|
286
298
|
await worker.run("initialize", [
|
|
287
299
|
{
|
|
288
|
-
pkgPath,
|
|
289
|
-
|
|
290
|
-
scopePathSet: scopePathSet,
|
|
300
|
+
options: { pkgPath, scopePathSet },
|
|
301
|
+
pkgConf,
|
|
291
302
|
},
|
|
292
303
|
]);
|
|
293
304
|
|
|
@@ -306,15 +317,13 @@ export class SdProjectBuildRunner {
|
|
|
306
317
|
path.resolve(item, "src"),
|
|
307
318
|
path.resolve(item, "public"),
|
|
308
319
|
path.resolve(item, "public-dev"),
|
|
320
|
+
path.resolve(item, "scss"),
|
|
309
321
|
]);
|
|
310
322
|
const localUpdatePaths = (
|
|
311
323
|
await localUpdateGlobs.mapManyAsync(
|
|
312
|
-
async (
|
|
324
|
+
async (glob) => await FsUtils.globAsync(path.resolve(process.cwd(), "node_modules", glob)),
|
|
313
325
|
)
|
|
314
|
-
).mapMany((
|
|
315
|
-
path.resolve(process.cwd(), "node_modules", key, "dist"),
|
|
316
|
-
path.resolve(process.cwd(), "node_modules", key, "src/**/*.scss"),
|
|
317
|
-
]);
|
|
326
|
+
).mapMany((dir) => [path.resolve(dir, "dist"), path.resolve(dir, "scss")]);
|
|
318
327
|
|
|
319
328
|
return new Set([...workspacePaths, ...localUpdatePaths].map((item) => PathUtils.norm(item)));
|
|
320
329
|
}
|
|
@@ -5,15 +5,16 @@ import { StringUtils } from "@simplysm/sd-core-common";
|
|
|
5
5
|
export class SdCliNgRoutesFileGenerator {
|
|
6
6
|
cachedHash?: string;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
async watchAsync(pkgPath: string, noLazyRoute?: boolean) {
|
|
9
9
|
const routesFilePath = path.resolve(pkgPath, "src/routes.ts");
|
|
10
10
|
this.cachedHash = FsUtils.exists(routesFilePath)
|
|
11
|
-
? HashUtils.get(FsUtils.
|
|
11
|
+
? HashUtils.get(await FsUtils.readFileAsync(routesFilePath))
|
|
12
12
|
: undefined;
|
|
13
13
|
|
|
14
|
-
SdFsWatcher.
|
|
14
|
+
const watcher = await SdFsWatcher.watchAsync([path.resolve(pkgPath, "src")], {
|
|
15
15
|
ignored: [routesFilePath],
|
|
16
|
-
})
|
|
16
|
+
});
|
|
17
|
+
watcher.onChange({ delay: 50 }, (changeInfos) => {
|
|
17
18
|
if (changeInfos.some((item) => ["add", "addDir", "unlink", "unlinkDir"].includes(item.event)))
|
|
18
19
|
this.run(pkgPath, noLazyRoute);
|
|
19
20
|
});
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { FsUtils,
|
|
1
|
+
import { FsUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { SdBuildRunnerBase } from "../
|
|
3
|
+
import { SdBuildRunnerBase } from "../SdBuildRunnerBase";
|
|
4
4
|
import { SdNgBundler } from "./SdNgBundler";
|
|
5
5
|
import { SdCliCordova } from "../../entry/SdCliCordova";
|
|
6
6
|
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
7
7
|
import { INpmConfig } from "../../types/common-config/INpmConfig";
|
|
8
8
|
import { SdCliNgRoutesFileGenerator } from "./SdCliNgRoutesFileGenerator";
|
|
9
9
|
import { SdCliElectron } from "../../entry/SdCliElectron";
|
|
10
|
+
import { ISdClientPackageConfig } from "../../types/config/ISdProjectConfig";
|
|
10
11
|
|
|
11
12
|
export class SdClientBuildRunner extends SdBuildRunnerBase<"client"> {
|
|
12
13
|
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
|
|
@@ -17,67 +18,48 @@ export class SdClientBuildRunner extends SdBuildRunnerBase<"client"> {
|
|
|
17
18
|
protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
18
19
|
// 최초 한번
|
|
19
20
|
if (!modifiedFileSet) {
|
|
20
|
-
if (!this.
|
|
21
|
+
if (!this._opt.watch?.noEmit) {
|
|
21
22
|
// config
|
|
22
23
|
this._debug("GEN .config...");
|
|
23
|
-
const confDistPath = path.resolve(this.
|
|
24
|
+
const confDistPath = path.resolve(this._opt.pkgPath, "dist/.config.json");
|
|
24
25
|
FsUtils.writeFile(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
25
26
|
|
|
26
27
|
// cordova
|
|
27
28
|
if (this._pkgConf.builder?.cordova) {
|
|
28
29
|
this._debug("CORDOVA 준비...");
|
|
29
30
|
this.#cordova = new SdCliCordova({
|
|
30
|
-
pkgPath: this.
|
|
31
|
+
pkgPath: this._opt.pkgPath,
|
|
31
32
|
config: this._pkgConf.builder.cordova,
|
|
32
33
|
});
|
|
33
34
|
await this.#cordova.initializeAsync();
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
// routes
|
|
37
|
-
const npmConf = FsUtils.readJson(
|
|
38
|
+
const npmConf = FsUtils.readJson(
|
|
39
|
+
path.resolve(this._opt.pkgPath, "package.json"),
|
|
40
|
+
) as INpmConfig;
|
|
38
41
|
if ("@angular/router" in (npmConf.dependencies ?? {})) {
|
|
39
42
|
this._debug(`GEN routes.ts...`);
|
|
40
|
-
new SdCliNgRoutesFileGenerator().
|
|
43
|
+
await new SdCliNgRoutesFileGenerator().watchAsync(
|
|
44
|
+
this._opt.pkgPath,
|
|
45
|
+
this._pkgConf.noLazyRoute,
|
|
46
|
+
);
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
// ng
|
|
45
51
|
this._debug(`BUILD 준비...`);
|
|
46
52
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
dev: this._dev,
|
|
58
|
-
emitOnly: this._emitOnly ?? false,
|
|
59
|
-
noEmit: this._noEmit ?? false,
|
|
60
|
-
builderType: ngBundlerBuilderType,
|
|
61
|
-
pkgPath: this._pkgPath,
|
|
62
|
-
outputPath:
|
|
63
|
-
ngBundlerBuilderType === "web"
|
|
64
|
-
? PathUtils.norm(this._pkgPath, "dist")
|
|
65
|
-
: ngBundlerBuilderType === "electron" && !this._dev
|
|
66
|
-
? PathUtils.norm(this._pkgPath, ".electron/src")
|
|
67
|
-
: ngBundlerBuilderType === "cordova" && !this._dev
|
|
68
|
-
? PathUtils.norm(this._pkgPath, ".cordova/www")
|
|
69
|
-
: PathUtils.norm(this._pkgPath, "dist", ngBundlerBuilderType),
|
|
70
|
-
env: {
|
|
71
|
-
...this._pkgConf.env,
|
|
72
|
-
...this._pkgConf.builder?.[ngBundlerBuilderType]?.env,
|
|
73
|
-
},
|
|
74
|
-
external:
|
|
75
|
-
ngBundlerBuilderType === "electron"
|
|
76
|
-
? (this._pkgConf.builder?.electron?.reinstallDependencies ?? [])
|
|
77
|
-
: [],
|
|
78
|
-
cordovaConfig:
|
|
79
|
-
ngBundlerBuilderType === "cordova" ? this._pkgConf.builder!.cordova : undefined,
|
|
80
|
-
scopePathSet: this._scopePathSet,
|
|
53
|
+
const builderTypes = Object.keys(this._pkgConf.builder ?? { web: {} }) as (keyof NonNullable<
|
|
54
|
+
ISdClientPackageConfig["builder"]
|
|
55
|
+
>)[];
|
|
56
|
+
|
|
57
|
+
this.#ngBundlers = builderTypes.map(
|
|
58
|
+
(builderType) =>
|
|
59
|
+
new SdNgBundler(this._opt, {
|
|
60
|
+
builderType: builderType,
|
|
61
|
+
builderConfig: this._pkgConf.builder?.[builderType],
|
|
62
|
+
env: this._pkgConf.env,
|
|
81
63
|
}),
|
|
82
64
|
);
|
|
83
65
|
}
|
|
@@ -88,7 +70,7 @@ export class SdClientBuildRunner extends SdBuildRunnerBase<"client"> {
|
|
|
88
70
|
}
|
|
89
71
|
}
|
|
90
72
|
|
|
91
|
-
if (this.
|
|
73
|
+
if (this._opt.watch?.noEmit) {
|
|
92
74
|
this._debug(`BUILD...`);
|
|
93
75
|
const buildResults = await Promise.all(
|
|
94
76
|
this.#ngBundlers!.map((builder) => builder.bundleAsync()),
|
|
@@ -121,15 +103,15 @@ export class SdClientBuildRunner extends SdBuildRunnerBase<"client"> {
|
|
|
121
103
|
const emitFileSet = new Set(buildResults.mapMany((item) => Array.from(item.emitFileSet)));
|
|
122
104
|
const buildMessages = buildResults.mapMany((item) => item.buildMessages).distinct();
|
|
123
105
|
|
|
124
|
-
if (!this.
|
|
106
|
+
if (!this._opt.watch?.dev && this.#cordova) {
|
|
125
107
|
this._debug("CORDOVA BUILD...");
|
|
126
|
-
await this.#cordova.buildAsync(path.resolve(this.
|
|
108
|
+
await this.#cordova.buildAsync(path.resolve(this._opt.pkgPath, "dist"));
|
|
127
109
|
}
|
|
128
110
|
|
|
129
|
-
if (!this.
|
|
111
|
+
if (!this._opt.watch?.dev && this._pkgConf.builder?.electron) {
|
|
130
112
|
this._debug("ELECTRON BUILD...");
|
|
131
113
|
await SdCliElectron.buildAsync({
|
|
132
|
-
pkgPath: this.
|
|
114
|
+
pkgPath: this._opt.pkgPath,
|
|
133
115
|
electronConfig: this._pkgConf.builder.electron,
|
|
134
116
|
});
|
|
135
117
|
}
|