@simplysm/sd-cli 12.7.5 → 12.7.6
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/{SdAiCommand.d.ts → sd-cli-ai-command.d.ts} +1 -1
- package/dist/entry/{SdAiCommand.js → sd-cli-ai-command.js} +5 -5
- package/dist/entry/sd-cli-ai-command.js.map +1 -0
- package/dist/entry/{SdCliCordova.d.ts → sd-cli-cordova.d.ts} +1 -1
- package/dist/entry/{SdCliCordova.js → sd-cli-cordova.js} +33 -33
- package/dist/entry/sd-cli-cordova.js.map +1 -0
- package/dist/entry/{SdCliElectron.d.ts → sd-cli-electron.d.ts} +1 -1
- package/dist/entry/{SdCliElectron.js → sd-cli-electron.js} +18 -18
- package/dist/entry/sd-cli-electron.js.map +1 -0
- package/dist/entry/{SdCliLocalUpdate.js → sd-cli-local-update.js} +12 -12
- package/dist/entry/sd-cli-local-update.js.map +1 -0
- package/dist/entry/{SdCliProject.js → sd-cli-project.js} +36 -36
- package/dist/entry/sd-cli-project.js.map +1 -0
- package/dist/index.d.ts +30 -30
- package/dist/index.js +30 -30
- package/dist/index.js.map +1 -1
- package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.js → sd-cli-ng-routes.file-generator.js} +12 -12
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +1 -0
- package/dist/pkg-builders/client/{SdClientBuildRunner.d.ts → sd-client.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/client/{SdClientBuildRunner.js → sd-client.build-runner.js} +34 -27
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -0
- package/dist/pkg-builders/client/{SdNgBundlerContext.js → sd-ng.bundler-context.js} +5 -5
- package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +1 -0
- package/dist/pkg-builders/client/{SdNgBundler.d.ts → sd-ng.bundler.d.ts} +2 -2
- package/dist/pkg-builders/client/{SdNgBundler.js → sd-ng.bundler.js} +55 -37
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -0
- package/dist/pkg-builders/client/{createSdNgPlugin.d.ts → sd-ng.plugin-creator.d.ts} +1 -1
- package/dist/pkg-builders/client/{createSdNgPlugin.js → sd-ng.plugin-creator.js} +17 -17
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -0
- package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.js → sd-cli-index.file-generator.js} +8 -8
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -0
- package/dist/pkg-builders/lib/{SdJsLibBuildRunner.d.ts → sd-js-lib.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdJsLibBuildRunner.js → sd-js-lib.build-runner.js} +17 -17
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +1 -0
- package/dist/pkg-builders/lib/{SdTsLibBuildRunner.d.ts → sd-ts-lib.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdTsLibBuildRunner.js → sd-ts-lib.build-runner.js} +17 -17
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -0
- package/dist/pkg-builders/lib/{SdTsLibBuilder.d.ts → sd-ts-lib.builder.d.ts} +1 -1
- package/dist/pkg-builders/lib/{SdTsLibBuilder.js → sd-ts-lib.builder.js} +11 -11
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -0
- package/dist/pkg-builders/{SdMultiBuildRunner.d.ts → sd-multi.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/{SdMultiBuildRunner.js → sd-multi.build-runner.js} +13 -13
- package/dist/pkg-builders/sd-multi.build-runner.js.map +1 -0
- package/dist/pkg-builders/server/{SdServerBuildRunner.d.ts → sd-server.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/server/{SdServerBuildRunner.js → sd-server.build-runner.js} +35 -35
- package/dist/pkg-builders/server/sd-server.build-runner.js.map +1 -0
- package/dist/pkg-builders/server/{SdServerBundler.d.ts → sd-server.bundler.d.ts} +1 -1
- package/dist/pkg-builders/server/{SdServerBundler.js → sd-server.bundler.js} +15 -15
- package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -0
- package/dist/pkg-builders/server/{createSdServerPlugin.d.ts → sd-server.plugin-creator.d.ts} +1 -1
- package/dist/pkg-builders/server/{createSdServerPlugin.js → sd-server.plugin-creator.js} +10 -10
- package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +1 -0
- package/dist/sd-cli.js +10 -10
- package/dist/sd-cli.js.map +1 -1
- package/dist/{ts-builder/SdTsCompiler.d.ts → ts-compiler/sd-ts-compiler.d.ts} +1 -1
- package/dist/{ts-builder/SdTsCompiler.js → ts-compiler/sd-ts-compiler.js} +60 -60
- package/dist/ts-compiler/sd-ts-compiler.js.map +1 -0
- package/dist/types/{build-plugin.type.js → build-plugin.types.js} +1 -1
- package/dist/types/build-plugin.types.js.map +1 -0
- package/dist/types/{build-runner.type.d.ts → build-runner.types.d.ts} +1 -1
- package/dist/types/build-runner.types.js +3 -0
- package/dist/types/build-runner.types.js.map +1 -0
- package/dist/types/{build.type.js → build.types.js} +1 -1
- package/dist/types/build.types.js.map +1 -0
- package/dist/types/common-configs.types.js +2 -0
- package/dist/types/common-configs.types.js.map +1 -0
- package/dist/types/config.types.js +2 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/types/{ts-compiler.type.d.ts → ts-compiler.types.d.ts} +1 -1
- package/dist/types/{ts-compiler.type.js → ts-compiler.types.js} +2 -2
- package/dist/types/ts-compiler.types.js.map +1 -0
- package/dist/types/{workers.type.d.ts → worker.types.d.ts} +2 -2
- package/dist/types/worker.types.js +3 -0
- package/dist/types/worker.types.js.map +1 -0
- package/dist/utils/{SdCliConvertMessageUtil.d.ts → sd-cli-convert-message.utils.d.ts} +2 -2
- package/dist/utils/{SdCliConvertMessageUtil.js → sd-cli-convert-message.utils.js} +7 -7
- package/dist/utils/sd-cli-convert-message.utils.js.map +1 -0
- package/dist/utils/{SdCliPerformanceTime.js → sd-cli-performance-time.js} +1 -1
- package/dist/utils/sd-cli-performance-time.js.map +1 -0
- package/dist/workers/{build-runner-worker.js → build-runner.worker.js} +13 -13
- package/dist/workers/build-runner.worker.js.map +1 -0
- package/dist/workers/{server-worker.js → server.worker.js} +6 -6
- package/dist/workers/server.worker.js.map +1 -0
- package/package.json +5 -5
- package/src/entry/{SdAiCommand.ts → sd-cli-ai-command.ts} +4 -4
- package/src/entry/{SdCliCordova.ts → sd-cli-cordova.ts} +32 -32
- package/src/entry/{SdCliElectron.ts → sd-cli-electron.ts} +17 -17
- package/src/entry/{SdCliLocalUpdate.ts → sd-cli-local-update.ts} +11 -11
- package/src/entry/{SdCliProject.ts → sd-cli-project.ts} +36 -36
- package/src/index.ts +30 -30
- package/src/pkg-builders/client/{SdCliNgRoutesFileGenerator.ts → sd-cli-ng-routes.file-generator.ts} +11 -11
- package/src/pkg-builders/client/{SdClientBuildRunner.ts → sd-client.build-runner.ts} +52 -45
- package/src/pkg-builders/client/{SdNgBundlerContext.ts → sd-ng.bundler-context.ts} +4 -4
- package/src/pkg-builders/client/{SdNgBundler.ts → sd-ng.bundler.ts} +94 -61
- package/src/pkg-builders/client/{createSdNgPlugin.ts → sd-ng.plugin-creator.ts} +16 -16
- package/src/pkg-builders/lib/{SdCliIndexFileGenerator.ts → sd-cli-index.file-generator.ts} +7 -7
- package/src/pkg-builders/lib/{SdJsLibBuildRunner.ts → sd-js-lib.build-runner.ts} +16 -16
- package/src/pkg-builders/lib/{SdTsLibBuildRunner.ts → sd-ts-lib.build-runner.ts} +17 -17
- package/src/pkg-builders/lib/{SdTsLibBuilder.ts → sd-ts-lib.builder.ts} +10 -10
- package/src/pkg-builders/{SdMultiBuildRunner.ts → sd-multi.build-runner.ts} +12 -12
- package/src/pkg-builders/server/{SdServerBuildRunner.ts → sd-server.build-runner.ts} +34 -34
- package/src/pkg-builders/server/{SdServerBundler.ts → sd-server.bundler.ts} +14 -14
- package/src/pkg-builders/server/{createSdServerPlugin.ts → sd-server.plugin-creator.ts} +9 -9
- package/src/sd-cli.ts +10 -10
- package/src/{ts-builder/SdTsCompiler.ts → ts-compiler/sd-ts-compiler.ts} +60 -60
- package/src/types/{build-runner.type.ts → build-runner.types.ts} +1 -1
- package/src/types/{ts-compiler.type.ts → ts-compiler.types.ts} +1 -1
- package/src/types/{workers.type.ts → worker.types.ts} +2 -2
- package/src/utils/{SdCliConvertMessageUtil.ts → sd-cli-convert-message.utils.ts} +6 -6
- package/src/workers/{build-runner-worker.ts → build-runner.worker.ts} +12 -12
- package/src/workers/{server-worker.ts → server.worker.ts} +5 -5
- package/dist/entry/SdAiCommand.js.map +0 -1
- package/dist/entry/SdCliCordova.js.map +0 -1
- package/dist/entry/SdCliElectron.js.map +0 -1
- package/dist/entry/SdCliLocalUpdate.js.map +0 -1
- package/dist/entry/SdCliProject.js.map +0 -1
- package/dist/pkg-builders/SdMultiBuildRunner.js.map +0 -1
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +0 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.js.map +0 -1
- package/dist/pkg-builders/client/SdNgBundler.js.map +0 -1
- package/dist/pkg-builders/client/SdNgBundlerContext.js.map +0 -1
- package/dist/pkg-builders/client/createSdNgPlugin.js.map +0 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +0 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +0 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +0 -1
- package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +0 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.js.map +0 -1
- package/dist/pkg-builders/server/SdServerBundler.js.map +0 -1
- package/dist/pkg-builders/server/createSdServerPlugin.js.map +0 -1
- package/dist/ts-builder/SdTsCompiler.js.map +0 -1
- package/dist/types/build-plugin.type.js.map +0 -1
- package/dist/types/build-runner.type.js +0 -3
- package/dist/types/build-runner.type.js.map +0 -1
- package/dist/types/build.type.js.map +0 -1
- package/dist/types/common-configs.type.js +0 -2
- package/dist/types/common-configs.type.js.map +0 -1
- package/dist/types/sd-configs.type.js +0 -2
- package/dist/types/sd-configs.type.js.map +0 -1
- package/dist/types/ts-compiler.type.js.map +0 -1
- package/dist/types/workers.type.js +0 -3
- package/dist/types/workers.type.js.map +0 -1
- package/dist/utils/SdCliConvertMessageUtil.js.map +0 -1
- package/dist/utils/SdCliPerformanceTime.js.map +0 -1
- package/dist/workers/build-runner-worker.js.map +0 -1
- package/dist/workers/server-worker.js.map +0 -1
- /package/dist/entry/{SdCliLocalUpdate.d.ts → sd-cli-local-update.d.ts} +0 -0
- /package/dist/entry/{SdCliProject.d.ts → sd-cli-project.d.ts} +0 -0
- /package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.d.ts → sd-cli-ng-routes.file-generator.d.ts} +0 -0
- /package/dist/pkg-builders/client/{SdNgBundlerContext.d.ts → sd-ng.bundler-context.d.ts} +0 -0
- /package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.d.ts → sd-cli-index.file-generator.d.ts} +0 -0
- /package/dist/types/{build-plugin.type.d.ts → build-plugin.types.d.ts} +0 -0
- /package/dist/types/{build.type.d.ts → build.types.d.ts} +0 -0
- /package/dist/types/{common-configs.type.d.ts → common-configs.types.d.ts} +0 -0
- /package/dist/types/{sd-configs.type.d.ts → config.types.d.ts} +0 -0
- /package/dist/utils/{SdCliPerformanceTime.d.ts → sd-cli-performance-time.d.ts} +0 -0
- /package/dist/workers/{build-runner-worker.d.ts → build-runner.worker.d.ts} +0 -0
- /package/dist/workers/{server-worker.d.ts → server.worker.d.ts} +0 -0
- /package/src/types/{build-plugin.type.ts → build-plugin.types.ts} +0 -0
- /package/src/types/{build.type.ts → build.types.ts} +0 -0
- /package/src/types/{common-configs.type.ts → common-configs.types.ts} +0 -0
- /package/src/types/{sd-configs.type.ts → config.types.ts} +0 -0
- /package/src/utils/{SdCliPerformanceTime.ts → sd-cli-performance-time.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FsUtils, SdLogger, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { pathToFileURL } from "url";
|
|
4
|
-
import { type ISdProjectConfig } from "../types/
|
|
4
|
+
import { type ISdProjectConfig } from "../types/config.types";
|
|
5
5
|
|
|
6
6
|
export class SdCliLocalUpdate {
|
|
7
7
|
static async runAsync(opt: { confFileRelPath: string; optNames: string[] }): Promise<void> {
|
|
8
|
-
const logger =
|
|
8
|
+
const logger = SdLogger.get(["simplysm", "sd-cli", "SdCliLocalUpdate", "runAsync"]);
|
|
9
9
|
|
|
10
10
|
logger.debug("프로젝트 설정 가져오기...");
|
|
11
11
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(
|
|
@@ -19,13 +19,13 @@ export class SdCliLocalUpdate {
|
|
|
19
19
|
|
|
20
20
|
logger.log("로컬 라이브러리 업데이트 시작...");
|
|
21
21
|
for (const updatePathInfo of updatePathInfos) {
|
|
22
|
-
if (!
|
|
22
|
+
if (!FsUtils.exists(updatePathInfo.source)) {
|
|
23
23
|
logger.warn(`소스경로를 찾을 수 없어 무시됩니다(${updatePathInfo.source})`);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// 소스경로에서 대상경로로 파일 복사
|
|
28
|
-
|
|
28
|
+
FsUtils.copy(updatePathInfo.source, updatePathInfo.target, (src) => {
|
|
29
29
|
return !src.includes("node_modules") && !src.endsWith("package.json");
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -33,7 +33,7 @@ export class SdCliLocalUpdate {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
static async watchAsync(opt: { confFileRelPath: string; optNames: string[] }): Promise<void> {
|
|
36
|
-
const logger =
|
|
36
|
+
const logger = SdLogger.get(["simplysm", "sd-cli", "SdCliLocalUpdate", "watchAsync"]);
|
|
37
37
|
|
|
38
38
|
logger.debug("프로젝트 설정 가져오기...");
|
|
39
39
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(
|
|
@@ -56,17 +56,17 @@ export class SdCliLocalUpdate {
|
|
|
56
56
|
|
|
57
57
|
for (const changedFileInfo of changedFileInfos) {
|
|
58
58
|
for (const updatePathInfo of updatePathInfos) {
|
|
59
|
-
if (!
|
|
59
|
+
if (!PathUtils.isChildPath(changedFileInfo.path, updatePathInfo.source)) continue;
|
|
60
60
|
|
|
61
61
|
const sourceRelPath = path.relative(updatePathInfo.source, changedFileInfo.path);
|
|
62
62
|
const targetFilePath = path.resolve(updatePathInfo.target, sourceRelPath);
|
|
63
63
|
|
|
64
64
|
if (changedFileInfo.event === "unlink") {
|
|
65
65
|
logger.debug(`변경파일감지(삭제): ${targetFilePath}`);
|
|
66
|
-
|
|
66
|
+
FsUtils.remove(targetFilePath);
|
|
67
67
|
} else {
|
|
68
68
|
logger.debug(`변경파일감지(복사): ${changedFileInfo.path} => ${targetFilePath}`);
|
|
69
|
-
|
|
69
|
+
FsUtils.copy(changedFileInfo.path, targetFilePath);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -84,8 +84,8 @@ export class SdCliLocalUpdate {
|
|
|
84
84
|
for (const pkgGlobPath of Object.keys(record)) {
|
|
85
85
|
// "node_modules'에서 로컬업데이트 설정에 맞는 패키지를 "glob"하여 대상 패키지경로 목록 가져오기
|
|
86
86
|
const targetPaths = [
|
|
87
|
-
...
|
|
88
|
-
...
|
|
87
|
+
...FsUtils.glob(path.resolve(process.cwd(), "node_modules", pkgGlobPath)),
|
|
88
|
+
...FsUtils.glob(path.resolve(process.cwd(), "packages", "*", "node_modules", pkgGlobPath)),
|
|
89
89
|
];
|
|
90
90
|
|
|
91
91
|
result.push(
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import {
|
|
2
|
+
import { FsUtils, SdLogger, PathUtils, SdProcess } from "@simplysm/sd-core-node";
|
|
3
3
|
import { pathToFileURL } from "url";
|
|
4
4
|
import semver from "semver";
|
|
5
|
-
import { NeverEntryError,
|
|
5
|
+
import { NeverEntryError, StringUtils, Wait } from "@simplysm/sd-core-common";
|
|
6
6
|
import { SdStorage } from "@simplysm/sd-storage";
|
|
7
|
-
import { SdCliLocalUpdate } from "./
|
|
7
|
+
import { SdCliLocalUpdate } from "./sd-cli-local-update";
|
|
8
8
|
import xml2js from "xml2js";
|
|
9
|
-
import { SdMultiBuildRunner } from "../pkg-builders/
|
|
10
|
-
import {
|
|
11
|
-
import { type ISdProjectConfig, type TSdPackageConfig } from "../types/
|
|
12
|
-
import { type INpmConfig } from "../types/common-configs.
|
|
13
|
-
import { type ISdBuildMessage } from "../types/build.
|
|
9
|
+
import { SdMultiBuildRunner } from "../pkg-builders/sd-multi.build-runner";
|
|
10
|
+
import { SdCliConvertMessageUtils } from "../utils/sd-cli-convert-message.utils";
|
|
11
|
+
import { type ISdProjectConfig, type TSdPackageConfig } from "../types/config.types";
|
|
12
|
+
import { type INpmConfig } from "../types/common-configs.types";
|
|
13
|
+
import { type ISdBuildMessage } from "../types/build.types";
|
|
14
14
|
|
|
15
15
|
export class SdCliProject {
|
|
16
16
|
static async watchAsync(opt: {
|
|
@@ -19,7 +19,7 @@ export class SdCliProject {
|
|
|
19
19
|
pkgNames: string[];
|
|
20
20
|
inspectNames: string[];
|
|
21
21
|
}): Promise<void> {
|
|
22
|
-
const logger =
|
|
22
|
+
const logger = SdLogger.get(["simplysm", "sd-cli", "SdCliProject", "watchAsync"]);
|
|
23
23
|
|
|
24
24
|
logger.debug("프로젝트 설정 가져오기...");
|
|
25
25
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(
|
|
@@ -36,16 +36,16 @@ export class SdCliProject {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
logger.debug("프로젝트 package.json 가져오기...");
|
|
39
|
-
const projNpmConf =
|
|
39
|
+
const projNpmConf = FsUtils.readJson(path.resolve(process.cwd(), "package.json")) as INpmConfig;
|
|
40
40
|
|
|
41
41
|
logger.debug("패키지 목록 구성...");
|
|
42
42
|
if (!projNpmConf.workspaces) {
|
|
43
43
|
throw new Error("프로젝트 package.json에 workspaces가 설정되어있지 않습니다.");
|
|
44
44
|
}
|
|
45
45
|
const allPkgPaths = projNpmConf.workspaces
|
|
46
|
-
.mapMany((item) =>
|
|
46
|
+
.mapMany((item) => FsUtils.glob(item))
|
|
47
47
|
.filter((item) => !item.includes("."))
|
|
48
|
-
.map((item) =>
|
|
48
|
+
.map((item) => PathUtils.norm(item));
|
|
49
49
|
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
50
50
|
if (opt.pkgNames.length !== 0) {
|
|
51
51
|
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
@@ -78,7 +78,7 @@ export class SdCliProject {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
static async buildAsync(opt: { confFileRelPath: string; optNames: string[]; pkgNames: string[] }): Promise<void> {
|
|
81
|
-
const logger =
|
|
81
|
+
const logger = SdLogger.get(["simplysm", "sd-cli", "SdCliProject", "buildAsync"]);
|
|
82
82
|
|
|
83
83
|
logger.debug("프로젝트 설정 가져오기...");
|
|
84
84
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(
|
|
@@ -87,13 +87,13 @@ export class SdCliProject {
|
|
|
87
87
|
) as ISdProjectConfig;
|
|
88
88
|
|
|
89
89
|
logger.debug("프로젝트 package.json 가져오기...");
|
|
90
|
-
const projNpmConf =
|
|
90
|
+
const projNpmConf = FsUtils.readJson(path.resolve(process.cwd(), "package.json")) as INpmConfig;
|
|
91
91
|
|
|
92
92
|
logger.debug("패키지 목록 구성...");
|
|
93
93
|
if (!projNpmConf.workspaces) {
|
|
94
94
|
throw new Error("프로젝트 package.json에 workspaces가 설정되어있지 않습니다.");
|
|
95
95
|
}
|
|
96
|
-
const allPkgPaths = projNpmConf.workspaces.mapMany((item) =>
|
|
96
|
+
const allPkgPaths = projNpmConf.workspaces.mapMany((item) => FsUtils.glob(item)).map((item) => PathUtils.norm(item));
|
|
97
97
|
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
98
98
|
if (opt.pkgNames.length !== 0) {
|
|
99
99
|
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
@@ -121,7 +121,7 @@ export class SdCliProject {
|
|
|
121
121
|
optNames: string[];
|
|
122
122
|
pkgNames: string[];
|
|
123
123
|
}): Promise<void> {
|
|
124
|
-
const logger =
|
|
124
|
+
const logger = SdLogger.get(["simplysm", "sd-cli", "SdCliProject", "publishAsync"]);
|
|
125
125
|
|
|
126
126
|
logger.debug("프로젝트 설정 가져오기...");
|
|
127
127
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(
|
|
@@ -130,7 +130,7 @@ export class SdCliProject {
|
|
|
130
130
|
) as ISdProjectConfig;
|
|
131
131
|
|
|
132
132
|
logger.debug("프로젝트 package.json 가져오기...");
|
|
133
|
-
const projNpmConf =
|
|
133
|
+
const projNpmConf = FsUtils.readJson(path.resolve(process.cwd(), "package.json")) as INpmConfig;
|
|
134
134
|
|
|
135
135
|
if (opt.noBuild) {
|
|
136
136
|
logger.warn("빌드하지 않고, 배포하는것은 상당히 위험합니다.");
|
|
@@ -138,7 +138,7 @@ export class SdCliProject {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
// GIT 사용중일 경우, 커밋되지 않은 수정사항이 있는지 확인
|
|
141
|
-
if (
|
|
141
|
+
if (FsUtils.exists(path.resolve(process.cwd(), ".git"))) {
|
|
142
142
|
logger.debug("GIT 커밋여부 확인...");
|
|
143
143
|
const gitStatusResult = await SdProcess.spawnAsync("git status");
|
|
144
144
|
if (gitStatusResult.includes("Changes") || gitStatusResult.includes("Untracked")) {
|
|
@@ -151,9 +151,9 @@ export class SdCliProject {
|
|
|
151
151
|
throw new Error("프로젝트 package.json에 workspaces가 설정되어있지 않습니다.");
|
|
152
152
|
}
|
|
153
153
|
const allPkgPaths = projNpmConf.workspaces
|
|
154
|
-
.mapMany((item) =>
|
|
154
|
+
.mapMany((item) => FsUtils.glob(item))
|
|
155
155
|
.filter((item) => !item.includes("."))
|
|
156
|
-
.map((item) =>
|
|
156
|
+
.map((item) => PathUtils.norm(item));
|
|
157
157
|
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
158
158
|
if (opt.pkgNames.length !== 0) {
|
|
159
159
|
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
@@ -179,7 +179,7 @@ export class SdCliProject {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
// GIT 사용중일경우, 새 버전 커밋 및 TAG 생성
|
|
182
|
-
if (
|
|
182
|
+
if (FsUtils.exists(path.resolve(process.cwd(), ".git"))) {
|
|
183
183
|
logger.debug("새 버전 커밋 및 TAG 생성...");
|
|
184
184
|
await SdProcess.spawnAsync("git add .");
|
|
185
185
|
await SdProcess.spawnAsync(`git commit -m "v${projNpmConf.version}"`);
|
|
@@ -208,7 +208,7 @@ export class SdCliProject {
|
|
|
208
208
|
if (postPublishItem.type === "script") {
|
|
209
209
|
const script = postPublishItem.script.replace(/%([^%]*)%/g, (item) => {
|
|
210
210
|
const envName = item.replace(/%/g, "");
|
|
211
|
-
if (!
|
|
211
|
+
if (!StringUtils.isNullOrEmpty(projNpmConf.version) && envName === "SD_VERSION") {
|
|
212
212
|
return projNpmConf.version;
|
|
213
213
|
}
|
|
214
214
|
if (envName === "SD_PROJECT_PATH") {
|
|
@@ -230,11 +230,11 @@ export class SdCliProject {
|
|
|
230
230
|
if (pkgPubConf === "npm") {
|
|
231
231
|
await SdProcess.spawnAsync("yarn npm publish --access public", { cwd: pkgPath });
|
|
232
232
|
} else if (pkgPubConf?.type === "local-directory") {
|
|
233
|
-
const pkgNpmConf =
|
|
233
|
+
const pkgNpmConf = FsUtils.readJson(path.resolve(pkgPath, "package.json")) as INpmConfig;
|
|
234
234
|
|
|
235
235
|
const targetRootPath = pkgPubConf.path.replace(/%([^%]*)%/g, (item) => {
|
|
236
236
|
const envName = item.replace(/%/g, "");
|
|
237
|
-
if (!
|
|
237
|
+
if (!StringUtils.isNullOrEmpty(pkgNpmConf.version) && envName === "SD_VERSION") {
|
|
238
238
|
return pkgNpmConf.version;
|
|
239
239
|
}
|
|
240
240
|
if (envName === "SD_PROJECT_PATH") {
|
|
@@ -243,15 +243,15 @@ export class SdCliProject {
|
|
|
243
243
|
return process.env[envName] ?? item;
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
-
const filePaths =
|
|
246
|
+
const filePaths = FsUtils.glob(path.resolve(pkgPath, "dist", "**", "*"), {
|
|
247
247
|
dot: true,
|
|
248
248
|
nodir: true,
|
|
249
249
|
});
|
|
250
250
|
|
|
251
251
|
for (const filePath of filePaths) {
|
|
252
252
|
const relativeFilePath = path.relative(path.resolve(pkgPath, "dist"), filePath);
|
|
253
|
-
const targetPath =
|
|
254
|
-
|
|
253
|
+
const targetPath = PathUtils.posix(targetRootPath, relativeFilePath);
|
|
254
|
+
FsUtils.copy(filePath, targetPath);
|
|
255
255
|
}
|
|
256
256
|
} else if (pkgPubConf?.type === "ftp" || pkgPubConf?.type === "ftps" || pkgPubConf?.type === "sftp") {
|
|
257
257
|
const ftp = await SdStorage.connectAsync(pkgPubConf.type, {
|
|
@@ -286,7 +286,7 @@ export class SdCliProject {
|
|
|
286
286
|
projNpmConf.version = newVersion;
|
|
287
287
|
|
|
288
288
|
const pkgNames = allPkgPaths.map((pkgPath) => {
|
|
289
|
-
const pkgNpmConf =
|
|
289
|
+
const pkgNpmConf = FsUtils.readJson(path.resolve(pkgPath, "package.json"));
|
|
290
290
|
return pkgNpmConf.name;
|
|
291
291
|
});
|
|
292
292
|
|
|
@@ -304,12 +304,12 @@ export class SdCliProject {
|
|
|
304
304
|
updateDepVersion(projNpmConf.peerDependencies);
|
|
305
305
|
|
|
306
306
|
const projNpmConfFilePath = path.resolve(process.cwd(), "package.json");
|
|
307
|
-
|
|
307
|
+
FsUtils.writeJson(projNpmConfFilePath, projNpmConf, { space: 2 });
|
|
308
308
|
|
|
309
309
|
// 각 패키지 package.json 버전 설정
|
|
310
310
|
await allPkgPaths.parallelAsync(async (pkgPath) => {
|
|
311
311
|
const pkgNpmConfFilePath = path.resolve(pkgPath, "package.json");
|
|
312
|
-
const pkgNpmConf =
|
|
312
|
+
const pkgNpmConf = FsUtils.readJson(pkgNpmConfFilePath);
|
|
313
313
|
pkgNpmConf.version = newVersion;
|
|
314
314
|
|
|
315
315
|
updateDepVersion(pkgNpmConf.dependencies);
|
|
@@ -317,22 +317,22 @@ export class SdCliProject {
|
|
|
317
317
|
updateDepVersion(pkgNpmConf.devDependencies);
|
|
318
318
|
updateDepVersion(pkgNpmConf.peerDependencies);
|
|
319
319
|
|
|
320
|
-
|
|
320
|
+
FsUtils.writeJson(pkgNpmConfFilePath, pkgNpmConf, { space: 2 });
|
|
321
321
|
|
|
322
|
-
if (
|
|
322
|
+
if (FsUtils.exists(path.resolve(pkgPath, "plugin.xml"))) {
|
|
323
323
|
const cordovaPluginConfFilePath = path.resolve(pkgPath, "plugin.xml");
|
|
324
|
-
const cordovaPluginConfXml = await xml2js.parseStringPromise(
|
|
324
|
+
const cordovaPluginConfXml = await xml2js.parseStringPromise(FsUtils.readFile(cordovaPluginConfFilePath));
|
|
325
325
|
cordovaPluginConfXml.plugin.$.version = newVersion;
|
|
326
326
|
|
|
327
|
-
|
|
327
|
+
FsUtils.writeFile(cordovaPluginConfFilePath, new xml2js.Builder().buildObject(cordovaPluginConfXml));
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
static #logging(buildResults: ISdBuildMessage[], logger:
|
|
332
|
+
static #logging(buildResults: ISdBuildMessage[], logger: SdLogger): void {
|
|
333
333
|
const messageMap = buildResults.toSetMap(
|
|
334
334
|
(item) => item.severity,
|
|
335
|
-
(item) =>
|
|
335
|
+
(item) => SdCliConvertMessageUtils.getBuildMessageString(item),
|
|
336
336
|
);
|
|
337
337
|
|
|
338
338
|
if (messageMap.has("message")) {
|
package/src/index.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
export * from "./entry/
|
|
2
|
-
export * from "./entry/
|
|
3
|
-
export * from "./entry/
|
|
4
|
-
export * from "./entry/
|
|
5
|
-
export * from "./entry/
|
|
6
|
-
export * from "./pkg-builders/client/
|
|
7
|
-
export * from "./pkg-builders/client/
|
|
8
|
-
export * from "./pkg-builders/client/
|
|
9
|
-
export * from "./pkg-builders/client/
|
|
10
|
-
export * from "./pkg-builders/client/
|
|
11
|
-
export * from "./pkg-builders/lib/
|
|
12
|
-
export * from "./pkg-builders/lib/
|
|
13
|
-
export * from "./pkg-builders/lib/
|
|
14
|
-
export * from "./pkg-builders/lib/
|
|
15
|
-
export * from "./pkg-builders/
|
|
16
|
-
export * from "./pkg-builders/server/
|
|
17
|
-
export * from "./pkg-builders/server/
|
|
18
|
-
export * from "./pkg-builders/server/
|
|
1
|
+
export * from "./entry/sd-cli-ai-command";
|
|
2
|
+
export * from "./entry/sd-cli-cordova";
|
|
3
|
+
export * from "./entry/sd-cli-electron";
|
|
4
|
+
export * from "./entry/sd-cli-local-update";
|
|
5
|
+
export * from "./entry/sd-cli-project";
|
|
6
|
+
export * from "./pkg-builders/client/sd-cli-ng-routes.file-generator";
|
|
7
|
+
export * from "./pkg-builders/client/sd-client.build-runner";
|
|
8
|
+
export * from "./pkg-builders/client/sd-ng.bundler-context";
|
|
9
|
+
export * from "./pkg-builders/client/sd-ng.bundler";
|
|
10
|
+
export * from "./pkg-builders/client/sd-ng.plugin-creator";
|
|
11
|
+
export * from "./pkg-builders/lib/sd-cli-index.file-generator";
|
|
12
|
+
export * from "./pkg-builders/lib/sd-js-lib.build-runner";
|
|
13
|
+
export * from "./pkg-builders/lib/sd-ts-lib.build-runner";
|
|
14
|
+
export * from "./pkg-builders/lib/sd-ts-lib.builder";
|
|
15
|
+
export * from "./pkg-builders/sd-multi.build-runner";
|
|
16
|
+
export * from "./pkg-builders/server/sd-server.build-runner";
|
|
17
|
+
export * from "./pkg-builders/server/sd-server.bundler";
|
|
18
|
+
export * from "./pkg-builders/server/sd-server.plugin-creator";
|
|
19
19
|
import "./sd-cli";
|
|
20
|
-
export * from "./ts-
|
|
21
|
-
export * from "./types/build-plugin.
|
|
22
|
-
export * from "./types/build-runner.
|
|
23
|
-
export * from "./types/build.
|
|
24
|
-
export * from "./types/common-configs.
|
|
25
|
-
export * from "./types/
|
|
26
|
-
export * from "./types/ts-compiler.
|
|
27
|
-
export * from "./types/
|
|
28
|
-
export * from "./utils/
|
|
29
|
-
export * from "./utils/
|
|
30
|
-
import "./workers/build-runner
|
|
31
|
-
import "./workers/server
|
|
20
|
+
export * from "./ts-compiler/sd-ts-compiler";
|
|
21
|
+
export * from "./types/build-plugin.types";
|
|
22
|
+
export * from "./types/build-runner.types";
|
|
23
|
+
export * from "./types/build.types";
|
|
24
|
+
export * from "./types/common-configs.types";
|
|
25
|
+
export * from "./types/config.types";
|
|
26
|
+
export * from "./types/ts-compiler.types";
|
|
27
|
+
export * from "./types/worker.types";
|
|
28
|
+
export * from "./utils/sd-cli-convert-message.utils";
|
|
29
|
+
export * from "./utils/sd-cli-performance-time";
|
|
30
|
+
import "./workers/build-runner.worker";
|
|
31
|
+
import "./workers/server.worker";
|
package/src/pkg-builders/client/{SdCliNgRoutesFileGenerator.ts → sd-cli-ng-routes.file-generator.ts}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FsUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
3
|
+
import { StringUtils } from "@simplysm/sd-core-common";
|
|
4
4
|
|
|
5
5
|
export class SdCliNgRoutesFileGenerator {
|
|
6
6
|
static watch(pkgPath: string, noLazyRoute?: boolean) {
|
|
7
7
|
const routesFilePath = path.resolve(pkgPath, "src/routes.ts");
|
|
8
|
-
let cache =
|
|
8
|
+
let cache = FsUtils.exists(routesFilePath) ? FsUtils.readFile(routesFilePath) : undefined;
|
|
9
9
|
|
|
10
10
|
SdFsWatcher.watch([path.resolve(pkgPath, "src")]).onChange({ delay: 50 }, () => {
|
|
11
11
|
cache = this.run(pkgPath, cache, noLazyRoute);
|
|
@@ -20,9 +20,9 @@ export class SdCliNgRoutesFileGenerator {
|
|
|
20
20
|
|
|
21
21
|
// 내부 파일들 import
|
|
22
22
|
const result: TInfo = new Map();
|
|
23
|
-
const filePaths =
|
|
23
|
+
const filePaths = FsUtils.glob(path.resolve(appDirPath, "**/*{P,.p}age.ts"));
|
|
24
24
|
for (const filePath of filePaths.orderBy()) {
|
|
25
|
-
const relModulePath =
|
|
25
|
+
const relModulePath = PathUtils.posix(path.relative(appDirPath, filePath)).slice(0, -3);
|
|
26
26
|
const codes = relModulePath
|
|
27
27
|
.replace(/\.page$/, "")
|
|
28
28
|
.replace(/Page$/, "")
|
|
@@ -35,7 +35,7 @@ export class SdCliNgRoutesFileGenerator {
|
|
|
35
35
|
for (let i = 0; i < codes.length; i++) {
|
|
36
36
|
if (i === codes.length - 2) continue; // 마지막 모음 폴더 무시.
|
|
37
37
|
const code = codes[i];
|
|
38
|
-
cursorItem = cursor.getOrCreate(
|
|
38
|
+
cursorItem = cursor.getOrCreate(StringUtils.toKebabCase(code), { children: new Map() });
|
|
39
39
|
cursor = cursorItem.children;
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -53,13 +53,13 @@ export class SdCliNgRoutesFileGenerator {
|
|
|
53
53
|
if (val.relModulePath != null) {
|
|
54
54
|
if (noLazyRoute) {
|
|
55
55
|
cont += indentStr
|
|
56
|
-
+ ` component: ${
|
|
57
|
-
imports.push(`import { ${
|
|
56
|
+
+ ` component: ${StringUtils.toPascalCase(path.basename(val.relModulePath))},\n`;
|
|
57
|
+
imports.push(`import { ${StringUtils.toPascalCase(path.basename(val.relModulePath))} } from "./app/${val.relModulePath}";`);
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
60
|
cont +=
|
|
61
61
|
indentStr +
|
|
62
|
-
` loadComponent: () => import("./app/${val.relModulePath}").then((m) => m.${
|
|
62
|
+
` loadComponent: () => import("./app/${val.relModulePath}").then((m) => m.${StringUtils.toPascalCase(
|
|
63
63
|
path.basename(
|
|
64
64
|
val.relModulePath))}),\n`;
|
|
65
65
|
}
|
|
@@ -77,13 +77,13 @@ export class SdCliNgRoutesFileGenerator {
|
|
|
77
77
|
const routes = fn(result, 2);
|
|
78
78
|
|
|
79
79
|
const content = `
|
|
80
|
-
import {
|
|
80
|
+
import type { Routes } from "@angular/router";
|
|
81
81
|
${imports.join("\n")}
|
|
82
82
|
export const routes: Routes = [
|
|
83
83
|
${routes}
|
|
84
84
|
];`.trim();
|
|
85
85
|
if (content !== cache) {
|
|
86
|
-
|
|
86
|
+
FsUtils.writeFile(routesFilePath, content);
|
|
87
87
|
}
|
|
88
88
|
return content;
|
|
89
89
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
|
-
import {
|
|
2
|
+
import { FsUtils, SdLogger, PathUtils, SdFsWatcher, type TNormPath } from "@simplysm/sd-core-node";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { SdNgBundler } from "./
|
|
5
|
-
import { SdCliNgRoutesFileGenerator } from "./
|
|
6
|
-
import { SdCliCordova } from "../../entry/
|
|
7
|
-
import { SdCliElectron } from "../../entry/
|
|
8
|
-
import { type ISdClientPackageConfig, type ISdProjectConfig } from "../../types/
|
|
9
|
-
import { type INpmConfig } from "../../types/common-configs.
|
|
10
|
-
import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../../types/build.
|
|
4
|
+
import { SdNgBundler } from "./sd-ng.bundler";
|
|
5
|
+
import { SdCliNgRoutesFileGenerator } from "./sd-cli-ng-routes.file-generator";
|
|
6
|
+
import { SdCliCordova } from "../../entry/sd-cli-cordova";
|
|
7
|
+
import { SdCliElectron } from "../../entry/sd-cli-electron";
|
|
8
|
+
import { type ISdClientPackageConfig, type ISdProjectConfig } from "../../types/config.types";
|
|
9
|
+
import { type INpmConfig } from "../../types/common-configs.types";
|
|
10
|
+
import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../../types/build.types";
|
|
11
11
|
|
|
12
12
|
export class SdClientBuildRunner extends EventEmitter {
|
|
13
|
-
private _logger =
|
|
13
|
+
private _logger = SdLogger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
|
|
14
14
|
private _pkgConf: ISdClientPackageConfig;
|
|
15
15
|
private _npmConf: INpmConfig;
|
|
16
16
|
private _ngBundlers?: SdNgBundler[];
|
|
@@ -23,16 +23,16 @@ export class SdClientBuildRunner extends EventEmitter {
|
|
|
23
23
|
) {
|
|
24
24
|
super();
|
|
25
25
|
this._pkgConf = this._projConf.packages[path.basename(_pkgPath)] as ISdClientPackageConfig;
|
|
26
|
-
this._npmConf =
|
|
26
|
+
this._npmConf = FsUtils.readJson(path.resolve(_pkgPath, "package.json")) as INpmConfig;
|
|
27
27
|
|
|
28
28
|
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {}).mapMany((key) =>
|
|
29
|
-
|
|
29
|
+
FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
|
|
30
30
|
);
|
|
31
31
|
this._watchScopePathSet = new Set(
|
|
32
32
|
[
|
|
33
33
|
path.resolve(this._pkgPath, "../"),
|
|
34
|
-
...localUpdatePaths
|
|
35
|
-
].map((item) =>
|
|
34
|
+
...localUpdatePaths,
|
|
35
|
+
].map((item) => PathUtils.norm(item)),
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -45,13 +45,14 @@ export class SdClientBuildRunner extends EventEmitter {
|
|
|
45
45
|
|
|
46
46
|
public async buildAsync(): Promise<ISdBuildRunnerResult> {
|
|
47
47
|
this._debug("dist 초기화...");
|
|
48
|
-
|
|
48
|
+
FsUtils.remove(path.resolve(this._pkgPath, "dist"));
|
|
49
49
|
|
|
50
50
|
this._debug("GEN .config...");
|
|
51
51
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
52
|
-
|
|
52
|
+
FsUtils.writeFile(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
53
53
|
|
|
54
|
-
if (this._npmConf.dependencies && Object.keys(this._npmConf.dependencies)
|
|
54
|
+
if (this._npmConf.dependencies && Object.keys(this._npmConf.dependencies)
|
|
55
|
+
.includes("@angular/router")) {
|
|
55
56
|
this._debug(`GEN routes.ts...`);
|
|
56
57
|
SdCliNgRoutesFileGenerator.run(this._pkgPath, undefined, this._pkgConf.noLazyRoute);
|
|
57
58
|
}
|
|
@@ -68,16 +69,17 @@ export class SdClientBuildRunner extends EventEmitter {
|
|
|
68
69
|
this.emit("change");
|
|
69
70
|
|
|
70
71
|
this._debug("dist 초기화...");
|
|
71
|
-
|
|
72
|
+
FsUtils.remove(path.resolve(this._pkgPath, "dist"));
|
|
72
73
|
|
|
73
|
-
if (this._npmConf.dependencies && Object.keys(this._npmConf.dependencies)
|
|
74
|
+
if (this._npmConf.dependencies && Object.keys(this._npmConf.dependencies)
|
|
75
|
+
.includes("@angular/router")) {
|
|
74
76
|
this._debug(`WATCH GEN routes.ts...`);
|
|
75
77
|
SdCliNgRoutesFileGenerator.watch(this._pkgPath, this._pkgConf.noLazyRoute);
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
this._debug("GEN .config...");
|
|
79
81
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
80
|
-
|
|
82
|
+
FsUtils.writeFile(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
81
83
|
|
|
82
84
|
const result = await this._runAsync({ dev: !this._pkgConf.forceProductionMode });
|
|
83
85
|
const res: ISdBuildRunnerResult = {
|
|
@@ -89,26 +91,27 @@ export class SdClientBuildRunner extends EventEmitter {
|
|
|
89
91
|
|
|
90
92
|
this._debug("WATCH...");
|
|
91
93
|
let lastWatchFileSet = result.watchFileSet;
|
|
92
|
-
SdFsWatcher.watch(Array.from(this._watchScopePathSet))
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
SdFsWatcher.watch(Array.from(this._watchScopePathSet))
|
|
95
|
+
.onChange({ delay: 100 }, async (changeInfos) => {
|
|
96
|
+
const currentChangeInfos = changeInfos.filter((item) => lastWatchFileSet.has(item.path));
|
|
97
|
+
if (currentChangeInfos.length < 1) return;
|
|
98
|
+
|
|
99
|
+
this.emit("change");
|
|
100
|
+
|
|
101
|
+
for (const ngBundler of this._ngBundlers!) {
|
|
102
|
+
ngBundler.markForChanges(currentChangeInfos.map((item) => item.path));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const watchResult = await this._runAsync({ dev: !this._pkgConf.forceProductionMode });
|
|
106
|
+
const watchRes: ISdBuildRunnerResult = {
|
|
107
|
+
affectedFilePathSet: watchResult.affectedFileSet,
|
|
108
|
+
buildMessages: watchResult.buildMessages,
|
|
109
|
+
emitFileSet: watchResult.emitFileSet,
|
|
110
|
+
};
|
|
111
|
+
this.emit("complete", watchRes);
|
|
112
|
+
|
|
113
|
+
lastWatchFileSet = watchResult.watchFileSet;
|
|
114
|
+
});
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
private async _runAsync(opt: { dev: boolean }): Promise<{
|
|
@@ -142,19 +145,23 @@ export class SdClientBuildRunner extends EventEmitter {
|
|
|
142
145
|
pkgPath: this._pkgPath,
|
|
143
146
|
outputPath:
|
|
144
147
|
ngBundlerBuilderType === "web"
|
|
145
|
-
?
|
|
148
|
+
? PathUtils.norm(this._pkgPath, "dist")
|
|
146
149
|
: ngBundlerBuilderType === "electron" && !opt.dev
|
|
147
|
-
?
|
|
150
|
+
? PathUtils.norm(this._pkgPath, ".electron/src")
|
|
148
151
|
: ngBundlerBuilderType === "cordova" && !opt.dev
|
|
149
|
-
?
|
|
150
|
-
:
|
|
152
|
+
? PathUtils.norm(this._pkgPath, ".cordova/www")
|
|
153
|
+
: PathUtils.norm(this._pkgPath, "dist", ngBundlerBuilderType),
|
|
151
154
|
env: {
|
|
152
155
|
...this._pkgConf.env,
|
|
153
156
|
...this._pkgConf.builder?.[ngBundlerBuilderType]?.env,
|
|
154
157
|
},
|
|
155
158
|
external:
|
|
156
|
-
ngBundlerBuilderType === "electron"
|
|
157
|
-
|
|
159
|
+
ngBundlerBuilderType === "electron"
|
|
160
|
+
? (this._pkgConf.builder?.electron?.reinstallDependencies ?? [])
|
|
161
|
+
: [],
|
|
162
|
+
cordovaConfig: ngBundlerBuilderType === "cordova"
|
|
163
|
+
? this._pkgConf.builder!.cordova
|
|
164
|
+
: undefined,
|
|
158
165
|
watchScopePaths: Array.from(this._watchScopePathSet),
|
|
159
166
|
}),
|
|
160
167
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import esbuild from "esbuild";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { SdLogger } from "@simplysm/sd-core-node";
|
|
4
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
5
5
|
|
|
6
6
|
// import { InitialFileRecord } from "@angular/build/src/tools/esbuild/bundler-context";
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ interface InitialFileRecord {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export class SdNgBundlerContext {
|
|
18
|
-
readonly #logger =
|
|
18
|
+
readonly #logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundlerContext"]);
|
|
19
19
|
|
|
20
20
|
private _context?: esbuild.BuildContext;
|
|
21
21
|
|
|
@@ -48,7 +48,7 @@ export class SdNgBundlerContext {
|
|
|
48
48
|
|
|
49
49
|
this.#debug(`convert results...`);
|
|
50
50
|
|
|
51
|
-
const results =
|
|
51
|
+
const results = SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(esbuildResult, this._pkgPath);
|
|
52
52
|
|
|
53
53
|
const initialFiles = new Map<string, InitialFileRecord>();
|
|
54
54
|
|