@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,16 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
export declare function sdServerPlugin(conf: {
|
|
4
|
-
pkgPath: string;
|
|
5
|
-
dev: boolean;
|
|
6
|
-
modifiedFileSet: Set<string>;
|
|
7
|
-
result: IServerPluginResultCache;
|
|
8
|
-
watchScopePaths: string[];
|
|
9
|
-
}): esbuild.Plugin;
|
|
10
|
-
export interface IServerPluginResultCache {
|
|
11
|
-
watchFileSet?: Set<string>;
|
|
12
|
-
affectedFileSet?: Set<string>;
|
|
13
|
-
outputFiles?: esbuild.OutputFile[];
|
|
14
|
-
metafile?: esbuild.Metafile;
|
|
15
|
-
program?: ts.Program;
|
|
16
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { SdTsCompiler } from "../build-tools/SdTsCompiler";
|
|
4
|
-
import { convertTypeScriptDiagnostic } from "@angular/build/src/tools/esbuild/angular/diagnostics";
|
|
5
|
-
export function sdServerPlugin(conf) {
|
|
6
|
-
return {
|
|
7
|
-
name: "sd-server-compiler",
|
|
8
|
-
setup: (build) => {
|
|
9
|
-
const compiler = new SdTsCompiler({
|
|
10
|
-
pkgPath: conf.pkgPath,
|
|
11
|
-
additionalOptions: { declaration: false },
|
|
12
|
-
isDevMode: conf.dev,
|
|
13
|
-
isForBundle: true,
|
|
14
|
-
watchScopePaths: conf.watchScopePaths
|
|
15
|
-
});
|
|
16
|
-
let buildResult;
|
|
17
|
-
build.onStart(async () => {
|
|
18
|
-
compiler.invalidate(conf.modifiedFileSet);
|
|
19
|
-
buildResult = await compiler.buildAsync();
|
|
20
|
-
conf.result.watchFileSet = buildResult.watchFileSet;
|
|
21
|
-
conf.result.affectedFileSet = buildResult.affectedFileSet;
|
|
22
|
-
conf.result.program = buildResult.program;
|
|
23
|
-
//-- return err/warn
|
|
24
|
-
return {
|
|
25
|
-
errors: buildResult.typescriptDiagnostics
|
|
26
|
-
.filter((item) => item.category === ts.DiagnosticCategory.Error)
|
|
27
|
-
.map((item) => convertTypeScriptDiagnostic(ts, item)),
|
|
28
|
-
warnings: buildResult.typescriptDiagnostics
|
|
29
|
-
.filter((item) => item.category !== ts.DiagnosticCategory.Error)
|
|
30
|
-
.map((item) => convertTypeScriptDiagnostic(ts, item)),
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
build.onLoad({ filter: /\.ts$/ }, (args) => {
|
|
34
|
-
const emittedJsFile = buildResult.emittedFilesCacheMap.get(path.normalize(args.path))?.last();
|
|
35
|
-
if (!emittedJsFile) {
|
|
36
|
-
throw new Error(`ts 빌더 결과 emit 파일이 존재하지 않습니다. ${args.path}`);
|
|
37
|
-
}
|
|
38
|
-
const contents = emittedJsFile.text;
|
|
39
|
-
return { contents, loader: "js" };
|
|
40
|
-
});
|
|
41
|
-
build.onLoad({ filter: /\.[cm]?js$/ }, (args) => {
|
|
42
|
-
conf.result.watchFileSet.add(path.normalize(args.path));
|
|
43
|
-
return null;
|
|
44
|
-
});
|
|
45
|
-
build.onLoad({
|
|
46
|
-
filter: new RegExp("(" +
|
|
47
|
-
Object.keys(build.initialOptions.loader)
|
|
48
|
-
.map((item) => "\\" + item)
|
|
49
|
-
.join("|") +
|
|
50
|
-
")$"),
|
|
51
|
-
}, (args) => {
|
|
52
|
-
conf.result.watchFileSet.add(path.normalize(args.path));
|
|
53
|
-
return null;
|
|
54
|
-
});
|
|
55
|
-
build.onEnd((result) => {
|
|
56
|
-
conf.result.outputFiles = result.outputFiles;
|
|
57
|
-
conf.result.metafile = result.metafile;
|
|
58
|
-
conf.modifiedFileSet.clear();
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=sdServerPlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdServerPlugin.js","sourceRoot":"","sources":["../../src/bundle-plugins/sdServerPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAuB,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAEnG,MAAM,UAAU,cAAc,CAAC,IAM9B;IACC,OAAO;QACL,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,CAAC,KAA0B,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC;gBAChC,OAAO,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AM,CAAC,WAAW,CAAC;gBAC7C,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;gBAEvC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;YAC/B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/commons.d.ts
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
export interface INpmConfig {
|
|
2
|
-
name: string;
|
|
3
|
-
description?: string;
|
|
4
|
-
version: string;
|
|
5
|
-
workspaces?: string[];
|
|
6
|
-
dependencies?: Record<string, string>;
|
|
7
|
-
optionalDependencies?: Record<string, string>;
|
|
8
|
-
devDependencies?: Record<string, string>;
|
|
9
|
-
peerDependencies?: Record<string, string>;
|
|
10
|
-
peerDependenciesMeta?: Record<string, {
|
|
11
|
-
optional?: boolean;
|
|
12
|
-
}>;
|
|
13
|
-
resolutions?: Record<string, string>;
|
|
14
|
-
scripts?: Record<string, string>;
|
|
15
|
-
}
|
|
16
|
-
export interface ITsConfig {
|
|
17
|
-
files?: string[];
|
|
18
|
-
compilerOptions: {
|
|
19
|
-
lib: string[];
|
|
20
|
-
};
|
|
21
|
-
angularCompilerOptions?: {};
|
|
22
|
-
}
|
|
23
|
-
export interface ISdCliBuildClusterReqMessage {
|
|
24
|
-
cmd: "watch" | "build";
|
|
25
|
-
projConf: ISdCliConfig;
|
|
26
|
-
pkgPath: string;
|
|
27
|
-
execArgs?: string[];
|
|
28
|
-
}
|
|
29
|
-
export interface ISdCliBuildClusterResMessage {
|
|
30
|
-
req: ISdCliBuildClusterReqMessage;
|
|
31
|
-
type: "change" | "complete" | "ready";
|
|
32
|
-
result?: ISdCliBuilderResult;
|
|
33
|
-
}
|
|
34
|
-
export interface ISdCliBuilderResult {
|
|
35
|
-
affectedFilePaths: string[];
|
|
36
|
-
buildResults: ISdCliPackageBuildResult[];
|
|
37
|
-
}
|
|
38
|
-
export interface ISdCliPackageBuildResult {
|
|
39
|
-
filePath: string | undefined;
|
|
40
|
-
line: number | undefined;
|
|
41
|
-
char: number | undefined;
|
|
42
|
-
code: string | undefined;
|
|
43
|
-
severity: "error" | "warning" | "suggestion" | "message";
|
|
44
|
-
message: string;
|
|
45
|
-
type: "build" | "lint" | "style" | "check" | undefined;
|
|
46
|
-
}
|
|
47
|
-
export interface ISdCliConfig {
|
|
48
|
-
packages: Record<string, TSdCliPackageConfig | undefined>;
|
|
49
|
-
localUpdates?: Record<string, string>;
|
|
50
|
-
postPublish?: TSdCliPostPublishConfig[];
|
|
51
|
-
}
|
|
52
|
-
export type TSdCliConfigFn = (isDev: boolean, opts?: string[]) => ISdCliConfig;
|
|
53
|
-
export type TSdCliPackageConfig = ISdCliLibPackageConfig | ISdCliServerPackageConfig | ISdCliClientPackageConfig;
|
|
54
|
-
export interface ISdCliLibPackageConfig {
|
|
55
|
-
type: "library";
|
|
56
|
-
publish?: "npm";
|
|
57
|
-
polyfills?: string[];
|
|
58
|
-
noGenIndex?: boolean;
|
|
59
|
-
}
|
|
60
|
-
export interface ISdCliServerPackageConfig {
|
|
61
|
-
type: "server";
|
|
62
|
-
externals?: string[];
|
|
63
|
-
publish?: ISdCliLocalDirectoryPublishConfig | ISdCliFtpPublishConfig;
|
|
64
|
-
configs?: Record<string, any>;
|
|
65
|
-
env?: Record<string, string>;
|
|
66
|
-
pm2?: {
|
|
67
|
-
name?: string;
|
|
68
|
-
ignoreWatchPaths?: string[];
|
|
69
|
-
noInterpreter?: boolean;
|
|
70
|
-
noStartScript?: boolean;
|
|
71
|
-
};
|
|
72
|
-
iis?: {
|
|
73
|
-
nodeExeFilePath?: string;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
export interface ISdCliClientPackageConfig {
|
|
77
|
-
type: "client";
|
|
78
|
-
server?: string | {
|
|
79
|
-
port: number;
|
|
80
|
-
};
|
|
81
|
-
publish?: ISdCliLocalDirectoryPublishConfig | ISdCliFtpPublishConfig;
|
|
82
|
-
env?: Record<string, string>;
|
|
83
|
-
configs?: Record<string, any>;
|
|
84
|
-
noLazyRoute?: boolean;
|
|
85
|
-
forceProductionMode?: boolean;
|
|
86
|
-
builder?: {
|
|
87
|
-
web?: ISdCliClientBuilderWebConfig;
|
|
88
|
-
electron?: ISdCliClientBuilderElectronConfig;
|
|
89
|
-
cordova?: ISdCliClientBuilderCordovaConfig;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
export interface ISdCliLocalDirectoryPublishConfig {
|
|
93
|
-
type: "local-directory";
|
|
94
|
-
path: string;
|
|
95
|
-
}
|
|
96
|
-
export interface ISdCliFtpPublishConfig {
|
|
97
|
-
type: "ftp" | "ftps" | "sftp";
|
|
98
|
-
host: string;
|
|
99
|
-
port?: number;
|
|
100
|
-
path?: string;
|
|
101
|
-
user?: string;
|
|
102
|
-
pass?: string;
|
|
103
|
-
}
|
|
104
|
-
export interface ISdCliClientBuilderElectronConfig {
|
|
105
|
-
appId: string;
|
|
106
|
-
installerIcon?: string;
|
|
107
|
-
postInstallScript?: string;
|
|
108
|
-
reinstallDependencies?: string[];
|
|
109
|
-
env?: Record<string, string>;
|
|
110
|
-
}
|
|
111
|
-
export interface ISdCliClientBuilderWebConfig {
|
|
112
|
-
env?: Record<string, string>;
|
|
113
|
-
}
|
|
114
|
-
export interface ISdCliClientBuilderCordovaConfig {
|
|
115
|
-
appId: string;
|
|
116
|
-
appName: string;
|
|
117
|
-
plugins?: string[];
|
|
118
|
-
icon?: string;
|
|
119
|
-
debug?: boolean;
|
|
120
|
-
platform?: {
|
|
121
|
-
browser?: {};
|
|
122
|
-
android?: {
|
|
123
|
-
bundle?: boolean;
|
|
124
|
-
sign?: {
|
|
125
|
-
keystore: string;
|
|
126
|
-
storePassword: string;
|
|
127
|
-
alias: string;
|
|
128
|
-
password: string;
|
|
129
|
-
keystoreType: string;
|
|
130
|
-
};
|
|
131
|
-
sdkVersion?: number;
|
|
132
|
-
permissions?: {
|
|
133
|
-
name: string;
|
|
134
|
-
maxSdkVersion?: number;
|
|
135
|
-
}[];
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
env?: Record<string, string>;
|
|
139
|
-
browserslist?: string[];
|
|
140
|
-
}
|
|
141
|
-
export type TSdCliPostPublishConfig = ISdCliPostPublishScriptConfig;
|
|
142
|
-
export interface ISdCliPostPublishScriptConfig {
|
|
143
|
-
type: "script";
|
|
144
|
-
script: string;
|
|
145
|
-
}
|
package/dist/commons.js
DELETED
package/dist/commons.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commons.js","sourceRoot":"","sources":["../src/commons.ts"],"names":[],"mappings":""}
|
package/dist/server-worker.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
import { Logger, LoggerSeverity } from "@simplysm/sd-core-node";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { pathToFileURL } from "url";
|
|
5
|
-
import { SdServiceServer } from "@simplysm/sd-service-server";
|
|
6
|
-
import { JsonConvert } from "@simplysm/sd-core-common";
|
|
7
|
-
Error.stackTraceLimit = Infinity;
|
|
8
|
-
EventEmitter.defaultMaxListeners = 0;
|
|
9
|
-
if (Boolean(process.env["SD_DEBUG"])) {
|
|
10
|
-
Logger.setConfig({
|
|
11
|
-
console: {
|
|
12
|
-
level: LoggerSeverity.debug
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
Logger.setConfig({
|
|
18
|
-
dot: true
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
const logger = Logger.get(["simplysm", "sd-cli", "server-worker"]);
|
|
22
|
-
const pkgPathOrOpt = JsonConvert.parse(process.argv[2]);
|
|
23
|
-
let server;
|
|
24
|
-
if (typeof pkgPathOrOpt === "string") {
|
|
25
|
-
const mainFilePath = path.resolve(pkgPathOrOpt, "dist/main.js");
|
|
26
|
-
const serverModule = await import(pathToFileURL(mainFilePath).href);
|
|
27
|
-
server = serverModule.default;
|
|
28
|
-
if (server === undefined) {
|
|
29
|
-
logger.error(`${mainFilePath}(0, 0): 'SdServiceServer'를 'export'해야 합니다.`);
|
|
30
|
-
process.exit();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
server = new SdServiceServer({
|
|
35
|
-
rootPath: process.cwd(),
|
|
36
|
-
services: [],
|
|
37
|
-
port: pkgPathOrOpt.port
|
|
38
|
-
});
|
|
39
|
-
server.listenAsync()
|
|
40
|
-
.catch((err) => {
|
|
41
|
-
// eslint-disable-next-line no-console
|
|
42
|
-
console.error(err);
|
|
43
|
-
process.exit(1);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
server.on("ready", () => {
|
|
47
|
-
process.send({ port: server.options.port });
|
|
48
|
-
});
|
|
49
|
-
process.on("message", (message) => {
|
|
50
|
-
if (message.type === "setPathProxy") {
|
|
51
|
-
server.pathProxy = message.pathProxy;
|
|
52
|
-
}
|
|
53
|
-
if (message.type === "broadcastReload") {
|
|
54
|
-
server.broadcastReload();
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=server-worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-worker.js","sourceRoot":"","sources":["../src/server-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,aAAa,EAAC,MAAM,KAAK,CAAC;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAErD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;AACjC,YAAY,CAAC,mBAAmB,GAAG,CAAC,CAAC;AAErC,IAAI,O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ACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC;AAGD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;IACtB,OAAO,CAAC,IAAK,CAAC,EAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,EAAC,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAY,EAAE,EAAE;IACrC,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QACpC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACvC,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACvC,MAAM,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { ISdCliPackageBuildResult } from "../commons";
|
|
3
|
-
import { PartialMessage } from "esbuild";
|
|
4
|
-
export declare class SdCliBuildResultUtil {
|
|
5
|
-
static convertFromTsDiag(diag: ts.Diagnostic, type: "build" | "check"): ISdCliPackageBuildResult;
|
|
6
|
-
static convertFromEsbuildResult(msg: PartialMessage, type: "build" | "check", severity: "warning" | "error"): {
|
|
7
|
-
filePath: string | undefined;
|
|
8
|
-
line: number | undefined;
|
|
9
|
-
char: number | undefined;
|
|
10
|
-
code: string | undefined;
|
|
11
|
-
severity: "error" | "warning";
|
|
12
|
-
message: string;
|
|
13
|
-
type: "build" | "check";
|
|
14
|
-
};
|
|
15
|
-
static getMessage(result: ISdCliPackageBuildResult): string;
|
|
16
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import os from "os";
|
|
3
|
-
import path from "path";
|
|
4
|
-
export class SdCliBuildResultUtil {
|
|
5
|
-
static convertFromTsDiag(diag, type) {
|
|
6
|
-
const severity = diag.category === ts.DiagnosticCategory.Error ? "error"
|
|
7
|
-
: diag.category === ts.DiagnosticCategory.Warning ? "warning"
|
|
8
|
-
: diag.category === ts.DiagnosticCategory.Suggestion ? "suggestion"
|
|
9
|
-
: "message";
|
|
10
|
-
const code = `TS${diag.code}`;
|
|
11
|
-
const message = ts.flattenDiagnosticMessageText(diag.messageText, os.EOL);
|
|
12
|
-
const filePath = diag.file ? path.resolve(diag.file.fileName) : undefined;
|
|
13
|
-
const position = diag.file && diag.start !== undefined ? diag.file.getLineAndCharacterOfPosition(diag.start) : undefined;
|
|
14
|
-
const line = position ? position.line + 1 : undefined;
|
|
15
|
-
const char = position ? position.character + 1 : undefined;
|
|
16
|
-
return {
|
|
17
|
-
filePath,
|
|
18
|
-
line,
|
|
19
|
-
char,
|
|
20
|
-
code,
|
|
21
|
-
severity,
|
|
22
|
-
message,
|
|
23
|
-
type
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
static convertFromEsbuildResult(msg, type, severity) {
|
|
27
|
-
const filePath = msg.location?.file != null ? path.resolve(msg.location.file) : undefined;
|
|
28
|
-
const line = msg.location?.line;
|
|
29
|
-
const char = msg.location?.column;
|
|
30
|
-
const code = msg.text?.slice(0, msg.text.indexOf(":"));
|
|
31
|
-
const message = `${msg.pluginName != null ? `(${msg.pluginName}) ` : ""} ${msg.text?.slice(msg.text.indexOf(":") + 1)}`;
|
|
32
|
-
return {
|
|
33
|
-
filePath,
|
|
34
|
-
line,
|
|
35
|
-
char,
|
|
36
|
-
code,
|
|
37
|
-
severity,
|
|
38
|
-
message,
|
|
39
|
-
type
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
static getMessage(result) {
|
|
43
|
-
let str = "";
|
|
44
|
-
if (result.filePath !== undefined) {
|
|
45
|
-
str += `${result.filePath}(${result.line ?? 0}, ${result.char ?? 0}): `;
|
|
46
|
-
}
|
|
47
|
-
if (result.code !== undefined) {
|
|
48
|
-
str += `${result.code}: `;
|
|
49
|
-
}
|
|
50
|
-
str += `(${result.type}) ${result.severity} ${result.message}`;
|
|
51
|
-
return str;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=SdCliBuildResultUtil.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SdCliBuildResultUtil.js","sourceRoot":"","sources":["../../src/utils/SdCliBuildResultUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,MAAM,OAAO,oBAAoB;IAC/B,MAAM,CAAC,iBAAiB,CAAC,IAAmB,EAAE,IAAuB;QACnE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,KAAK,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,OAAgB;YAC/E,CAAC,CAAC,IAAI,CAAC,QAAQ,KAAK,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,SAAkB;gBACpE,CAAC,CAAC,IAAI,CAAC,QAAQ,KAAK,EAAE,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,YAAqB;oBAC1E,CAAC,CAAC,SAAkB,CAAC;QAE3B,MAAM,IAAI,GAAG,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,EAAE,CAAC,4BAA4B,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;QAE1E,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KA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Q;YACR,IAAI;YACJ,IAAI;YACJ,IAAI;YACJ,QAAQ;YACR,OAAO;YACP,IAAI;SACL,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,MAAgC;QAChD,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAClC,GAAG,IAAI,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;QAC1E,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9B,GAAG,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC;QAC5B,CAAC;QACD,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QAE/D,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
package/src/build-cluster.ts
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import cluster from "node:cluster";
|
|
2
|
-
import {FsUtil, Logger, LoggerSeverity} from "@simplysm/sd-core-node";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import {SdCliJsLibLinter} from "./builders/SdCliJsLibLinter";
|
|
5
|
-
import {EventEmitter} from "events";
|
|
6
|
-
import {ISdCliBuildClusterReqMessage, ISdCliBuildClusterResMessage} from "./commons";
|
|
7
|
-
import {NeverEntryError} from "@simplysm/sd-core-common";
|
|
8
|
-
import {SdCliServerBuilder} from "./builders/SdCliServerBuilder";
|
|
9
|
-
import {SdCliClientBuilder} from "./builders/SdCliClientBuilder";
|
|
10
|
-
import {SdCliTsLibBuilder} from "./builders/SdCliTsLibBuilder";
|
|
11
|
-
|
|
12
|
-
Error.stackTraceLimit = Infinity;
|
|
13
|
-
EventEmitter.defaultMaxListeners = 0;
|
|
14
|
-
|
|
15
|
-
if (Boolean(process.env["SD_DEBUG"])) {
|
|
16
|
-
Logger.setConfig({
|
|
17
|
-
console: {
|
|
18
|
-
level: LoggerSeverity.debug
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
Logger.setConfig({
|
|
24
|
-
dot: true
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const logger = Logger.get(["simplysm", "sd-cli", "build-cluster"]);
|
|
29
|
-
|
|
30
|
-
if (cluster.isPrimary) {
|
|
31
|
-
cluster.schedulingPolicy = cluster.SCHED_RR;
|
|
32
|
-
logger.debug(`메인 프로세스 ${process.pid} 시작`);
|
|
33
|
-
|
|
34
|
-
cluster.on("exit", (worker, code) => {
|
|
35
|
-
logger.debug(`워커 프로세스 ${worker.process.pid} 종료 (code: ${code})`);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
cluster.on("message", (worker, message) => {
|
|
39
|
-
sendMessage(message);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
process.on("message", (message: ISdCliBuildClusterReqMessage) => {
|
|
43
|
-
cluster.fork({
|
|
44
|
-
"SD_CLUSTER_MESSAGE": JSON.stringify(message),
|
|
45
|
-
"NODE_OPTIONS": message.execArgs?.join(" ")
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
process.send!("ready");
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
const message = JSON.parse(process.env["SD_CLUSTER_MESSAGE"]!) as ISdCliBuildClusterReqMessage;
|
|
52
|
-
const pkgConf = message.projConf.packages[path.basename(message.pkgPath)]!;
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
if (message.cmd === "watch") {
|
|
56
|
-
// [library] javascript
|
|
57
|
-
if (pkgConf.type === "library" && !FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
58
|
-
await new SdCliJsLibLinter(message.pkgPath)
|
|
59
|
-
.on("change", () => {
|
|
60
|
-
sendMessage({
|
|
61
|
-
type: "change",
|
|
62
|
-
req: message
|
|
63
|
-
});
|
|
64
|
-
})
|
|
65
|
-
.on("complete", (result) => {
|
|
66
|
-
sendMessage({
|
|
67
|
-
type: "complete",
|
|
68
|
-
result,
|
|
69
|
-
req: message
|
|
70
|
-
});
|
|
71
|
-
logMemory(message);
|
|
72
|
-
})
|
|
73
|
-
.watchAsync();
|
|
74
|
-
|
|
75
|
-
sendMessage({
|
|
76
|
-
type: "ready",
|
|
77
|
-
req: message
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
// [library] typescript
|
|
81
|
-
else if (pkgConf.type === "library" && FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
82
|
-
await new SdCliTsLibBuilder(message.projConf, message.pkgPath)
|
|
83
|
-
.on("change", () => {
|
|
84
|
-
sendMessage({
|
|
85
|
-
type: "change",
|
|
86
|
-
req: message
|
|
87
|
-
});
|
|
88
|
-
})
|
|
89
|
-
.on("complete", (result) => {
|
|
90
|
-
sendMessage({
|
|
91
|
-
type: "complete",
|
|
92
|
-
result,
|
|
93
|
-
req: message
|
|
94
|
-
});
|
|
95
|
-
logMemory(message);
|
|
96
|
-
})
|
|
97
|
-
.watchAsync();
|
|
98
|
-
sendMessage({
|
|
99
|
-
type: "ready",
|
|
100
|
-
req: message
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
// [server]
|
|
104
|
-
else if (pkgConf.type === "server") {
|
|
105
|
-
await new SdCliServerBuilder(message.projConf, message.pkgPath)
|
|
106
|
-
.on("change", () => {
|
|
107
|
-
sendMessage({
|
|
108
|
-
type: "change",
|
|
109
|
-
req: message
|
|
110
|
-
});
|
|
111
|
-
})
|
|
112
|
-
.on("complete", (result) => {
|
|
113
|
-
sendMessage({
|
|
114
|
-
type: "complete",
|
|
115
|
-
result,
|
|
116
|
-
req: message
|
|
117
|
-
});
|
|
118
|
-
logMemory(message);
|
|
119
|
-
})
|
|
120
|
-
.watchAsync();
|
|
121
|
-
sendMessage({
|
|
122
|
-
type: "ready",
|
|
123
|
-
req: message
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
// [client]
|
|
127
|
-
else if (pkgConf.type === "client") {
|
|
128
|
-
await new SdCliClientBuilder(message.projConf, message.pkgPath)
|
|
129
|
-
.on("change", () => {
|
|
130
|
-
sendMessage({
|
|
131
|
-
type: "change",
|
|
132
|
-
req: message
|
|
133
|
-
});
|
|
134
|
-
})
|
|
135
|
-
.on("complete", (result) => {
|
|
136
|
-
sendMessage({
|
|
137
|
-
type: "complete",
|
|
138
|
-
result,
|
|
139
|
-
req: message
|
|
140
|
-
});
|
|
141
|
-
logMemory(message);
|
|
142
|
-
})
|
|
143
|
-
.watchAsync();
|
|
144
|
-
sendMessage({
|
|
145
|
-
type: "ready",
|
|
146
|
-
req: message
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
throw new NeverEntryError();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
else { // build
|
|
154
|
-
// [library] javascript
|
|
155
|
-
if (pkgConf.type === "library" && !FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
156
|
-
const result = await new SdCliJsLibLinter(message.pkgPath).buildAsync();
|
|
157
|
-
sendMessage({
|
|
158
|
-
type: "complete",
|
|
159
|
-
result,
|
|
160
|
-
req: message
|
|
161
|
-
});
|
|
162
|
-
logMemory(message);
|
|
163
|
-
}
|
|
164
|
-
// [library] typescript
|
|
165
|
-
else if (pkgConf.type === "library" && FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
166
|
-
const result = await new SdCliTsLibBuilder(message.projConf, message.pkgPath).buildAsync();
|
|
167
|
-
sendMessage({
|
|
168
|
-
type: "complete",
|
|
169
|
-
result,
|
|
170
|
-
req: message
|
|
171
|
-
});
|
|
172
|
-
logMemory(message);
|
|
173
|
-
}
|
|
174
|
-
// [server]
|
|
175
|
-
else if (pkgConf.type === "server") {
|
|
176
|
-
const result = await new SdCliServerBuilder(message.projConf, message.pkgPath).buildAsync();
|
|
177
|
-
sendMessage({
|
|
178
|
-
type: "complete",
|
|
179
|
-
result,
|
|
180
|
-
req: message,
|
|
181
|
-
});
|
|
182
|
-
logMemory(message);
|
|
183
|
-
}
|
|
184
|
-
// [client]
|
|
185
|
-
else if (pkgConf.type === "client") {
|
|
186
|
-
const result = await new SdCliClientBuilder(message.projConf, message.pkgPath).buildAsync();
|
|
187
|
-
sendMessage({
|
|
188
|
-
type: "complete",
|
|
189
|
-
result,
|
|
190
|
-
req: message,
|
|
191
|
-
});
|
|
192
|
-
logMemory(message);
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
throw new NeverEntryError();
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
catch (err) {
|
|
200
|
-
logger.error(`${message.pkgPath}:${message.cmd}`, err);
|
|
201
|
-
throw err;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function sendMessage(message: ISdCliBuildClusterResMessage): void {
|
|
206
|
-
process.send!(message);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function logMemory(message: ISdCliBuildClusterReqMessage) {
|
|
210
|
-
/*global.gc!();
|
|
211
|
-
logger.log(`[${process.pid}:${path.basename(message.pkgPath)}] 메모리 사용량: ${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`);*/
|
|
212
|
-
}
|