@simplysm/sd-cli 12.5.21 → 12.5.23
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/{build-tools → entry}/SdCliCordova.d.ts +5 -6
- package/dist/{build-tools → entry}/SdCliCordova.js +117 -99
- package/dist/entry/SdCliCordova.js.map +1 -0
- package/dist/entry/SdCliElectron.d.ts +2 -2
- package/dist/entry/SdCliElectron.js +50 -40
- package/dist/entry/SdCliElectron.js.map +1 -1
- package/dist/entry/SdCliLocalUpdate.d.ts +1 -2
- package/dist/entry/SdCliLocalUpdate.js +26 -27
- package/dist/entry/SdCliLocalUpdate.js.map +1 -1
- package/dist/entry/SdCliProject.d.ts +1 -5
- package/dist/entry/SdCliProject.js +62 -288
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/index.d.ts +23 -20
- package/dist/index.js +23 -20
- package/dist/index.js.map +1 -1
- package/dist/pkg-builders/SdMultiBuildRunner.d.ts +21 -0
- package/dist/pkg-builders/SdMultiBuildRunner.js +174 -0
- package/dist/pkg-builders/SdMultiBuildRunner.js.map +1 -0
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.d.ts +4 -0
- package/dist/{build-tools → pkg-builders/client}/SdCliNgRoutesFileGenerator.js +7 -7
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +1 -0
- package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +20 -0
- package/dist/pkg-builders/client/SdClientBuildRunner.js +135 -0
- package/dist/pkg-builders/client/SdClientBuildRunner.js.map +1 -0
- package/dist/pkg-builders/client/SdNgBundler.d.ts +29 -0
- package/dist/{build-tools → pkg-builders/client}/SdNgBundler.js +107 -151
- package/dist/pkg-builders/client/SdNgBundler.js.map +1 -0
- package/dist/{build-tools → pkg-builders/client}/SdNgBundlerContext.d.ts +1 -2
- package/dist/{build-tools → pkg-builders/client}/SdNgBundlerContext.js +19 -45
- package/dist/pkg-builders/client/SdNgBundlerContext.js.map +1 -0
- package/dist/pkg-builders/client/createSdNgPlugin.d.ts +10 -0
- package/dist/{bundle-plugins/sdNgPlugin.js → pkg-builders/client/createSdNgPlugin.js} +32 -33
- package/dist/pkg-builders/client/createSdNgPlugin.js.map +1 -0
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.d.ts +5 -0
- package/dist/{build-tools → pkg-builders/lib}/SdCliIndexFileGenerator.js +11 -11
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +1 -0
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +16 -0
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +81 -0
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +1 -0
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +13 -0
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +89 -0
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +1 -0
- package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +14 -0
- package/dist/pkg-builders/lib/SdTsLibBuilder.js +54 -0
- package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +1 -0
- package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +17 -0
- package/dist/{builders/SdCliServerBuilder.js → pkg-builders/server/SdServerBuildRunner.js} +48 -53
- package/dist/pkg-builders/server/SdServerBuildRunner.js.map +1 -0
- package/dist/pkg-builders/server/SdServerBundler.d.ts +19 -0
- package/dist/{build-tools → pkg-builders/server}/SdServerBundler.js +25 -30
- package/dist/pkg-builders/server/SdServerBundler.js.map +1 -0
- package/dist/pkg-builders/server/createSdServerPlugin.d.ts +10 -0
- package/dist/pkg-builders/server/createSdServerPlugin.js +53 -0
- package/dist/pkg-builders/server/createSdServerPlugin.js.map +1 -0
- package/dist/sd-cli.js +61 -54
- package/dist/sd-cli.js.map +1 -1
- package/dist/ts-builder/SdTsCompileWorker.d.ts +9 -0
- package/dist/ts-builder/SdTsCompileWorker.js +16 -0
- package/dist/ts-builder/SdTsCompileWorker.js.map +1 -0
- package/dist/ts-builder/SdTsCompiler.d.ts +7 -0
- package/dist/ts-builder/SdTsCompiler.js +557 -0
- package/dist/ts-builder/SdTsCompiler.js.map +1 -0
- package/dist/types/build-plugin.type.d.ts +14 -0
- package/dist/types/build-plugin.type.js +2 -0
- package/dist/types/build-plugin.type.js.map +1 -0
- package/dist/types/build.type.d.ts +15 -0
- package/dist/types/build.type.js +2 -0
- package/dist/types/build.type.js.map +1 -0
- package/dist/types/common-configs.type.d.ts +22 -0
- package/dist/types/common-configs.type.js +2 -0
- package/dist/types/common-configs.type.js.map +1 -0
- package/dist/types/sd-configs.type.d.ts +99 -0
- package/dist/types/sd-configs.type.js +2 -0
- package/dist/types/sd-configs.type.js.map +1 -0
- package/dist/types/ts-compiler.type.d.ts +29 -0
- package/dist/types/ts-compiler.type.js +2 -0
- package/dist/types/ts-compiler.type.js.map +1 -0
- package/dist/types/workers.type.d.ts +49 -0
- package/dist/types/workers.type.js +2 -0
- package/dist/types/workers.type.js.map +1 -0
- package/dist/utils/SdCliConvertMessageUtil.d.ts +21 -0
- package/dist/utils/SdCliConvertMessageUtil.js +137 -0
- package/dist/utils/SdCliConvertMessageUtil.js.map +1 -0
- package/dist/workers/compile-worker.js +27 -0
- package/dist/workers/compile-worker.js.map +1 -0
- package/dist/workers/lint-worker.js +36 -0
- package/dist/workers/lint-worker.js.map +1 -0
- package/dist/workers/server-worker.d.ts +1 -0
- package/dist/workers/server-worker.js +49 -0
- package/dist/workers/server-worker.js.map +1 -0
- package/package.json +8 -11
- package/src/entry/SdCliCordova.ts +363 -0
- package/src/entry/SdCliElectron.ts +96 -69
- package/src/entry/SdCliLocalUpdate.ts +43 -44
- package/src/entry/SdCliProject.ts +72 -417
- package/src/index.ts +23 -20
- package/src/pkg-builders/SdMultiBuildRunner.ts +250 -0
- package/src/{build-tools → pkg-builders/client}/SdCliNgRoutesFileGenerator.ts +7 -7
- package/src/pkg-builders/client/SdClientBuildRunner.ts +191 -0
- package/src/{build-tools → pkg-builders/client}/SdNgBundler.ts +135 -190
- package/src/pkg-builders/client/SdNgBundlerContext.ts +111 -0
- package/src/{bundle-plugins/sdNgPlugin.ts → pkg-builders/client/createSdNgPlugin.ts} +43 -46
- package/src/{build-tools → pkg-builders/lib}/SdCliIndexFileGenerator.ts +11 -11
- package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +105 -0
- package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +128 -0
- package/src/pkg-builders/lib/SdTsLibBuilder.ts +69 -0
- package/src/{builders/SdCliServerBuilder.ts → pkg-builders/server/SdServerBuildRunner.ts} +66 -78
- package/src/{build-tools → pkg-builders/server}/SdServerBundler.ts +40 -41
- package/src/pkg-builders/server/createSdServerPlugin.ts +77 -0
- package/src/sd-cli.ts +197 -211
- package/src/ts-builder/SdTsCompileWorker.ts +21 -0
- package/src/ts-builder/SdTsCompiler.ts +775 -0
- package/src/types/build-plugin.type.ts +16 -0
- package/src/types/build.type.ts +17 -0
- package/src/types/common-configs.type.ts +27 -0
- package/src/types/sd-configs.type.ts +114 -0
- package/src/types/ts-compiler.type.ts +29 -0
- package/src/types/workers.type.ts +27 -0
- package/src/utils/SdCliConvertMessageUtil.ts +177 -0
- package/src/workers/compile-worker.ts +31 -0
- package/src/workers/lint-worker.ts +44 -0
- package/src/workers/server-worker.ts +52 -0
- package/tsconfig.json +7 -1
- package/dist/build-cluster.js +0 -201
- package/dist/build-cluster.js.map +0 -1
- package/dist/build-tools/SdCliCordova.js.map +0 -1
- package/dist/build-tools/SdCliIndexFileGenerator.d.ts +0 -5
- package/dist/build-tools/SdCliIndexFileGenerator.js.map +0 -1
- package/dist/build-tools/SdCliNgRoutesFileGenerator.d.ts +0 -4
- package/dist/build-tools/SdCliNgRoutesFileGenerator.js.map +0 -1
- package/dist/build-tools/SdLinter.d.ts +0 -5
- package/dist/build-tools/SdLinter.js +0 -49
- package/dist/build-tools/SdLinter.js.map +0 -1
- package/dist/build-tools/SdNgBundler.d.ts +0 -29
- package/dist/build-tools/SdNgBundler.js.map +0 -1
- package/dist/build-tools/SdNgBundlerContext.js.map +0 -1
- package/dist/build-tools/SdReactBundler.d.ts +0 -25
- package/dist/build-tools/SdReactBundler.js +0 -295
- package/dist/build-tools/SdReactBundler.js.map +0 -1
- package/dist/build-tools/SdReactBundlerContext.d.ts +0 -14
- package/dist/build-tools/SdReactBundlerContext.js +0 -59
- package/dist/build-tools/SdReactBundlerContext.js.map +0 -1
- package/dist/build-tools/SdServerBundler.d.ts +0 -20
- package/dist/build-tools/SdServerBundler.js.map +0 -1
- package/dist/build-tools/SdTsCompiler.d.ts +0 -34
- package/dist/build-tools/SdTsCompiler.js +0 -534
- package/dist/build-tools/SdTsCompiler.js.map +0 -1
- package/dist/build-tools/SdTsLibBundler.d.ts +0 -13
- package/dist/build-tools/SdTsLibBundler.js +0 -58
- package/dist/build-tools/SdTsLibBundler.js.map +0 -1
- package/dist/builders/SdCliClientBuilder.d.ts +0 -18
- package/dist/builders/SdCliClientBuilder.js +0 -172
- package/dist/builders/SdCliClientBuilder.js.map +0 -1
- package/dist/builders/SdCliJsLibLinter.d.ts +0 -13
- package/dist/builders/SdCliJsLibLinter.js +0 -60
- package/dist/builders/SdCliJsLibLinter.js.map +0 -1
- package/dist/builders/SdCliServerBuilder.d.ts +0 -15
- package/dist/builders/SdCliServerBuilder.js.map +0 -1
- package/dist/builders/SdCliTsLibBuilder.d.ts +0 -12
- package/dist/builders/SdCliTsLibBuilder.js +0 -90
- package/dist/builders/SdCliTsLibBuilder.js.map +0 -1
- package/dist/bundle-plugins/sdNgPlugin.d.ts +0 -16
- package/dist/bundle-plugins/sdNgPlugin.js.map +0 -1
- package/dist/bundle-plugins/sdReactPlugin.d.ts +0 -16
- package/dist/bundle-plugins/sdReactPlugin.js +0 -117
- package/dist/bundle-plugins/sdReactPlugin.js.map +0 -1
- package/dist/bundle-plugins/sdServerPlugin.d.ts +0 -16
- package/dist/bundle-plugins/sdServerPlugin.js +0 -63
- package/dist/bundle-plugins/sdServerPlugin.js.map +0 -1
- package/dist/commons.d.ts +0 -145
- package/dist/commons.js +0 -2
- package/dist/commons.js.map +0 -1
- package/dist/server-worker.js +0 -57
- package/dist/server-worker.js.map +0 -1
- package/dist/utils/SdCliBuildResultUtil.d.ts +0 -16
- package/dist/utils/SdCliBuildResultUtil.js +0 -54
- package/dist/utils/SdCliBuildResultUtil.js.map +0 -1
- package/src/build-cluster.ts +0 -212
- package/src/build-tools/SdCliCordova.ts +0 -340
- package/src/build-tools/SdLinter.ts +0 -65
- package/src/build-tools/SdNgBundlerContext.ts +0 -137
- package/src/build-tools/SdReactBundler.ts +0 -372
- package/src/build-tools/SdReactBundlerContext.ts +0 -71
- package/src/build-tools/SdTsCompiler.ts +0 -754
- package/src/build-tools/SdTsLibBundler.ts +0 -72
- package/src/builders/SdCliClientBuilder.ts +0 -233
- package/src/builders/SdCliJsLibLinter.ts +0 -72
- package/src/builders/SdCliTsLibBuilder.ts +0 -126
- package/src/bundle-plugins/sdReactPlugin.ts +0 -164
- package/src/bundle-plugins/sdServerPlugin.ts +0 -94
- package/src/commons.ts +0 -171
- package/src/server-worker.ts +0 -65
- package/src/utils/SdCliBuildResultUtil.ts +0 -63
- /package/dist/{build-cluster.d.ts → workers/compile-worker.d.ts} +0 -0
- /package/dist/{server-worker.d.ts → workers/lint-worker.d.ts} +0 -0
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { FsUtil, Logger, PathUtil, SdProcess } from "@simplysm/sd-core-node";
|
|
3
|
-
import {
|
|
4
|
-
INpmConfig,
|
|
5
|
-
ISdCliBuildClusterResMessage,
|
|
6
|
-
ISdCliConfig,
|
|
7
|
-
ISdCliPackageBuildResult,
|
|
8
|
-
ISdCliServerPackageConfig,
|
|
9
|
-
TSdCliPackageConfig,
|
|
10
|
-
} from "../commons";
|
|
11
|
-
import cp from "child_process";
|
|
12
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
13
|
-
import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
|
|
3
|
+
import { pathToFileURL } from "url";
|
|
14
4
|
import semver from "semver";
|
|
15
|
-
import {
|
|
5
|
+
import { NeverEntryError, StringUtil, Wait } from "@simplysm/sd-core-common";
|
|
16
6
|
import { SdStorage } from "@simplysm/sd-storage";
|
|
17
7
|
import { SdCliLocalUpdate } from "./SdCliLocalUpdate";
|
|
18
8
|
import xml2js from "xml2js";
|
|
9
|
+
import { SdMultiBuildRunner } from "../pkg-builders/SdMultiBuildRunner";
|
|
10
|
+
import { SdCliConvertMessageUtil } from "../utils/SdCliConvertMessageUtil";
|
|
11
|
+
import { ISdProjectConfig, TSdPackageConfig } from "../types/sd-configs.type";
|
|
12
|
+
import { INpmConfig } from "../types/common-configs.type";
|
|
13
|
+
import { ISdBuildMessage } from "../types/build.type";
|
|
19
14
|
|
|
20
15
|
export class SdCliProject {
|
|
21
|
-
|
|
16
|
+
static async watchAsync(opt: {
|
|
22
17
|
confFileRelPath: string;
|
|
23
18
|
optNames: string[];
|
|
24
19
|
pkgNames: string[];
|
|
@@ -30,7 +25,7 @@ export class SdCliProject {
|
|
|
30
25
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(
|
|
31
26
|
true,
|
|
32
27
|
opt.optNames,
|
|
33
|
-
) as
|
|
28
|
+
) as ISdProjectConfig;
|
|
34
29
|
|
|
35
30
|
if (projConf.localUpdates) {
|
|
36
31
|
logger.debug("로컬 라이브러리 업데이트 변경감지 시작...");
|
|
@@ -41,15 +36,16 @@ export class SdCliProject {
|
|
|
41
36
|
}
|
|
42
37
|
|
|
43
38
|
logger.debug("프로젝트 package.json 가져오기...");
|
|
44
|
-
const projNpmConf =
|
|
39
|
+
const projNpmConf = FsUtil.readJson(path.resolve(process.cwd(), "package.json")) as INpmConfig;
|
|
45
40
|
|
|
46
41
|
logger.debug("패키지 목록 구성...");
|
|
47
42
|
if (!projNpmConf.workspaces) {
|
|
48
43
|
throw new Error("프로젝트 package.json에 workspaces가 설정되어있지 않습니다.");
|
|
49
44
|
}
|
|
50
|
-
const allPkgPaths =
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
const allPkgPaths = projNpmConf.workspaces
|
|
46
|
+
.mapMany((item) => FsUtil.glob(item))
|
|
47
|
+
.filter((item) => !item.includes("."))
|
|
48
|
+
.map((item) => PathUtil.norm(item));
|
|
53
49
|
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
54
50
|
if (opt.pkgNames.length !== 0) {
|
|
55
51
|
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
@@ -63,209 +59,41 @@ export class SdCliProject {
|
|
|
63
59
|
throw new Error("패키지를 찾을 수 없습니다. (" + notExistsPkgs.join(", ") + ")");
|
|
64
60
|
}
|
|
65
61
|
|
|
66
|
-
logger.debug("빌드 프로세스
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
{
|
|
75
|
-
// server
|
|
76
|
-
pkgOrOpt?: { path: string; conf: ISdCliServerPackageConfig } | { port: number }; // persist
|
|
77
|
-
worker?: cp.ChildProcess; // persist
|
|
78
|
-
port?: number;
|
|
79
|
-
hasChanges: boolean;
|
|
80
|
-
hasClientChanges: boolean;
|
|
81
|
-
|
|
82
|
-
//client
|
|
83
|
-
pathProxy: Record<string, string | number | undefined>; // persist
|
|
84
|
-
// changeFilePaths: string[];
|
|
85
|
-
}
|
|
86
|
-
>();
|
|
87
|
-
cluster.on("message", (message: ISdCliBuildClusterResMessage) => {
|
|
88
|
-
if (message.type === "change") {
|
|
89
|
-
if (Array.from(busyReqCntMap.values()).every((v) => v === 0)) {
|
|
90
|
-
logger.log("빌드를 시작합니다...");
|
|
91
|
-
}
|
|
92
|
-
busyReqCntMap.set(
|
|
93
|
-
message.req.cmd + "|" + message.req.pkgPath,
|
|
94
|
-
(busyReqCntMap.get(message.req.cmd + "|" + message.req.pkgPath) ?? 0) + 1,
|
|
95
|
-
);
|
|
96
|
-
} else if (message.type === "complete") {
|
|
97
|
-
resultCache.delete("none");
|
|
98
|
-
for (const affectedFilePath of message.result!.affectedFilePaths) {
|
|
99
|
-
if (PathUtil.isChildPath(affectedFilePath, message.req.pkgPath)) {
|
|
100
|
-
resultCache.delete(affectedFilePath);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
for (const buildResult of message.result!.buildResults) {
|
|
105
|
-
// if (buildResult.filePath == null || PathUtil.isChildPath(buildResult.filePath, message.req.pkgPath)) {
|
|
106
|
-
const cacheItem = resultCache.getOrCreate(buildResult.filePath ?? "none", []);
|
|
107
|
-
cacheItem.push(buildResult);
|
|
108
|
-
// }
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const pkgConf = message.req.projConf.packages[path.basename(message.req.pkgPath)]!;
|
|
112
|
-
|
|
113
|
-
if (pkgConf.type === "server") {
|
|
114
|
-
const pkgName = path.basename(message.req.pkgPath);
|
|
115
|
-
const serverInfo = serverInfoMap.getOrCreate(pkgName, {
|
|
116
|
-
hasChanges: true,
|
|
117
|
-
hasClientChanges: false,
|
|
118
|
-
pathProxy: {},
|
|
119
|
-
// changeFilePaths: []
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const serverPkgConf = projConf.packages[pkgName] as ISdCliServerPackageConfig;
|
|
123
|
-
serverInfo.pkgOrOpt = {
|
|
124
|
-
path: message.req.pkgPath,
|
|
125
|
-
conf: serverPkgConf,
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
serverInfo.hasChanges = true;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (pkgConf.type === "client") {
|
|
132
|
-
const pkgName = path.basename(message.req.pkgPath);
|
|
133
|
-
|
|
134
|
-
if (pkgConf.server !== undefined) {
|
|
135
|
-
const serverInfo = serverInfoMap.getOrCreate(
|
|
136
|
-
typeof pkgConf.server === "string" ? pkgConf.server : pkgConf.server.port.toString(),
|
|
137
|
-
{
|
|
138
|
-
hasChanges: true,
|
|
139
|
-
hasClientChanges: false,
|
|
140
|
-
pathProxy: {},
|
|
141
|
-
// changeFilePaths: []
|
|
142
|
-
},
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
if (typeof pkgConf.server !== "string") {
|
|
146
|
-
serverInfo.pkgOrOpt = pkgConf.server;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
serverInfo.pathProxy[pkgName] = path.resolve(message.req.pkgPath, "dist");
|
|
150
|
-
serverInfo.pathProxy["node_modules"] = path.resolve(process.cwd(), "node_modules");
|
|
151
|
-
// serverInfo.changeFilePaths.push(...message.result!.affectedFilePaths);
|
|
152
|
-
|
|
153
|
-
serverInfo.hasClientChanges = true;
|
|
154
|
-
// serverInfo.worker?.send({type: "broadcastReload"});
|
|
155
|
-
} else {
|
|
156
|
-
const serverInfo = serverInfoMap.getOrCreate(pkgName, {
|
|
157
|
-
hasChanges: true,
|
|
158
|
-
hasClientChanges: false,
|
|
159
|
-
pathProxy: {},
|
|
160
|
-
// changeFilePaths: []
|
|
161
|
-
});
|
|
162
|
-
// serverInfo.port = message.result!.port;
|
|
163
|
-
// serverInfo.changeFilePaths.push(...message.result!.affectedFilePaths);
|
|
164
|
-
|
|
165
|
-
serverInfo.hasClientChanges = true;
|
|
166
|
-
// serverInfo.worker?.send({type: "broadcastReload"});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
setTimeout(async () => {
|
|
171
|
-
busyReqCntMap.set(
|
|
172
|
-
message.req.cmd + "|" + message.req.pkgPath,
|
|
173
|
-
(busyReqCntMap.get(message.req.cmd + "|" + message.req.pkgPath) ?? 0) - 1,
|
|
174
|
-
);
|
|
175
|
-
logger.debug("남아있는 예약 빌드", busyReqCntMap);
|
|
176
|
-
if (Array.from(busyReqCntMap.values()).every((v) => v === 0)) {
|
|
177
|
-
for (const serverPkgNameOrPort of serverInfoMap.keys()) {
|
|
178
|
-
const serverInfo = serverInfoMap.get(serverPkgNameOrPort)!;
|
|
179
|
-
if (serverInfo.pkgOrOpt && serverInfo.hasChanges) {
|
|
180
|
-
logger.debug("서버 재시작...");
|
|
181
|
-
try {
|
|
182
|
-
const restartServerResult = await this._restartServerAsync(serverInfo.pkgOrOpt, serverInfo.worker);
|
|
183
|
-
serverInfo.worker = restartServerResult.worker;
|
|
184
|
-
serverInfo.port = restartServerResult.port;
|
|
185
|
-
serverInfo.hasChanges = false;
|
|
186
|
-
} catch (err) {
|
|
187
|
-
logger.error(err);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (serverInfo.worker) {
|
|
192
|
-
logger.debug("클라이언트 설정...");
|
|
193
|
-
serverInfo.worker.send({
|
|
194
|
-
type: "setPathProxy",
|
|
195
|
-
pathProxy: serverInfo.pathProxy,
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
if (serverInfo.hasClientChanges) {
|
|
199
|
-
logger.debug("클라이언트 새로고침...");
|
|
200
|
-
serverInfo.worker.send({ type: "broadcastReload" });
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const clientPaths: string[] = [];
|
|
206
|
-
for (const serverInfo of serverInfoMap.values()) {
|
|
207
|
-
if (Object.keys(serverInfo.pathProxy).length > 0) {
|
|
208
|
-
for (const proxyPath of Object.keys(serverInfo.pathProxy)) {
|
|
209
|
-
if (proxyPath === "node_modules") continue;
|
|
210
|
-
clientPaths.push(`http://localhost:${serverInfo.port}/${proxyPath}/`);
|
|
211
|
-
}
|
|
212
|
-
} else {
|
|
213
|
-
clientPaths.push(`http://localhost:${serverInfo.port}/`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (clientPaths.length > 0) {
|
|
217
|
-
logger.info("클라이언트 개발 서버 접속 주소\n" + clientPaths.join("\n"));
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
const buildResults = Array.from(resultCache.values()).mapMany();
|
|
221
|
-
this._logging(buildResults, logger);
|
|
222
|
-
}
|
|
223
|
-
}, 300);
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
logger.debug("빌드 프로세스 명령 전송...");
|
|
228
|
-
busyReqCntMap.set("all", (busyReqCntMap.get("all") ?? 0) + 1);
|
|
229
|
-
logger.log("빌드를 시작합니다...");
|
|
62
|
+
logger.debug("빌드 프로세스 시작...");
|
|
63
|
+
const multiBuildRunner = new SdMultiBuildRunner()
|
|
64
|
+
.on("change", () => {
|
|
65
|
+
logger.debug("빌드를 시작합니다...");
|
|
66
|
+
})
|
|
67
|
+
.on("complete", (messages) => {
|
|
68
|
+
this.#logging(messages, logger);
|
|
69
|
+
});
|
|
230
70
|
|
|
231
71
|
await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
232
|
-
await
|
|
233
|
-
|
|
234
|
-
"watch",
|
|
235
|
-
projConf,
|
|
72
|
+
await multiBuildRunner.runAsync({
|
|
73
|
+
cmd: "watch",
|
|
236
74
|
pkgPath,
|
|
237
|
-
|
|
238
|
-
);
|
|
75
|
+
projConf: projConf,
|
|
76
|
+
});
|
|
239
77
|
});
|
|
240
|
-
|
|
241
|
-
busyReqCntMap.set("all", (busyReqCntMap.get("all") ?? 0) - 1);
|
|
242
|
-
if (Array.from(busyReqCntMap.values()).every((v) => v === 0)) {
|
|
243
|
-
const buildResults = Array.from(resultCache.values()).mapMany();
|
|
244
|
-
this._logging(buildResults, logger);
|
|
245
|
-
}
|
|
246
78
|
}
|
|
247
79
|
|
|
248
|
-
|
|
249
|
-
confFileRelPath: string;
|
|
250
|
-
optNames: string[];
|
|
251
|
-
pkgNames: string[];
|
|
252
|
-
}): Promise<void> {
|
|
80
|
+
static async buildAsync(opt: { confFileRelPath: string; optNames: string[]; pkgNames: string[] }): Promise<void> {
|
|
253
81
|
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "buildAsync"]);
|
|
254
82
|
|
|
255
83
|
logger.debug("프로젝트 설정 가져오기...");
|
|
256
84
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(
|
|
257
85
|
false,
|
|
258
86
|
opt.optNames,
|
|
259
|
-
) as
|
|
87
|
+
) as ISdProjectConfig;
|
|
260
88
|
|
|
261
89
|
logger.debug("프로젝트 package.json 가져오기...");
|
|
262
|
-
const projNpmConf =
|
|
90
|
+
const projNpmConf = FsUtil.readJson(path.resolve(process.cwd(), "package.json")) as INpmConfig;
|
|
263
91
|
|
|
264
92
|
logger.debug("패키지 목록 구성...");
|
|
265
93
|
if (!projNpmConf.workspaces) {
|
|
266
94
|
throw new Error("프로젝트 package.json에 workspaces가 설정되어있지 않습니다.");
|
|
267
95
|
}
|
|
268
|
-
const allPkgPaths =
|
|
96
|
+
const allPkgPaths = projNpmConf.workspaces.mapMany((item) => FsUtil.glob(item)).map((item) => PathUtil.norm(item));
|
|
269
97
|
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
270
98
|
if (opt.pkgNames.length !== 0) {
|
|
271
99
|
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
@@ -274,29 +102,17 @@ export class SdCliProject {
|
|
|
274
102
|
logger.debug("프로젝트 및 패키지 버전 설정...");
|
|
275
103
|
await this._upgradeVersionAsync(projNpmConf, allPkgPaths);
|
|
276
104
|
|
|
277
|
-
logger.debug("빌드 프로세스
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
logger.debug("빌드 프로세스 명령 전달...");
|
|
281
|
-
const results = (
|
|
282
|
-
await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
283
|
-
/*const pkgConf = projConf.packages[path.basename(pkgPath)]!;
|
|
284
|
-
if (pkgConf.type === "client") {
|
|
285
|
-
const builderKeys = Object.keys(pkgConf.builder ?? {web: {}});
|
|
286
|
-
return (await builderKeys.parallelAsync(async (builderKey) => {
|
|
287
|
-
return await this._runCommandAsync(cluster, "build", projConf, pkgPath, builderKey);
|
|
288
|
-
})).mapMany();
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
}*/
|
|
292
|
-
return await this._runCommandAsync(cluster, "build", projConf, pkgPath);
|
|
293
|
-
})
|
|
294
|
-
).mapMany();
|
|
295
|
-
|
|
296
|
-
logger.debug("빌드 프로세스 닫기...");
|
|
297
|
-
this._closeCluster(cluster);
|
|
105
|
+
logger.debug("빌드 프로세스 시작...");
|
|
106
|
+
const parallelBuildRunner = new SdMultiBuildRunner();
|
|
298
107
|
|
|
299
|
-
|
|
108
|
+
const messages = await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
109
|
+
return await parallelBuildRunner.runAsync({
|
|
110
|
+
cmd: "build",
|
|
111
|
+
pkgPath,
|
|
112
|
+
projConf: projConf,
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
this.#logging(messages.mapMany(), logger);
|
|
300
116
|
}
|
|
301
117
|
|
|
302
118
|
public static async publishAsync(opt: {
|
|
@@ -311,10 +127,10 @@ export class SdCliProject {
|
|
|
311
127
|
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(
|
|
312
128
|
false,
|
|
313
129
|
opt.optNames,
|
|
314
|
-
) as
|
|
130
|
+
) as ISdProjectConfig;
|
|
315
131
|
|
|
316
132
|
logger.debug("프로젝트 package.json 가져오기...");
|
|
317
|
-
const projNpmConf =
|
|
133
|
+
const projNpmConf = FsUtil.readJson(path.resolve(process.cwd(), "package.json")) as INpmConfig;
|
|
318
134
|
|
|
319
135
|
if (opt.noBuild) {
|
|
320
136
|
logger.warn("빌드하지 않고, 배포하는것은 상당히 위험합니다.");
|
|
@@ -334,9 +150,10 @@ export class SdCliProject {
|
|
|
334
150
|
if (!projNpmConf.workspaces) {
|
|
335
151
|
throw new Error("프로젝트 package.json에 workspaces가 설정되어있지 않습니다.");
|
|
336
152
|
}
|
|
337
|
-
const allPkgPaths =
|
|
338
|
-
|
|
339
|
-
|
|
153
|
+
const allPkgPaths = projNpmConf.workspaces
|
|
154
|
+
.mapMany((item) => FsUtil.glob(item))
|
|
155
|
+
.filter((item) => !item.includes("."))
|
|
156
|
+
.map((item) => PathUtil.norm(item));
|
|
340
157
|
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
341
158
|
if (opt.pkgNames.length !== 0) {
|
|
342
159
|
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
@@ -347,20 +164,18 @@ export class SdCliProject {
|
|
|
347
164
|
|
|
348
165
|
// 빌드
|
|
349
166
|
if (!opt.noBuild) {
|
|
350
|
-
logger.debug("빌드 프로세스
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
logger.debug("빌드 프로세스 닫기...");
|
|
361
|
-
this._closeCluster(cluster);
|
|
167
|
+
logger.debug("빌드 프로세스 시작...");
|
|
168
|
+
const parallelBuildRunner = new SdMultiBuildRunner();
|
|
169
|
+
|
|
170
|
+
const messages = await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
171
|
+
return await parallelBuildRunner.runAsync({
|
|
172
|
+
cmd: "build",
|
|
173
|
+
pkgPath,
|
|
174
|
+
projConf: projConf,
|
|
175
|
+
});
|
|
176
|
+
});
|
|
362
177
|
|
|
363
|
-
this.
|
|
178
|
+
this.#logging(messages.mapMany(), logger);
|
|
364
179
|
}
|
|
365
180
|
|
|
366
181
|
// GIT 사용중일경우, 새 버전 커밋 및 TAG 생성
|
|
@@ -411,11 +226,11 @@ export class SdCliProject {
|
|
|
411
226
|
logger.info(`모든 배포가 완료되었습니다. (v${projNpmConf.version})`);
|
|
412
227
|
}
|
|
413
228
|
|
|
414
|
-
private static async _publishPkgAsync(pkgPath: string, pkgPubConf:
|
|
229
|
+
private static async _publishPkgAsync(pkgPath: string, pkgPubConf: TSdPackageConfig["publish"]): Promise<void> {
|
|
415
230
|
if (pkgPubConf === "npm") {
|
|
416
231
|
await SdProcess.spawnAsync("yarn npm publish --access public", { cwd: pkgPath });
|
|
417
232
|
} else if (pkgPubConf?.type === "local-directory") {
|
|
418
|
-
const pkgNpmConf =
|
|
233
|
+
const pkgNpmConf = FsUtil.readJson(path.resolve(pkgPath, "package.json")) as INpmConfig;
|
|
419
234
|
|
|
420
235
|
const targetRootPath = pkgPubConf.path.replace(/%([^%]*)%/g, (item) => {
|
|
421
236
|
const envName = item.replace(/%/g, "");
|
|
@@ -428,16 +243,16 @@ export class SdCliProject {
|
|
|
428
243
|
return process.env[envName] ?? item;
|
|
429
244
|
});
|
|
430
245
|
|
|
431
|
-
const filePaths =
|
|
246
|
+
const filePaths = FsUtil.glob(path.resolve(pkgPath, "dist", "**", "*"), {
|
|
432
247
|
dot: true,
|
|
433
248
|
nodir: true,
|
|
434
249
|
});
|
|
435
250
|
|
|
436
|
-
|
|
251
|
+
for (const filePath of filePaths) {
|
|
437
252
|
const relativeFilePath = path.relative(path.resolve(pkgPath, "dist"), filePath);
|
|
438
253
|
const targetPath = PathUtil.posix(targetRootPath, relativeFilePath);
|
|
439
|
-
|
|
440
|
-
}
|
|
254
|
+
FsUtil.copy(filePath, targetPath);
|
|
255
|
+
}
|
|
441
256
|
} else if (pkgPubConf?.type === "ftp" || pkgPubConf?.type === "ftps" || pkgPubConf?.type === "sftp") {
|
|
442
257
|
const ftp = await SdStorage.connectAsync(pkgPubConf.type, {
|
|
443
258
|
host: pkgPubConf.host,
|
|
@@ -470,8 +285,8 @@ export class SdCliProject {
|
|
|
470
285
|
const newVersion = semver.inc(projNpmConf.version, "patch")!;
|
|
471
286
|
projNpmConf.version = newVersion;
|
|
472
287
|
|
|
473
|
-
const pkgNames =
|
|
474
|
-
const pkgNpmConf =
|
|
288
|
+
const pkgNames = allPkgPaths.map((pkgPath) => {
|
|
289
|
+
const pkgNpmConf = FsUtil.readJson(path.resolve(pkgPath, "package.json"));
|
|
475
290
|
return pkgNpmConf.name;
|
|
476
291
|
});
|
|
477
292
|
|
|
@@ -489,12 +304,12 @@ export class SdCliProject {
|
|
|
489
304
|
updateDepVersion(projNpmConf.peerDependencies);
|
|
490
305
|
|
|
491
306
|
const projNpmConfFilePath = path.resolve(process.cwd(), "package.json");
|
|
492
|
-
|
|
307
|
+
FsUtil.writeJson(projNpmConfFilePath, projNpmConf, { space: 2 });
|
|
493
308
|
|
|
494
309
|
// 각 패키지 package.json 버전 설정
|
|
495
310
|
await allPkgPaths.parallelAsync(async (pkgPath) => {
|
|
496
311
|
const pkgNpmConfFilePath = path.resolve(pkgPath, "package.json");
|
|
497
|
-
const pkgNpmConf =
|
|
312
|
+
const pkgNpmConf = FsUtil.readJson(pkgNpmConfFilePath);
|
|
498
313
|
pkgNpmConf.version = newVersion;
|
|
499
314
|
|
|
500
315
|
updateDepVersion(pkgNpmConf.dependencies);
|
|
@@ -502,24 +317,22 @@ export class SdCliProject {
|
|
|
502
317
|
updateDepVersion(pkgNpmConf.devDependencies);
|
|
503
318
|
updateDepVersion(pkgNpmConf.peerDependencies);
|
|
504
319
|
|
|
505
|
-
|
|
320
|
+
FsUtil.writeJson(pkgNpmConfFilePath, pkgNpmConf, { space: 2 });
|
|
506
321
|
|
|
507
322
|
if (FsUtil.exists(path.resolve(pkgPath, "plugin.xml"))) {
|
|
508
323
|
const cordovaPluginConfFilePath = path.resolve(pkgPath, "plugin.xml");
|
|
509
|
-
const cordovaPluginConfXml = await xml2js.parseStringPromise(
|
|
510
|
-
await FsUtil.readFileAsync(cordovaPluginConfFilePath),
|
|
511
|
-
);
|
|
324
|
+
const cordovaPluginConfXml = await xml2js.parseStringPromise(FsUtil.readFile(cordovaPluginConfFilePath));
|
|
512
325
|
cordovaPluginConfXml.plugin.$.version = newVersion;
|
|
513
326
|
|
|
514
|
-
|
|
327
|
+
FsUtil.writeFile(cordovaPluginConfFilePath, new xml2js.Builder().buildObject(cordovaPluginConfXml));
|
|
515
328
|
}
|
|
516
329
|
});
|
|
517
330
|
}
|
|
518
331
|
|
|
519
|
-
|
|
332
|
+
static #logging(buildResults: ISdBuildMessage[], logger: Logger): void {
|
|
520
333
|
const messageMap = buildResults.toSetMap(
|
|
521
334
|
(item) => item.severity,
|
|
522
|
-
(item) =>
|
|
335
|
+
(item) => SdCliConvertMessageUtil.getBuildMessageString(item),
|
|
523
336
|
);
|
|
524
337
|
|
|
525
338
|
if (messageMap.has("message")) {
|
|
@@ -537,162 +350,4 @@ export class SdCliProject {
|
|
|
537
350
|
|
|
538
351
|
logger.info("모든 빌드가 완료되었습니다.");
|
|
539
352
|
}
|
|
540
|
-
|
|
541
|
-
// piscina 사용시 ts파일을 못찾으므로 그냥 이렇게..
|
|
542
|
-
private static async _prepareClusterAsync(): Promise<cp.ChildProcess> {
|
|
543
|
-
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "_runBuildClusterAsync"]);
|
|
544
|
-
return await new Promise<cp.ChildProcess>((resolve, reject) => {
|
|
545
|
-
const cluster = cp.fork(fileURLToPath(import.meta.resolve("../build-cluster")), [], {
|
|
546
|
-
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
547
|
-
env: {
|
|
548
|
-
...process.env,
|
|
549
|
-
// "NG_BUILD_PARALLEL_TS": "0"
|
|
550
|
-
},
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
cluster.stdout!.pipe(process.stdout);
|
|
554
|
-
cluster.stderr!.pipe(process.stderr);
|
|
555
|
-
|
|
556
|
-
cluster.on("exit", (code) => {
|
|
557
|
-
if (code != null && code !== 0) {
|
|
558
|
-
const err = new Error(`오류와 함께 닫힘 (${code})`);
|
|
559
|
-
logger.error(err);
|
|
560
|
-
reject(err);
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
cluster.on("error", (err) => {
|
|
566
|
-
logger.error(err);
|
|
567
|
-
reject(err);
|
|
568
|
-
});
|
|
569
|
-
|
|
570
|
-
cluster.on("message", (message) => {
|
|
571
|
-
if (message === "ready") {
|
|
572
|
-
logger.debug("빌드 클러스터 프로세스가 준비되었습니다.");
|
|
573
|
-
resolve(cluster);
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
private static async _runCommandAsync(
|
|
580
|
-
cluster: cp.ChildProcess,
|
|
581
|
-
cmd: "watch",
|
|
582
|
-
projConf: ISdCliConfig,
|
|
583
|
-
pkgPath: string,
|
|
584
|
-
execArgs: string[],
|
|
585
|
-
): Promise<void>;
|
|
586
|
-
private static async _runCommandAsync(
|
|
587
|
-
cluster: cp.ChildProcess,
|
|
588
|
-
cmd: "build",
|
|
589
|
-
projConf: ISdCliConfig,
|
|
590
|
-
pkgPath: string,
|
|
591
|
-
): Promise<ISdCliPackageBuildResult[]>;
|
|
592
|
-
private static async _runCommandAsync(
|
|
593
|
-
cluster: cp.ChildProcess,
|
|
594
|
-
cmd: "watch" | "build",
|
|
595
|
-
projConf: ISdCliConfig,
|
|
596
|
-
pkgPath: string,
|
|
597
|
-
execArgs?: string[],
|
|
598
|
-
): Promise<ISdCliPackageBuildResult[] | void> {
|
|
599
|
-
return await new Promise<ISdCliPackageBuildResult[] | void>((resolve) => {
|
|
600
|
-
const cb = (message: ISdCliBuildClusterResMessage): void => {
|
|
601
|
-
if (cmd === "watch" && message.type === "ready" && message.req.cmd === cmd && message.req.pkgPath === pkgPath) {
|
|
602
|
-
cluster.off("message", cb);
|
|
603
|
-
resolve();
|
|
604
|
-
} else if (
|
|
605
|
-
cmd === "build" &&
|
|
606
|
-
message.type === "complete" &&
|
|
607
|
-
message.req.cmd === cmd &&
|
|
608
|
-
message.req.pkgPath === pkgPath
|
|
609
|
-
) {
|
|
610
|
-
cluster.off("message", cb);
|
|
611
|
-
resolve(message.result?.buildResults);
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
cluster.on("message", cb);
|
|
615
|
-
|
|
616
|
-
cluster.send({
|
|
617
|
-
cmd,
|
|
618
|
-
projConf,
|
|
619
|
-
pkgPath,
|
|
620
|
-
execArgs,
|
|
621
|
-
});
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
private static _closeCluster(cluster: cp.ChildProcess): void {
|
|
626
|
-
cluster.kill("SIGKILL");
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
private static async _restartServerAsync(
|
|
630
|
-
pkgOrOpt:
|
|
631
|
-
| { path: string; conf: ISdCliServerPackageConfig }
|
|
632
|
-
| {
|
|
633
|
-
port: number;
|
|
634
|
-
},
|
|
635
|
-
prevServerProcess?: cp.ChildProcess,
|
|
636
|
-
): Promise<{
|
|
637
|
-
worker: cp.ChildProcess;
|
|
638
|
-
port: number;
|
|
639
|
-
}> {
|
|
640
|
-
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "_restartServerAsync"]);
|
|
641
|
-
|
|
642
|
-
if (prevServerProcess) {
|
|
643
|
-
prevServerProcess.kill("SIGKILL");
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
const npmConf =
|
|
647
|
-
"path" in pkgOrOpt
|
|
648
|
-
? ((await FsUtil.readJsonAsync(path.resolve(pkgOrOpt.path, "package.json"))) as INpmConfig)
|
|
649
|
-
: undefined;
|
|
650
|
-
|
|
651
|
-
return await new Promise<{
|
|
652
|
-
worker: cp.ChildProcess;
|
|
653
|
-
port: number;
|
|
654
|
-
}>((resolve, reject) => {
|
|
655
|
-
const worker = cp.fork(
|
|
656
|
-
fileURLToPath(import.meta.resolve("../server-worker")),
|
|
657
|
-
[JsonConvert.stringify("path" in pkgOrOpt ? pkgOrOpt.path : pkgOrOpt)],
|
|
658
|
-
{
|
|
659
|
-
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
660
|
-
env: {
|
|
661
|
-
...process.env,
|
|
662
|
-
NODE_ENV: "development",
|
|
663
|
-
TZ: "Asia/Seoul",
|
|
664
|
-
SD_VERSION: npmConf?.version ?? "serverless",
|
|
665
|
-
...("path" in pkgOrOpt ? pkgOrOpt.conf.env : {}),
|
|
666
|
-
},
|
|
667
|
-
},
|
|
668
|
-
);
|
|
669
|
-
|
|
670
|
-
worker.stdout!.pipe(process.stdout);
|
|
671
|
-
worker.stderr!.pipe(process.stderr);
|
|
672
|
-
|
|
673
|
-
worker.on("exit", (code) => {
|
|
674
|
-
if (code != null && code !== 0) {
|
|
675
|
-
const err = new Error(`오류와 함께 닫힘 (${code})`);
|
|
676
|
-
logger.error(err);
|
|
677
|
-
reject(err);
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
|
-
|
|
682
|
-
worker.on("error", (err) => {
|
|
683
|
-
logger.error(err);
|
|
684
|
-
reject(err);
|
|
685
|
-
});
|
|
686
|
-
|
|
687
|
-
worker.on("message", (message: any) => {
|
|
688
|
-
if ("port" in message) {
|
|
689
|
-
logger.debug("서버가 시작되었습니다.");
|
|
690
|
-
resolve({
|
|
691
|
-
worker,
|
|
692
|
-
port: message.port,
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
353
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./build-tools/SdCliIndexFileGenerator";
|
|
3
|
-
export * from "./build-tools/SdCliNgRoutesFileGenerator";
|
|
4
|
-
export * from "./build-tools/SdLinter";
|
|
5
|
-
export * from "./build-tools/SdNgBundler";
|
|
6
|
-
export * from "./build-tools/SdNgBundlerContext";
|
|
7
|
-
export * from "./build-tools/SdReactBundler";
|
|
8
|
-
export * from "./build-tools/SdReactBundlerContext";
|
|
9
|
-
export * from "./build-tools/SdServerBundler";
|
|
10
|
-
export * from "./build-tools/SdTsCompiler";
|
|
11
|
-
export * from "./build-tools/SdTsLibBundler";
|
|
12
|
-
export * from "./builders/SdCliClientBuilder";
|
|
13
|
-
export * from "./builders/SdCliJsLibLinter";
|
|
14
|
-
export * from "./builders/SdCliServerBuilder";
|
|
15
|
-
export * from "./builders/SdCliTsLibBuilder";
|
|
16
|
-
export * from "./bundle-plugins/sdNgPlugin";
|
|
17
|
-
export * from "./bundle-plugins/sdReactPlugin";
|
|
18
|
-
export * from "./bundle-plugins/sdServerPlugin";
|
|
19
|
-
export * from "./commons";
|
|
1
|
+
export * from "./entry/SdCliCordova";
|
|
20
2
|
export * from "./entry/SdCliElectron";
|
|
21
3
|
export * from "./entry/SdCliLocalUpdate";
|
|
22
4
|
export * from "./entry/SdCliProject";
|
|
23
|
-
export * from "./
|
|
5
|
+
export * from "./pkg-builders/client/createSdNgPlugin";
|
|
6
|
+
export * from "./pkg-builders/client/SdClientBuildRunner";
|
|
7
|
+
export * from "./pkg-builders/client/SdCliNgRoutesFileGenerator";
|
|
8
|
+
export * from "./pkg-builders/client/SdNgBundler";
|
|
9
|
+
export * from "./pkg-builders/client/SdNgBundlerContext";
|
|
10
|
+
export * from "./pkg-builders/lib/SdCliIndexFileGenerator";
|
|
11
|
+
export * from "./pkg-builders/lib/SdJsLibBuildRunner";
|
|
12
|
+
export * from "./pkg-builders/lib/SdTsLibBuilder";
|
|
13
|
+
export * from "./pkg-builders/lib/SdTsLibBuildRunner";
|
|
14
|
+
export * from "./pkg-builders/SdMultiBuildRunner";
|
|
15
|
+
export * from "./pkg-builders/server/createSdServerPlugin";
|
|
16
|
+
export * from "./pkg-builders/server/SdServerBuildRunner";
|
|
17
|
+
export * from "./pkg-builders/server/SdServerBundler";
|
|
18
|
+
export * from "./ts-builder/SdTsCompiler";
|
|
19
|
+
export * from "./ts-builder/SdTsCompileWorker";
|
|
20
|
+
export * from "./types/build-plugin.type";
|
|
21
|
+
export * from "./types/build.type";
|
|
22
|
+
export * from "./types/common-configs.type";
|
|
23
|
+
export * from "./types/sd-configs.type";
|
|
24
|
+
export * from "./types/ts-compiler.type";
|
|
25
|
+
export * from "./types/workers.type";
|
|
26
|
+
export * from "./utils/SdCliConvertMessageUtil";
|
|
24
27
|
export * from "./utils/SdCliPerformanceTime";
|