@simplysm/sd-cli 11.1.44 → 11.1.45
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-cluster.js +108 -102
- package/dist/build-cluster.js.map +1 -1
- package/dist/build-tools/SdCliCordova.js.map +1 -1
- package/dist/build-tools/SdCliIndexFileGenerator.js.map +1 -1
- package/dist/build-tools/SdCliNgRoutesFileGenerator.js.map +1 -1
- package/dist/build-tools/SdLinter.js.map +1 -1
- package/dist/build-tools/SdNgBundler.js +4 -4
- package/dist/build-tools/SdNgBundler.js.map +1 -1
- package/dist/build-tools/SdNgBundlerContext.js.map +1 -1
- package/dist/build-tools/SdServerBundler.js +1 -1
- package/dist/build-tools/SdServerBundler.js.map +1 -1
- package/dist/build-tools/SdTsCompiler.js.map +1 -1
- package/dist/builders/SdCliClientBuilder.js.map +1 -1
- package/dist/builders/SdCliServerBuilder.js.map +1 -1
- package/dist/builders/SdCliTsLibBuilder.js +1 -1
- package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
- package/dist/bundle-plugins/sdNgPlugin.js +2 -2
- package/dist/bundle-plugins/sdNgPlugin.js.map +1 -1
- package/dist/bundle-plugins/sdServerPlugin.js.map +1 -1
- package/dist/entry/SdCliElectron.js.map +1 -1
- package/dist/entry/SdCliLocalUpdate.js.map +1 -1
- package/dist/entry/SdCliProject.js +9 -8
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/sd-cli.js.map +1 -1
- package/dist/server-worker.js.map +1 -1
- package/dist/utils/SdCliBuildResultUtil.js.map +1 -1
- package/package.json +6 -6
- package/src/build-cluster.ts +136 -130
- package/src/builders/SdCliTsLibBuilder.ts +1 -1
- package/src/entry/SdCliProject.ts +21 -8
package/src/build-cluster.ts
CHANGED
|
@@ -50,140 +50,146 @@ else {
|
|
|
50
50
|
const message = JSON.parse(process.env["SD_CLUSTER_MESSAGE"]!) as ISdCliBuildClusterReqMessage;
|
|
51
51
|
const pkgConf = message.projConf.packages[path.basename(message.pkgPath)]!;
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
try {
|
|
54
|
+
if (message.cmd === "watch") {
|
|
55
|
+
// [library] javascript
|
|
56
|
+
if (pkgConf.type === "library" && !FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
57
|
+
await new SdCliJsLibLinter(message.pkgPath)
|
|
58
|
+
.on("change", () => {
|
|
59
|
+
sendMessage({
|
|
60
|
+
type: "change",
|
|
61
|
+
req: message
|
|
62
|
+
});
|
|
63
|
+
})
|
|
64
|
+
.on("complete", (result) => {
|
|
65
|
+
sendMessage({
|
|
66
|
+
type: "complete",
|
|
67
|
+
result,
|
|
68
|
+
req: message
|
|
69
|
+
});
|
|
70
|
+
})
|
|
71
|
+
.watchAsync();
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
sendMessage({
|
|
74
|
+
type: "ready",
|
|
75
|
+
req: message
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
// [library] typescript
|
|
79
|
+
else if (pkgConf.type === "library" && FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
80
|
+
await new SdCliTsLibBuilder(message.projConf, message.pkgPath)
|
|
81
|
+
.on("change", () => {
|
|
82
|
+
sendMessage({
|
|
83
|
+
type: "change",
|
|
84
|
+
req: message
|
|
85
|
+
});
|
|
86
|
+
})
|
|
87
|
+
.on("complete", (result) => {
|
|
88
|
+
sendMessage({
|
|
89
|
+
type: "complete",
|
|
90
|
+
result,
|
|
91
|
+
req: message
|
|
92
|
+
});
|
|
93
|
+
})
|
|
94
|
+
.watchAsync();
|
|
95
|
+
sendMessage({
|
|
96
|
+
type: "ready",
|
|
97
|
+
req: message
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// [server]
|
|
101
|
+
else if (pkgConf.type === "server") {
|
|
102
|
+
await new SdCliServerBuilder(message.projConf, message.pkgPath)
|
|
103
|
+
.on("change", () => {
|
|
104
|
+
sendMessage({
|
|
105
|
+
type: "change",
|
|
106
|
+
req: message
|
|
107
|
+
});
|
|
108
|
+
})
|
|
109
|
+
.on("complete", (result) => {
|
|
110
|
+
sendMessage({
|
|
111
|
+
type: "complete",
|
|
112
|
+
result,
|
|
113
|
+
req: message
|
|
114
|
+
});
|
|
115
|
+
})
|
|
116
|
+
.watchAsync();
|
|
117
|
+
sendMessage({
|
|
118
|
+
type: "ready",
|
|
119
|
+
req: message
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
// [client]
|
|
123
|
+
else if (pkgConf.type === "client") {
|
|
124
|
+
await new SdCliClientBuilder(message.projConf, message.pkgPath)
|
|
125
|
+
.on("change", () => {
|
|
126
|
+
sendMessage({
|
|
127
|
+
type: "change",
|
|
128
|
+
req: message
|
|
129
|
+
});
|
|
130
|
+
})
|
|
131
|
+
.on("complete", (result) => {
|
|
132
|
+
sendMessage({
|
|
133
|
+
type: "complete",
|
|
134
|
+
result,
|
|
135
|
+
req: message
|
|
136
|
+
});
|
|
137
|
+
})
|
|
138
|
+
.watchAsync();
|
|
139
|
+
sendMessage({
|
|
140
|
+
type: "ready",
|
|
141
|
+
req: message
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
throw new NeverEntryError();
|
|
146
|
+
}
|
|
76
147
|
}
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
type: "ready",
|
|
118
|
-
req: message
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
// [client]
|
|
122
|
-
else if (pkgConf.type === "client") {
|
|
123
|
-
await new SdCliClientBuilder(message.projConf, message.pkgPath)
|
|
124
|
-
.on("change", () => {
|
|
125
|
-
sendMessage({
|
|
126
|
-
type: "change",
|
|
127
|
-
req: message
|
|
128
|
-
});
|
|
129
|
-
})
|
|
130
|
-
.on("complete", (result) => {
|
|
131
|
-
sendMessage({
|
|
132
|
-
type: "complete",
|
|
133
|
-
result,
|
|
134
|
-
req: message
|
|
135
|
-
});
|
|
136
|
-
})
|
|
137
|
-
.watchAsync();
|
|
138
|
-
sendMessage({
|
|
139
|
-
type: "ready",
|
|
140
|
-
req: message
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
throw new NeverEntryError();
|
|
148
|
+
else { // build
|
|
149
|
+
// [library] javascript
|
|
150
|
+
if (pkgConf.type === "library" && !FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
151
|
+
const result = await new SdCliJsLibLinter(message.pkgPath).buildAsync();
|
|
152
|
+
sendMessage({
|
|
153
|
+
type: "complete",
|
|
154
|
+
result,
|
|
155
|
+
req: message
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
// [library] typescript
|
|
159
|
+
else if (pkgConf.type === "library" && FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
160
|
+
const result = await new SdCliTsLibBuilder(message.projConf, message.pkgPath).buildAsync();
|
|
161
|
+
sendMessage({
|
|
162
|
+
type: "complete",
|
|
163
|
+
result,
|
|
164
|
+
req: message
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
// [server]
|
|
168
|
+
else if (pkgConf.type === "server") {
|
|
169
|
+
const result = await new SdCliServerBuilder(message.projConf, message.pkgPath).buildAsync();
|
|
170
|
+
sendMessage({
|
|
171
|
+
type: "complete",
|
|
172
|
+
result,
|
|
173
|
+
req: message
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// [client]
|
|
177
|
+
else if (pkgConf.type === "client") {
|
|
178
|
+
const result = await new SdCliClientBuilder(message.projConf, message.pkgPath).buildAsync();
|
|
179
|
+
sendMessage({
|
|
180
|
+
type: "complete",
|
|
181
|
+
result,
|
|
182
|
+
req: message
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
throw new NeverEntryError();
|
|
187
|
+
}
|
|
145
188
|
}
|
|
146
189
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const result = await new SdCliJsLibLinter(message.pkgPath).buildAsync();
|
|
151
|
-
sendMessage({
|
|
152
|
-
type: "complete",
|
|
153
|
-
result,
|
|
154
|
-
req: message
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
// [library] typescript
|
|
158
|
-
else if (pkgConf.type === "library" && FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
159
|
-
const result = await new SdCliTsLibBuilder(message.projConf, message.pkgPath).buildAsync();
|
|
160
|
-
sendMessage({
|
|
161
|
-
type: "complete",
|
|
162
|
-
result,
|
|
163
|
-
req: message
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
// [server]
|
|
167
|
-
else if (pkgConf.type === "server") {
|
|
168
|
-
const result = await new SdCliServerBuilder(message.projConf, message.pkgPath).buildAsync();
|
|
169
|
-
sendMessage({
|
|
170
|
-
type: "complete",
|
|
171
|
-
result,
|
|
172
|
-
req: message
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
// [client]
|
|
176
|
-
else if (pkgConf.type === "client") {
|
|
177
|
-
const result = await new SdCliClientBuilder(message.projConf, message.pkgPath).buildAsync();
|
|
178
|
-
sendMessage({
|
|
179
|
-
type: "complete",
|
|
180
|
-
result,
|
|
181
|
-
req: message
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
throw new NeverEntryError();
|
|
186
|
-
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
logger.error(`${message.pkgPath}:${message.cmd}`, err);
|
|
192
|
+
throw err;
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
195
|
|
|
@@ -85,7 +85,7 @@ export class SdCliTsLibBuilder extends EventEmitter {
|
|
|
85
85
|
affectedFileSet: Set<string>;
|
|
86
86
|
buildResults: ISdCliPackageBuildResult[];
|
|
87
87
|
}> {
|
|
88
|
-
this._debug(`BUILD
|
|
88
|
+
this._debug(`BUILD & CHECK...`);
|
|
89
89
|
this._builder = this._builder ?? new SdTsCompiler({
|
|
90
90
|
pkgPath: this._pkgPath,
|
|
91
91
|
emit: true,
|
|
@@ -61,7 +61,7 @@ export class SdCliProject {
|
|
|
61
61
|
|
|
62
62
|
logger.debug("빌드 프로세스 이벤트 준비...");
|
|
63
63
|
const resultCache = new Map<string, ISdCliPackageBuildResult[]>();
|
|
64
|
-
let
|
|
64
|
+
let busyReqCntMap = new Map<string, number>();
|
|
65
65
|
const serverInfoMap = new Map<string, {
|
|
66
66
|
// server
|
|
67
67
|
pkgOrOpt?: { path: string; conf: ISdCliServerPackageConfig } | { port: number }; // persist
|
|
@@ -76,10 +76,13 @@ export class SdCliProject {
|
|
|
76
76
|
}>();
|
|
77
77
|
cluster.on("message", (message: ISdCliBuildClusterResMessage) => {
|
|
78
78
|
if (message.type === "change") {
|
|
79
|
-
if (
|
|
79
|
+
if (Array.from(busyReqCntMap.values()).every(v => v === 0)) {
|
|
80
80
|
logger.log("빌드를 시작합니다...");
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
busyReqCntMap.set(
|
|
83
|
+
message.req.cmd + "|" + message.req.pkgPath,
|
|
84
|
+
(busyReqCntMap.get(message.req.cmd + "|" + message.req.pkgPath) ?? 0) + 1
|
|
85
|
+
);
|
|
83
86
|
}
|
|
84
87
|
else if (message.type === "complete") {
|
|
85
88
|
resultCache.delete("none");
|
|
@@ -149,8 +152,12 @@ export class SdCliProject {
|
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
setTimeout(async () => {
|
|
152
|
-
|
|
153
|
-
|
|
155
|
+
busyReqCntMap.set(
|
|
156
|
+
message.req.cmd + "|" + message.req.pkgPath,
|
|
157
|
+
(busyReqCntMap.get(message.req.cmd + "|" + message.req.pkgPath) ?? 0) - 1
|
|
158
|
+
);
|
|
159
|
+
logger.debug("남아있는 예약 빌드", busyReqCntMap);
|
|
160
|
+
if (Array.from(busyReqCntMap.values()).every(v => v === 0)) {
|
|
154
161
|
for (const serverPkgNameOrPort of serverInfoMap.keys()) {
|
|
155
162
|
const serverInfo = serverInfoMap.get(serverPkgNameOrPort)!;
|
|
156
163
|
if (serverInfo.pkgOrOpt && serverInfo.hasChanges) {
|
|
@@ -206,7 +213,10 @@ export class SdCliProject {
|
|
|
206
213
|
});
|
|
207
214
|
|
|
208
215
|
logger.debug("빌드 프로세스 명령 전송...");
|
|
209
|
-
|
|
216
|
+
busyReqCntMap.set(
|
|
217
|
+
"all",
|
|
218
|
+
(busyReqCntMap.get("all") ?? 0) + 1
|
|
219
|
+
);
|
|
210
220
|
logger.log("빌드를 시작합니다...");
|
|
211
221
|
|
|
212
222
|
await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
@@ -222,8 +232,11 @@ export class SdCliProject {
|
|
|
222
232
|
}
|
|
223
233
|
});
|
|
224
234
|
|
|
225
|
-
|
|
226
|
-
|
|
235
|
+
busyReqCntMap.set(
|
|
236
|
+
"all",
|
|
237
|
+
(busyReqCntMap.get("all") ?? 0) - 1
|
|
238
|
+
);
|
|
239
|
+
if (Array.from(busyReqCntMap.values()).every(v => v === 0)) {
|
|
227
240
|
const buildResults = Array.from(resultCache.values()).mapMany();
|
|
228
241
|
this._logging(buildResults, logger);
|
|
229
242
|
}
|