@simplysm/sd-cli 7.0.247 → 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 +33 -35
- package/dist/builder/SdCliServerBuilder.d.ts +1 -0
- package/dist/builder/SdCliServerBuilder.mjs +58 -22
- package/dist/builder/SdCliTsLibBuilder.mjs +18 -12
- package/dist/commons.d.ts +9 -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 -3
- package/dist/entry-points/SdCliWorkspace.mjs +147 -120
- 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/dist/worker/server-worker.d.ts +1 -0
- package/dist/worker/server-worker.mjs +67 -0
- 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 +36 -36
- package/src/builder/SdCliJsLibBuilder.ts +70 -70
- package/src/builder/SdCliServerBuilder.ts +58 -20
- package/src/builder/SdCliTsLibBuilder.ts +450 -445
- package/src/commons.ts +7 -1
- package/src/entry-points/SdCliProjectGenerator.ts +353 -0
- package/src/entry-points/SdCliWorkspace.ts +171 -137
- 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
- package/src/worker/server-worker.ts +72 -0
- package/tsconfig-build.json +2 -1
- package/tsconfig.json +2 -1
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Logger, LoggerSeverity } from "@simplysm/sd-core-node";
|
|
2
|
+
import { JsonConvert } from "@simplysm/sd-core-common";
|
|
3
|
+
import { SdServiceServer } from "@simplysm/sd-service-server";
|
|
4
|
+
|
|
5
|
+
if (process.env["SD_CLI_LOGGER_SEVERITY"] === "DEBUG") {
|
|
6
|
+
Logger.setConfig({
|
|
7
|
+
console: {
|
|
8
|
+
level: LoggerSeverity.debug
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
Logger.setConfig({
|
|
14
|
+
dot: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const filePathOrOpt = JsonConvert.parse(process.argv[2]) as (string | { port: number });
|
|
19
|
+
|
|
20
|
+
let runningServer: SdServiceServer | undefined;
|
|
21
|
+
|
|
22
|
+
if (typeof filePathOrOpt === "string") {
|
|
23
|
+
import(`file:///${filePathOrOpt}`)
|
|
24
|
+
.then((serverModule) => {
|
|
25
|
+
const server = serverModule.default as SdServiceServer | undefined;
|
|
26
|
+
if (server === undefined) {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.error(`${filePathOrOpt}(0, 0): 'SdServiceServer'를 'export'해야 합니다.`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const protocolStr = server.options.ssl ? "https" : "http";
|
|
33
|
+
const portStr = server.options.port.toString();
|
|
34
|
+
|
|
35
|
+
runningServer = server;
|
|
36
|
+
process.send!(`${protocolStr}://localhost:${portStr}`);
|
|
37
|
+
})
|
|
38
|
+
.catch((err) => {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.error(err);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// DEV SERVER
|
|
45
|
+
else {
|
|
46
|
+
const server = new SdServiceServer({
|
|
47
|
+
rootPath: process.cwd(),
|
|
48
|
+
services: [],
|
|
49
|
+
port: filePathOrOpt.port
|
|
50
|
+
});
|
|
51
|
+
server.listenAsync()
|
|
52
|
+
.then(() => {
|
|
53
|
+
runningServer = server;
|
|
54
|
+
process.send!(`http://localhost:${filePathOrOpt.port}`);
|
|
55
|
+
})
|
|
56
|
+
.catch((err) => {
|
|
57
|
+
// eslint-disable-next-line no-console
|
|
58
|
+
console.error(err);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
process.on("message", (msg: string) => {
|
|
64
|
+
if (!runningServer) return;
|
|
65
|
+
|
|
66
|
+
if (msg === "broadcastReload") {
|
|
67
|
+
runningServer.broadcastReload();
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
runningServer.pathProxy = JsonConvert.parse(msg);
|
|
71
|
+
}
|
|
72
|
+
});
|
package/tsconfig-build.json
CHANGED