@simplysm/sd-cli 7.0.249 → 7.0.263
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/README.md +48 -0
- package/dist/bin/sd-cli.mjs +171 -13
- package/dist/build-tool/SdCliElectron.mjs +3 -2
- package/dist/builder/SdCliClientBuilder.mjs +11 -7
- package/dist/builder/SdCliTsLibBuilder.mjs +18 -12
- package/dist/commons.d.ts +6 -1
- package/dist/entry-points/SdCliProjectGenerator.d.ts +37 -0
- package/dist/entry-points/SdCliProjectGenerator.mjs +288 -0
- package/dist/entry-points/SdCliWorkspace.d.ts +6 -6
- package/dist/entry-points/SdCliWorkspace.mjs +61 -107
- package/dist/entry-points/file/base/fc_package_eslintrc.d.ts +3 -0
- package/dist/entry-points/file/base/fc_package_eslintrc.mjs +31 -0
- package/dist/entry-points/file/base/fc_package_npmconfig.d.ts +9 -0
- package/dist/entry-points/file/base/fc_package_npmconfig.mjs +32 -0
- package/dist/entry-points/file/base/fc_package_tsconfig.d.ts +4 -0
- package/dist/entry-points/file/base/fc_package_tsconfig.mjs +12 -0
- package/dist/entry-points/file/client/fc_package_AppModule.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_AppModule.mjs +37 -0
- package/dist/entry-points/file/client/fc_package_AppPage.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_AppPage.mjs +34 -0
- package/dist/entry-points/file/client/fc_package_appicons.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_appicons.mjs +6 -0
- package/dist/entry-points/file/client/fc_package_client_main.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_client_main.mjs +19 -0
- package/dist/entry-points/file/client/fc_package_index.d.ts +3 -0
- package/dist/entry-points/file/client/fc_package_index.mjs +88 -0
- package/dist/entry-points/file/client/fc_package_manifest.d.ts +5 -0
- package/dist/entry-points/file/client/fc_package_manifest.mjs +54 -0
- package/dist/entry-points/file/client/fc_package_polyfills.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_polyfills.mjs +11 -0
- package/dist/entry-points/file/client/fc_package_styles.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_styles.mjs +7 -0
- package/dist/entry-points/file/db/fc_package_DbContext.d.ts +3 -0
- package/dist/entry-points/file/db/fc_package_DbContext.mjs +14 -0
- package/dist/entry-points/file/db/fc_package_DbModel.d.ts +4 -0
- package/dist/entry-points/file/db/fc_package_DbModel.mjs +12 -0
- package/dist/entry-points/file/project/fc_project_editor_config.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_editor_config.mjs +22 -0
- package/dist/entry-points/file/project/fc_project_eslintrc.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_eslintrc.mjs +30 -0
- package/dist/entry-points/file/project/fc_project_gitattributes.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_gitattributes.mjs +6 -0
- package/dist/entry-points/file/project/fc_project_gitignore.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_gitignore.mjs +17 -0
- package/dist/entry-points/file/project/fc_project_npmconfig.d.ts +7 -0
- package/dist/entry-points/file/project/fc_project_npmconfig.mjs +35 -0
- package/dist/entry-points/file/project/fc_project_readme.d.ts +3 -0
- package/dist/entry-points/file/project/fc_project_readme.mjs +12 -0
- package/dist/entry-points/file/project/fc_project_simplysm.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_simplysm.mjs +2 -0
- package/dist/entry-points/file/project/fc_project_tsconfig.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_tsconfig.mjs +26 -0
- package/dist/entry-points/file/server/fc_package_server_main.d.ts +4 -0
- package/dist/entry-points/file/server/fc_package_server_main.mjs +60 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.mjs +24 -1
- package/dist/packages/SdCliPackage.d.ts +1 -0
- package/dist/packages/SdCliPackage.mjs +68 -62
- package/dist/utils/SdCliBuildResultUtil.mjs +2 -2
- package/package.json +10 -8
- package/src/bin/sd-cli.ts +198 -12
- package/src/build-tool/SdCliElectron.ts +2 -1
- package/src/builder/SdCliClientBuilder.ts +13 -7
- package/src/builder/SdCliJsLibBuilder.ts +70 -70
- package/src/builder/SdCliTsLibBuilder.ts +450 -445
- package/src/commons.ts +6 -1
- package/src/entry-points/SdCliProjectGenerator.ts +353 -0
- package/src/entry-points/SdCliWorkspace.ts +74 -122
- package/src/entry-points/file/assets/assets/icons/icon-128x128.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-144x144.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-152x152.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-192x192.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-384x384.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-512x512.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-72x72.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-96x96.png +0 -0
- package/src/entry-points/file/assets/favicon.ico +0 -0
- package/src/entry-points/file/base/fc_package_eslintrc.ts +30 -0
- package/src/entry-points/file/base/fc_package_npmconfig.ts +43 -0
- package/src/entry-points/file/base/fc_package_tsconfig.ts +11 -0
- package/src/entry-points/file/client/fc_package_AppModule.ts +36 -0
- package/src/entry-points/file/client/fc_package_AppPage.ts +33 -0
- package/src/entry-points/file/client/fc_package_appicons.ts +5 -0
- package/src/entry-points/file/client/fc_package_client_main.ts +18 -0
- package/src/entry-points/file/client/fc_package_index.ts +87 -0
- package/src/entry-points/file/client/fc_package_manifest.ts +53 -0
- package/src/entry-points/file/client/fc_package_polyfills.ts +10 -0
- package/src/entry-points/file/client/fc_package_styles.ts +6 -0
- package/src/entry-points/file/db/fc_package_DbContext.ts +14 -0
- package/src/entry-points/file/db/fc_package_DbModel.ts +11 -0
- package/src/entry-points/file/project/fc_project_editor_config.ts +21 -0
- package/src/entry-points/file/project/fc_project_eslintrc.ts +29 -0
- package/src/entry-points/file/project/fc_project_gitattributes.ts +5 -0
- package/src/entry-points/file/project/fc_project_gitignore.ts +16 -0
- package/src/entry-points/file/project/fc_project_npmconfig.ts +34 -0
- package/src/entry-points/file/project/fc_project_readme.ts +11 -0
- package/src/entry-points/file/project/fc_project_simplysm.ts +1 -0
- package/src/entry-points/file/project/fc_project_tsconfig.ts +25 -0
- package/src/entry-points/file/server/fc_package_server_main.ts +62 -0
- package/src/index.ts +23 -0
- package/src/packages/SdCliPackage.ts +75 -58
- package/src/utils/SdCliBuildResultUtil.ts +76 -76
|
@@ -74,41 +74,27 @@ export class SdCliPackage extends EventEmitter {
|
|
|
74
74
|
await this._genBuildTsconfigAsync();
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this.rootPath,
|
|
82
|
-
JsonConvert.stringify(this.config),
|
|
83
|
-
this._workspaceRootPath
|
|
84
|
-
], {
|
|
85
|
-
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
86
|
-
env: process.env
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
worker.on("error", (err) => {
|
|
90
|
-
reject(err);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
worker.stdout!.pipe(process.stdout);
|
|
94
|
-
worker.stderr!.pipe(process.stderr);
|
|
95
|
-
|
|
96
|
-
worker.on("message", (json: string) => {
|
|
97
|
-
const msg = JsonConvert.parse(json);
|
|
77
|
+
await this._runBuildWorkerAsync(
|
|
78
|
+
"watch",
|
|
79
|
+
(message) => {
|
|
80
|
+
const msg = JsonConvert.parse(message);
|
|
98
81
|
if (msg.event === "ready") {
|
|
99
|
-
|
|
82
|
+
return true;
|
|
100
83
|
}
|
|
101
84
|
else if (msg.event === "change") {
|
|
102
85
|
this.emit("change");
|
|
86
|
+
return undefined;
|
|
103
87
|
}
|
|
104
88
|
else if (msg.event === "complete") {
|
|
105
89
|
this.emit("complete", msg.body);
|
|
90
|
+
return undefined;
|
|
106
91
|
}
|
|
107
92
|
else {
|
|
108
|
-
|
|
93
|
+
return new NeverEntryError();
|
|
109
94
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
95
|
+
},
|
|
96
|
+
(err) => err
|
|
97
|
+
);
|
|
112
98
|
}
|
|
113
99
|
|
|
114
100
|
public async buildAsync(): Promise<ISdCliPackageBuildResult[]> {
|
|
@@ -118,40 +104,18 @@ export class SdCliPackage extends EventEmitter {
|
|
|
118
104
|
await this._genBuildTsconfigAsync();
|
|
119
105
|
}
|
|
120
106
|
|
|
121
|
-
|
|
122
|
-
return await new Promise<ISdCliPackageBuildResult[]>((resolve, reject) => {
|
|
123
|
-
const worker = cp.fork(workerPath, [
|
|
124
|
-
"build",
|
|
125
|
-
this.rootPath,
|
|
126
|
-
JsonConvert.stringify(this.config),
|
|
127
|
-
this._workspaceRootPath
|
|
128
|
-
], {
|
|
129
|
-
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
130
|
-
env: process.env
|
|
131
|
-
});
|
|
107
|
+
let result: ISdCliPackageBuildResult[] = [];
|
|
132
108
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
worker.on("message", (json: string) => {
|
|
143
|
-
result = JsonConvert.parse(json);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
worker.on("exit", (code) => {
|
|
147
|
-
if (code !== 0) {
|
|
148
|
-
reject(new Error(`오류와 함께 닫힘 (${code})`));
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
109
|
+
await this._runBuildWorkerAsync(
|
|
110
|
+
"build",
|
|
111
|
+
(message) => {
|
|
112
|
+
result = JsonConvert.parse(message);
|
|
113
|
+
return undefined;
|
|
114
|
+
},
|
|
115
|
+
err => err
|
|
116
|
+
);
|
|
151
117
|
|
|
152
|
-
|
|
153
|
-
});
|
|
154
|
-
});
|
|
118
|
+
return result;
|
|
155
119
|
}
|
|
156
120
|
|
|
157
121
|
public async publishAsync(): Promise<void> {
|
|
@@ -167,7 +131,11 @@ export class SdCliPackage extends EventEmitter {
|
|
|
167
131
|
}
|
|
168
132
|
else {
|
|
169
133
|
if (this.config.publish.type === "github") {
|
|
170
|
-
|
|
134
|
+
if (!this._npmConfig.repository) {
|
|
135
|
+
throw new Error("패키지의 package.json에 repository가 설정되지 않아 github로 배포할 수 없습니다.");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const repoUrl = this._npmConfig.repository.url;
|
|
171
139
|
const repoOwner = repoUrl.split("/").slice(-2)[0];
|
|
172
140
|
const repoName = repoUrl.split("/").slice(-2)[1].replace(/\..*/g, "");
|
|
173
141
|
|
|
@@ -239,4 +207,53 @@ export class SdCliPackage extends EventEmitter {
|
|
|
239
207
|
const buildTsconfigFilePath = path.resolve(this.rootPath, "tsconfig-build.json");
|
|
240
208
|
await FsUtil.writeJsonAsync(buildTsconfigFilePath, buildTsconfig, { space: 2 });
|
|
241
209
|
}
|
|
210
|
+
|
|
211
|
+
private async _runBuildWorkerAsync(cmd: string, success: (message: string) => undefined | true | Error, error: (err: Error) => undefined | true | Error): Promise<void> {
|
|
212
|
+
return await new Promise<void>(async (resolve, reject) => {
|
|
213
|
+
const worker = cp.fork(
|
|
214
|
+
fileURLToPath(await import.meta.resolve!("../worker/build-worker")),
|
|
215
|
+
[
|
|
216
|
+
cmd,
|
|
217
|
+
this.rootPath,
|
|
218
|
+
JsonConvert.stringify(this.config),
|
|
219
|
+
this._workspaceRootPath
|
|
220
|
+
],
|
|
221
|
+
{
|
|
222
|
+
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
223
|
+
env: process.env
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
worker.on("error", (err) => {
|
|
227
|
+
const r = error(err);
|
|
228
|
+
if (r === true) {
|
|
229
|
+
resolve();
|
|
230
|
+
}
|
|
231
|
+
else if (r != null) {
|
|
232
|
+
reject(r);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
worker.stdout!.pipe(process.stdout);
|
|
237
|
+
worker.stderr!.pipe(process.stderr);
|
|
238
|
+
|
|
239
|
+
worker.on("message", (json: string) => {
|
|
240
|
+
const r = success(json);
|
|
241
|
+
if (r === true) {
|
|
242
|
+
resolve();
|
|
243
|
+
}
|
|
244
|
+
else if (r != null) {
|
|
245
|
+
reject(r);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
worker.on("exit", (code) => {
|
|
250
|
+
if (code !== 0) {
|
|
251
|
+
reject(new Error(`오류와 함께 닫힘 (${code})`));
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
resolve();
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
}
|
|
242
259
|
}
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import os from "os";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { ISdCliPackageBuildResult } from "../commons";
|
|
5
|
-
import webpack from "webpack";
|
|
6
|
-
|
|
7
|
-
export class SdCliBuildResultUtil {
|
|
8
|
-
public static convertFromTsDiag(diag: ts.Diagnostic): ISdCliPackageBuildResult | undefined {
|
|
9
|
-
const severity = diag.category === ts.DiagnosticCategory.Error ? "error"
|
|
10
|
-
: diag.category === ts.DiagnosticCategory.Warning ? "warning"
|
|
11
|
-
: undefined;
|
|
12
|
-
if (!severity) return undefined;
|
|
13
|
-
|
|
14
|
-
const code = `TS${diag.code}`;
|
|
15
|
-
const message = ts.flattenDiagnosticMessageText(diag.messageText, os.EOL);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const filePath = diag.file ? path.resolve(diag.file.fileName) : undefined;
|
|
19
|
-
const position = diag.file && diag.start !== undefined ? diag.file.getLineAndCharacterOfPosition(diag.start) : undefined;
|
|
20
|
-
const line = position ? position.line + 1 : undefined;
|
|
21
|
-
const char = position ? position.character + 1 : undefined;
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
filePath,
|
|
25
|
-
line,
|
|
26
|
-
char,
|
|
27
|
-
code,
|
|
28
|
-
severity,
|
|
29
|
-
message
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public static convertFromWebpackStats(stats: webpack.Stats): ISdCliPackageBuildResult[] {
|
|
34
|
-
const results: ISdCliPackageBuildResult[] = [];
|
|
35
|
-
|
|
36
|
-
for (const statWarn of stats.compilation.warnings) {
|
|
37
|
-
if (stats.compilation.options.ignoreWarnings?.some((ignoreWarning) => ignoreWarning(statWarn, stats.compilation))) continue;
|
|
38
|
-
|
|
39
|
-
results.push(this._convertFromWebpackError("warning", statWarn));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
for (const statErr of stats.compilation.errors) {
|
|
43
|
-
results.push(this._convertFromWebpackError("error", statErr));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return results;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private static _convertFromWebpackError(severity: "warning" | "error", err: webpack.WebpackError): ISdCliPackageBuildResult {
|
|
50
|
-
return {
|
|
51
|
-
filePath: err.file,
|
|
52
|
-
line: err.file ? err.loc["start"]?.line : undefined,
|
|
53
|
-
char: err.file ? err.loc["start"]?.column : undefined,
|
|
54
|
-
code: err.name,
|
|
55
|
-
severity,
|
|
56
|
-
message: err.message
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
public static getMessage(result: ISdCliPackageBuildResult): string {
|
|
62
|
-
if (result.code === "ESLintError") {
|
|
63
|
-
return result.message;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let str = "";
|
|
67
|
-
if (result.filePath !== undefined) {
|
|
68
|
-
str += `${result.filePath}(${result.line ?? 0}, ${result.char ?? 0}): `;
|
|
69
|
-
}
|
|
70
|
-
if (result.code !== undefined) {
|
|
71
|
-
str += `${result.code}: `;
|
|
72
|
-
}
|
|
73
|
-
str += `${result.severity} ${result.message}`;
|
|
74
|
-
return str;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { ISdCliPackageBuildResult } from "../commons";
|
|
5
|
+
import webpack from "webpack";
|
|
6
|
+
|
|
7
|
+
export class SdCliBuildResultUtil {
|
|
8
|
+
public static convertFromTsDiag(diag: ts.Diagnostic): ISdCliPackageBuildResult | undefined {
|
|
9
|
+
const severity = diag.category === ts.DiagnosticCategory.Error ? "error"
|
|
10
|
+
: diag.category === ts.DiagnosticCategory.Warning ? "warning"
|
|
11
|
+
: undefined;
|
|
12
|
+
if (!severity) return undefined;
|
|
13
|
+
|
|
14
|
+
const code = `TS${diag.code}`;
|
|
15
|
+
const message = ts.flattenDiagnosticMessageText(diag.messageText, os.EOL);
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const filePath = diag.file ? path.resolve(diag.file.fileName) : undefined;
|
|
19
|
+
const position = diag.file && diag.start !== undefined ? diag.file.getLineAndCharacterOfPosition(diag.start) : undefined;
|
|
20
|
+
const line = position ? position.line + 1 : undefined;
|
|
21
|
+
const char = position ? position.character + 1 : undefined;
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
filePath,
|
|
25
|
+
line,
|
|
26
|
+
char,
|
|
27
|
+
code,
|
|
28
|
+
severity,
|
|
29
|
+
message
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public static convertFromWebpackStats(stats: webpack.Stats): ISdCliPackageBuildResult[] {
|
|
34
|
+
const results: ISdCliPackageBuildResult[] = [];
|
|
35
|
+
|
|
36
|
+
for (const statWarn of stats.compilation.warnings) {
|
|
37
|
+
if (stats.compilation.options.ignoreWarnings?.some((ignoreWarning) => ignoreWarning(statWarn, stats.compilation))) continue;
|
|
38
|
+
|
|
39
|
+
results.push(this._convertFromWebpackError("warning", statWarn));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
for (const statErr of stats.compilation.errors) {
|
|
43
|
+
results.push(this._convertFromWebpackError("error", statErr));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return results;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private static _convertFromWebpackError(severity: "warning" | "error", err: webpack.WebpackError): ISdCliPackageBuildResult {
|
|
50
|
+
return {
|
|
51
|
+
filePath: (err.file as string | undefined) ?? (err.module as webpack.Module | undefined)?.["request"],
|
|
52
|
+
line: err.file ? err.loc["start"]?.line : undefined,
|
|
53
|
+
char: err.file ? err.loc["start"]?.column : undefined,
|
|
54
|
+
code: err.name,
|
|
55
|
+
severity,
|
|
56
|
+
message: err.message
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
public static getMessage(result: ISdCliPackageBuildResult): string {
|
|
62
|
+
if (result.code === "ESLintError") {
|
|
63
|
+
return result.message;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let str = "";
|
|
67
|
+
if (result.filePath !== undefined) {
|
|
68
|
+
str += `${result.filePath}(${result.line ?? 0}, ${result.char ?? 0}): `;
|
|
69
|
+
}
|
|
70
|
+
if (result.code !== undefined) {
|
|
71
|
+
str += `${result.code}: `;
|
|
72
|
+
}
|
|
73
|
+
str += `${result.severity} ${result.message}`;
|
|
74
|
+
return str;
|
|
75
|
+
}
|
|
76
|
+
}
|