@simplysm/sd-cli 12.7.4 → 12.7.6
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/entry/sd-cli-ai-command.d.ts +3 -0
- package/dist/entry/{SdAiCommand.js → sd-cli-ai-command.js} +14 -9
- package/dist/entry/sd-cli-ai-command.js.map +1 -0
- package/dist/entry/{SdCliCordova.d.ts → sd-cli-cordova.d.ts} +1 -1
- package/dist/entry/{SdCliCordova.js → sd-cli-cordova.js} +33 -31
- package/dist/entry/sd-cli-cordova.js.map +1 -0
- package/dist/entry/{SdCliElectron.d.ts → sd-cli-electron.d.ts} +1 -1
- package/dist/entry/{SdCliElectron.js → sd-cli-electron.js} +18 -16
- package/dist/entry/sd-cli-electron.js.map +1 -0
- package/dist/entry/{SdCliLocalUpdate.js → sd-cli-local-update.js} +12 -11
- package/dist/entry/sd-cli-local-update.js.map +1 -0
- package/dist/entry/{SdCliProject.js → sd-cli-project.js} +36 -33
- package/dist/entry/sd-cli-project.js.map +1 -0
- package/dist/index.d.ts +30 -30
- package/dist/index.js +30 -30
- package/dist/index.js.map +1 -1
- package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.js → sd-cli-ng-routes.file-generator.js} +13 -12
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +1 -0
- package/dist/pkg-builders/client/{SdClientBuildRunner.d.ts → sd-client.build-runner.d.ts} +3 -3
- package/dist/pkg-builders/client/{SdClientBuildRunner.js → sd-client.build-runner.js} +34 -24
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -0
- package/dist/pkg-builders/client/{SdNgBundlerContext.js → sd-ng.bundler-context.js} +5 -5
- package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +1 -0
- package/dist/pkg-builders/client/{SdNgBundler.d.ts → sd-ng.bundler.d.ts} +3 -3
- package/dist/pkg-builders/client/{SdNgBundler.js → sd-ng.bundler.js} +55 -96
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -0
- package/dist/pkg-builders/client/{createSdNgPlugin.d.ts → sd-ng.plugin-creator.d.ts} +2 -2
- package/dist/pkg-builders/client/{createSdNgPlugin.js → sd-ng.plugin-creator.js} +18 -15
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -0
- package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.js → sd-cli-index.file-generator.js} +8 -8
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -0
- package/dist/pkg-builders/lib/{SdJsLibBuildRunner.d.ts → sd-js-lib.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdJsLibBuildRunner.js → sd-js-lib.build-runner.js} +18 -15
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +1 -0
- package/dist/pkg-builders/lib/{SdTsLibBuildRunner.d.ts → sd-ts-lib.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdTsLibBuildRunner.js → sd-ts-lib.build-runner.js} +17 -15
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -0
- package/dist/pkg-builders/lib/{SdTsLibBuilder.d.ts → sd-ts-lib.builder.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdTsLibBuilder.js → sd-ts-lib.builder.js} +11 -10
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -0
- package/dist/pkg-builders/{SdMultiBuildRunner.d.ts → sd-multi.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/{SdMultiBuildRunner.js → sd-multi.build-runner.js} +13 -8
- package/dist/pkg-builders/sd-multi.build-runner.js.map +1 -0
- package/dist/pkg-builders/server/{SdServerBuildRunner.d.ts → sd-server.build-runner.d.ts} +3 -3
- package/dist/pkg-builders/server/{SdServerBuildRunner.js → sd-server.build-runner.js} +35 -32
- package/dist/pkg-builders/server/sd-server.build-runner.js.map +1 -0
- package/dist/pkg-builders/server/{SdServerBundler.d.ts → sd-server.bundler.d.ts} +2 -2
- package/dist/pkg-builders/server/{SdServerBundler.js → sd-server.bundler.js} +15 -13
- package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -0
- package/dist/pkg-builders/server/{createSdServerPlugin.d.ts → sd-server.plugin-creator.d.ts} +2 -2
- package/dist/pkg-builders/server/{createSdServerPlugin.js → sd-server.plugin-creator.js} +11 -8
- package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +1 -0
- package/dist/sd-cli.js +10 -10
- package/dist/sd-cli.js.map +1 -1
- package/dist/{ts-builder/SdTsCompiler.d.ts → ts-compiler/sd-ts-compiler.d.ts} +2 -2
- package/dist/{ts-builder/SdTsCompiler.js → ts-compiler/sd-ts-compiler.js} +72 -65
- package/dist/ts-compiler/sd-ts-compiler.js.map +1 -0
- package/dist/types/{build-plugin.type.d.ts → build-plugin.types.d.ts} +1 -1
- package/dist/types/build-plugin.types.js +3 -0
- package/dist/types/build-plugin.types.js.map +1 -0
- package/dist/types/{build-runner.type.d.ts → build-runner.types.d.ts} +2 -2
- package/dist/types/build-runner.types.js +3 -0
- package/dist/types/build-runner.types.js.map +1 -0
- package/dist/types/{build.type.d.ts → build.types.d.ts} +1 -1
- package/dist/types/build.types.js +2 -0
- package/dist/types/build.types.js.map +1 -0
- package/dist/types/common-configs.types.js +2 -0
- package/dist/types/common-configs.types.js.map +1 -0
- package/dist/types/config.types.js +2 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/types/{ts-compiler.type.d.ts → ts-compiler.types.d.ts} +3 -3
- package/dist/types/ts-compiler.types.js +5 -0
- package/dist/types/ts-compiler.types.js.map +1 -0
- package/dist/types/{workers.type.d.ts → worker.types.d.ts} +2 -2
- package/dist/types/worker.types.js +3 -0
- package/dist/types/worker.types.js.map +1 -0
- package/dist/utils/{SdCliConvertMessageUtil.d.ts → sd-cli-convert-message.utils.d.ts} +3 -3
- package/dist/utils/{SdCliConvertMessageUtil.js → sd-cli-convert-message.utils.js} +9 -6
- package/dist/utils/sd-cli-convert-message.utils.js.map +1 -0
- package/dist/utils/{SdCliPerformanceTime.js → sd-cli-performance-time.js} +1 -1
- package/dist/utils/sd-cli-performance-time.js.map +1 -0
- package/dist/workers/{build-runner-worker.js → build-runner.worker.js} +13 -10
- package/dist/workers/build-runner.worker.js.map +1 -0
- package/dist/workers/{server-worker.js → server.worker.js} +6 -5
- package/dist/workers/server.worker.js.map +1 -0
- package/package.json +7 -7
- package/src/entry/{SdAiCommand.ts → sd-cli-ai-command.ts} +18 -8
- package/src/entry/{SdCliCordova.ts → sd-cli-cordova.ts} +32 -32
- package/src/entry/{SdCliElectron.ts → sd-cli-electron.ts} +17 -17
- package/src/entry/{SdCliLocalUpdate.ts → sd-cli-local-update.ts} +11 -11
- package/src/entry/{SdCliProject.ts → sd-cli-project.ts} +36 -36
- package/src/index.ts +30 -30
- package/src/pkg-builders/client/{SdCliNgRoutesFileGenerator.ts → sd-cli-ng-routes.file-generator.ts} +14 -12
- package/src/pkg-builders/client/{SdClientBuildRunner.ts → sd-client.build-runner.ts} +52 -45
- package/src/pkg-builders/client/{SdNgBundlerContext.ts → sd-ng.bundler-context.ts} +4 -4
- package/src/pkg-builders/client/{SdNgBundler.ts → sd-ng.bundler.ts} +98 -130
- package/src/pkg-builders/client/{createSdNgPlugin.ts → sd-ng.plugin-creator.ts} +16 -16
- package/src/pkg-builders/lib/{SdCliIndexFileGenerator.ts → sd-cli-index.file-generator.ts} +7 -7
- package/src/pkg-builders/lib/{SdJsLibBuildRunner.ts → sd-js-lib.build-runner.ts} +16 -16
- package/src/pkg-builders/lib/{SdTsLibBuildRunner.ts → sd-ts-lib.build-runner.ts} +17 -17
- package/src/pkg-builders/lib/{SdTsLibBuilder.ts → sd-ts-lib.builder.ts} +10 -10
- package/src/pkg-builders/{SdMultiBuildRunner.ts → sd-multi.build-runner.ts} +12 -12
- package/src/pkg-builders/server/{SdServerBuildRunner.ts → sd-server.build-runner.ts} +34 -34
- package/src/pkg-builders/server/{SdServerBundler.ts → sd-server.bundler.ts} +15 -15
- package/src/pkg-builders/server/{createSdServerPlugin.ts → sd-server.plugin-creator.ts} +9 -9
- package/src/sd-cli.ts +10 -10
- package/src/{ts-builder/SdTsCompiler.ts → ts-compiler/sd-ts-compiler.ts} +146 -78
- package/src/types/{build-plugin.type.ts → build-plugin.types.ts} +1 -1
- package/src/types/{build-runner.type.ts → build-runner.types.ts} +2 -2
- package/src/types/{build.type.ts → build.types.ts} +1 -1
- package/src/types/{ts-compiler.type.ts → ts-compiler.types.ts} +3 -3
- package/src/types/{workers.type.ts → worker.types.ts} +2 -2
- package/src/utils/{SdCliConvertMessageUtil.ts → sd-cli-convert-message.utils.ts} +7 -7
- package/src/workers/{build-runner-worker.ts → build-runner.worker.ts} +12 -12
- package/src/workers/{server-worker.ts → server.worker.ts} +5 -5
- package/tsconfig.json +2 -1
- package/dist/entry/SdAiCommand.d.ts +0 -3
- package/dist/entry/SdAiCommand.js.map +0 -1
- package/dist/entry/SdCliCordova.js.map +0 -1
- package/dist/entry/SdCliElectron.js.map +0 -1
- package/dist/entry/SdCliLocalUpdate.js.map +0 -1
- package/dist/entry/SdCliProject.js.map +0 -1
- package/dist/pkg-builders/SdMultiBuildRunner.js.map +0 -1
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +0 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.js.map +0 -1
- package/dist/pkg-builders/client/SdNgBundler.js.map +0 -1
- package/dist/pkg-builders/client/SdNgBundlerContext.js.map +0 -1
- package/dist/pkg-builders/client/createSdNgPlugin.js.map +0 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +0 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +0 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +0 -1
- package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +0 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.js.map +0 -1
- package/dist/pkg-builders/server/SdServerBundler.js.map +0 -1
- package/dist/pkg-builders/server/createSdServerPlugin.js.map +0 -1
- package/dist/ts-builder/SdTsCompiler.js.map +0 -1
- package/dist/types/build-plugin.type.js +0 -2
- package/dist/types/build-plugin.type.js.map +0 -1
- package/dist/types/build-runner.type.js +0 -2
- package/dist/types/build-runner.type.js.map +0 -1
- package/dist/types/build.type.js +0 -2
- package/dist/types/build.type.js.map +0 -1
- package/dist/types/common-configs.type.js +0 -2
- package/dist/types/common-configs.type.js.map +0 -1
- package/dist/types/sd-configs.type.js +0 -2
- package/dist/types/sd-configs.type.js.map +0 -1
- package/dist/types/ts-compiler.type.js +0 -2
- package/dist/types/ts-compiler.type.js.map +0 -1
- package/dist/types/workers.type.js +0 -2
- package/dist/types/workers.type.js.map +0 -1
- package/dist/utils/SdCliConvertMessageUtil.js.map +0 -1
- package/dist/utils/SdCliPerformanceTime.js.map +0 -1
- package/dist/workers/build-runner-worker.js.map +0 -1
- package/dist/workers/server-worker.js.map +0 -1
- /package/dist/entry/{SdCliLocalUpdate.d.ts → sd-cli-local-update.d.ts} +0 -0
- /package/dist/entry/{SdCliProject.d.ts → sd-cli-project.d.ts} +0 -0
- /package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.d.ts → sd-cli-ng-routes.file-generator.d.ts} +0 -0
- /package/dist/pkg-builders/client/{SdNgBundlerContext.d.ts → sd-ng.bundler-context.d.ts} +0 -0
- /package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.d.ts → sd-cli-index.file-generator.d.ts} +0 -0
- /package/dist/types/{common-configs.type.d.ts → common-configs.types.d.ts} +0 -0
- /package/dist/types/{sd-configs.type.d.ts → config.types.d.ts} +0 -0
- /package/dist/utils/{SdCliPerformanceTime.d.ts → sd-cli-performance-time.d.ts} +0 -0
- /package/dist/workers/{build-runner-worker.d.ts → build-runner.worker.d.ts} +0 -0
- /package/dist/workers/{server-worker.d.ts → server.worker.d.ts} +0 -0
- /package/src/types/{common-configs.type.ts → common-configs.types.ts} +0 -0
- /package/src/types/{sd-configs.type.ts → config.types.ts} +0 -0
- /package/src/utils/{SdCliPerformanceTime.ts → sd-cli-performance-time.ts} +0 -0
|
@@ -2,12 +2,12 @@ import esbuild from "esbuild";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import os from "os";
|
|
4
4
|
import { JavaScriptTransformer } from "@angular/build/src/tools/esbuild/javascript-transformer";
|
|
5
|
-
import {
|
|
6
|
-
import { SdCliPerformanceTimer } from "../../utils/
|
|
7
|
-
import {
|
|
8
|
-
import { ISdCliNgPluginResultCache } from "../../types/build-plugin.
|
|
9
|
-
import { ISdTsCompilerResult } from "../../types/ts-compiler.
|
|
10
|
-
import { SdTsCompiler } from "../../ts-
|
|
5
|
+
import { SdLogger, PathUtils, type TNormPath } from "@simplysm/sd-core-node";
|
|
6
|
+
import { SdCliPerformanceTimer } from "../../utils/sd-cli-performance-time";
|
|
7
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
8
|
+
import { type ISdCliNgPluginResultCache } from "../../types/build-plugin.types";
|
|
9
|
+
import { type ISdTsCompilerResult } from "../../types/ts-compiler.types";
|
|
10
|
+
import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
|
|
11
11
|
|
|
12
12
|
export function createSdNgPlugin(conf: {
|
|
13
13
|
pkgPath: TNormPath;
|
|
@@ -29,7 +29,7 @@ export function createSdNgPlugin(conf: {
|
|
|
29
29
|
// let workerRevDepMap = new Map<TNormPath, Set<TNormPath>>();
|
|
30
30
|
|
|
31
31
|
let perf: SdCliPerformanceTimer;
|
|
32
|
-
const logger =
|
|
32
|
+
const logger = SdLogger.get(["simplysm", "sd-cli", "createSdNgPlugin"]);
|
|
33
33
|
|
|
34
34
|
function debug(...msg: any[]): void {
|
|
35
35
|
logger.debug(`[${path.basename(conf.pkgPath)}]`, ...msg);
|
|
@@ -106,7 +106,7 @@ export function createSdNgPlugin(conf: {
|
|
|
106
106
|
const javascriptTransformer = new JavaScriptTransformer(
|
|
107
107
|
{
|
|
108
108
|
thirdPartySourcemaps: conf.dev,
|
|
109
|
-
sourcemap: conf.dev,
|
|
109
|
+
sourcemap: false,//conf.dev,
|
|
110
110
|
jit: false,
|
|
111
111
|
advancedOptimizations: true,
|
|
112
112
|
},
|
|
@@ -136,7 +136,7 @@ export function createSdNgPlugin(conf: {
|
|
|
136
136
|
conf.result.watchFileSet = tsCompileResult.watchFileSet;
|
|
137
137
|
conf.result.affectedFileSet = tsCompileResult.affectedFileSet;
|
|
138
138
|
|
|
139
|
-
const tsEsbuildResult =
|
|
139
|
+
const tsEsbuildResult = SdCliConvertMessageUtils.convertToEsbuildFromBuildMessages(
|
|
140
140
|
tsCompileResult.messages,
|
|
141
141
|
conf.pkgPath,
|
|
142
142
|
);
|
|
@@ -168,12 +168,12 @@ export function createSdNgPlugin(conf: {
|
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
build.onLoad({ filter: /\.ts$/ }, async (args) => {
|
|
171
|
-
const output = outputContentsCacheMap.get(
|
|
171
|
+
const output = outputContentsCacheMap.get(PathUtils.norm(args.path));
|
|
172
172
|
if (output != null) {
|
|
173
173
|
return { contents: output, loader: "js" };
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(
|
|
176
|
+
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(PathUtils.norm(args.path))?.last();
|
|
177
177
|
if (!emittedJsFile) {
|
|
178
178
|
return {
|
|
179
179
|
errors: [
|
|
@@ -193,15 +193,15 @@ export function createSdNgPlugin(conf: {
|
|
|
193
193
|
|
|
194
194
|
const newContents = await javascriptTransformer.transformData(args.path, contents, true, sideEffects);
|
|
195
195
|
|
|
196
|
-
outputContentsCacheMap.set(
|
|
196
|
+
outputContentsCacheMap.set(PathUtils.norm(args.path), newContents);
|
|
197
197
|
|
|
198
198
|
return { contents: newContents, loader: "js" };
|
|
199
199
|
});
|
|
200
200
|
|
|
201
201
|
build.onLoad({ filter: /\.[cm]?js$/ }, async (args) => {
|
|
202
|
-
conf.result.watchFileSet!.add(
|
|
202
|
+
conf.result.watchFileSet!.add(PathUtils.norm(args.path));
|
|
203
203
|
|
|
204
|
-
const output = outputContentsCacheMap.get(
|
|
204
|
+
const output = outputContentsCacheMap.get(PathUtils.norm(args.path));
|
|
205
205
|
if (output != null) {
|
|
206
206
|
return { contents: output, loader: "js" };
|
|
207
207
|
}
|
|
@@ -213,7 +213,7 @@ export function createSdNgPlugin(conf: {
|
|
|
213
213
|
|
|
214
214
|
const newContents = await javascriptTransformer.transformFile(args.path, false, sideEffects);
|
|
215
215
|
|
|
216
|
-
outputContentsCacheMap.set(
|
|
216
|
+
outputContentsCacheMap.set(PathUtils.norm(args.path), newContents);
|
|
217
217
|
|
|
218
218
|
return {
|
|
219
219
|
contents: newContents,
|
|
@@ -232,7 +232,7 @@ export function createSdNgPlugin(conf: {
|
|
|
232
232
|
),
|
|
233
233
|
},
|
|
234
234
|
(args) => {
|
|
235
|
-
conf.result.watchFileSet!.add(
|
|
235
|
+
conf.result.watchFileSet!.add(PathUtils.norm(args.path));
|
|
236
236
|
return null;
|
|
237
237
|
},
|
|
238
238
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FsUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
|
|
4
4
|
export class SdCliIndexFileGenerator {
|
|
5
5
|
static watch(pkgPath: string, polyfills?: string[]) {
|
|
6
6
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
7
|
-
let cache =
|
|
7
|
+
let cache = FsUtils.exists(indexFilePath) ? FsUtils.readFile(indexFilePath) : undefined;
|
|
8
8
|
|
|
9
9
|
SdFsWatcher.watch([path.resolve(pkgPath, "src")]).onChange({ delay: 50 }, () => {
|
|
10
10
|
cache = this.run(pkgPath, polyfills, cache);
|
|
@@ -28,11 +28,11 @@ export class SdCliIndexFileGenerator {
|
|
|
28
28
|
// 내부 파일들 import
|
|
29
29
|
const filePaths = this.#getFilePaths(pkgPath);
|
|
30
30
|
for (const filePath of filePaths.orderBy()) {
|
|
31
|
-
const requirePath =
|
|
31
|
+
const requirePath = PathUtils.posix(path.relative(path.dirname(indexFilePath), filePath))
|
|
32
32
|
.replace(/\.tsx?$/, "")
|
|
33
33
|
.replace(/\/index$/, "");
|
|
34
34
|
|
|
35
|
-
const sourceTsFileContent =
|
|
35
|
+
const sourceTsFileContent = FsUtils.readFile(filePath);
|
|
36
36
|
if (sourceTsFileContent.split("\n").some((line) => line.startsWith("export "))) {
|
|
37
37
|
importTexts.push(`export * from "./${requirePath}";`);
|
|
38
38
|
} else {
|
|
@@ -42,7 +42,7 @@ export class SdCliIndexFileGenerator {
|
|
|
42
42
|
|
|
43
43
|
const content = importTexts.join("\n") + "\n";
|
|
44
44
|
if (content.trim() !== cache?.trim()) {
|
|
45
|
-
|
|
45
|
+
FsUtils.writeFile(indexFilePath, content);
|
|
46
46
|
}
|
|
47
47
|
return content;
|
|
48
48
|
}
|
|
@@ -50,10 +50,10 @@ export class SdCliIndexFileGenerator {
|
|
|
50
50
|
static #getFilePaths(pkgPath: string): string[] {
|
|
51
51
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
52
52
|
|
|
53
|
-
const tsconfig =
|
|
53
|
+
const tsconfig = FsUtils.readJson(path.resolve(pkgPath, "tsconfig.json"));
|
|
54
54
|
const entryFilePaths: string[] = tsconfig.files?.map((item) => path.resolve(pkgPath, item)) ?? [];
|
|
55
55
|
|
|
56
|
-
return
|
|
56
|
+
return FsUtils.glob(path.resolve(pkgPath, "src/**/*{.ts,.tsx}"), { nodir: true, ignore: tsconfig.excludes }).filter(
|
|
57
57
|
(item) => !entryFilePaths.includes(item) && item !== indexFilePath && !item.endsWith(".d.ts"),
|
|
58
58
|
);
|
|
59
59
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FsUtils, SdLogger, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
|
-
import {
|
|
4
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
5
5
|
// import { TSdLintWorkerType } from "../../types/workers.type";
|
|
6
|
-
import { ISdProjectConfig } from "../../types/
|
|
7
|
-
import { ISdBuildRunnerResult } from "../../types/build.
|
|
6
|
+
import { type ISdProjectConfig } from "../../types/config.types";
|
|
7
|
+
import { type ISdBuildRunnerResult } from "../../types/build.types";
|
|
8
8
|
import { ESLint } from "eslint";
|
|
9
9
|
|
|
10
10
|
export class SdJsLibBuildRunner extends EventEmitter {
|
|
11
|
-
private readonly _logger =
|
|
11
|
+
private readonly _logger = SdLogger.get(["simplysm", "sd-cli", "SdJsLibBuildRunner"]);
|
|
12
12
|
private readonly _pkgName: string;
|
|
13
13
|
|
|
14
14
|
// private readonly _lintWorker: SdWorker<TSdLintWorkerType>;
|
|
@@ -33,14 +33,14 @@ export class SdJsLibBuildRunner extends EventEmitter {
|
|
|
33
33
|
public async buildAsync(): Promise<ISdBuildRunnerResult> {
|
|
34
34
|
this._debug("LINT...");
|
|
35
35
|
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.js");
|
|
36
|
-
const srcFilePaths =
|
|
36
|
+
const srcFilePaths = FsUtils.glob(srcGlobPath);
|
|
37
37
|
|
|
38
38
|
const lintResults = await this.#lintAsync(new Set(srcFilePaths));
|
|
39
|
-
const messages =
|
|
39
|
+
const messages = SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults);
|
|
40
40
|
|
|
41
41
|
this._debug(`LINT 완료`);
|
|
42
42
|
return {
|
|
43
|
-
affectedFilePathSet: new Set(srcFilePaths.map((item) =>
|
|
43
|
+
affectedFilePathSet: new Set(srcFilePaths.map((item) => PathUtils.norm(item))),
|
|
44
44
|
buildMessages: messages,
|
|
45
45
|
emitFileSet: new Set(),
|
|
46
46
|
};
|
|
@@ -50,21 +50,21 @@ export class SdJsLibBuildRunner extends EventEmitter {
|
|
|
50
50
|
this.emit("change");
|
|
51
51
|
this._debug("LINT...");
|
|
52
52
|
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.js");
|
|
53
|
-
const srcFilePaths =
|
|
53
|
+
const srcFilePaths = FsUtils.glob(srcGlobPath);
|
|
54
54
|
|
|
55
55
|
const lintResults = await this.#lintAsync(new Set(srcFilePaths));
|
|
56
|
-
const messages =
|
|
56
|
+
const messages = SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults);
|
|
57
57
|
|
|
58
58
|
this._debug(`LINT 완료`);
|
|
59
59
|
const res: ISdBuildRunnerResult = {
|
|
60
|
-
affectedFilePathSet: new Set(srcFilePaths.map((item) =>
|
|
60
|
+
affectedFilePathSet: new Set(srcFilePaths.map((item) => PathUtils.norm(item))),
|
|
61
61
|
buildMessages: messages,
|
|
62
62
|
emitFileSet: new Set(),
|
|
63
63
|
};
|
|
64
64
|
this.emit("complete", res);
|
|
65
65
|
|
|
66
66
|
SdFsWatcher.watch([srcGlobPath]).onChange({ delay: 100 }, async (changeInfos) => {
|
|
67
|
-
const watchFilePaths = changeInfos.filter((item) =>
|
|
67
|
+
const watchFilePaths = changeInfos.filter((item) => FsUtils.exists(item.path)).map((item) => item.path);
|
|
68
68
|
if (watchFilePaths.length < 1) return;
|
|
69
69
|
|
|
70
70
|
this.emit("change");
|
|
@@ -72,12 +72,12 @@ export class SdJsLibBuildRunner extends EventEmitter {
|
|
|
72
72
|
this._debug("LINT...");
|
|
73
73
|
|
|
74
74
|
const watchLintResults = await this.#lintAsync(new Set(watchFilePaths));
|
|
75
|
-
const watchMessages =
|
|
75
|
+
const watchMessages = SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(watchLintResults);
|
|
76
76
|
|
|
77
77
|
this._debug(`LINT 완료`);
|
|
78
78
|
|
|
79
79
|
const watchRes: ISdBuildRunnerResult = {
|
|
80
|
-
affectedFilePathSet: new Set(changeInfos.map((item) =>
|
|
80
|
+
affectedFilePathSet: new Set(changeInfos.map((item) => PathUtils.norm(item.path))),
|
|
81
81
|
buildMessages: watchMessages,
|
|
82
82
|
emitFileSet: new Set(),
|
|
83
83
|
};
|
|
@@ -88,9 +88,9 @@ export class SdJsLibBuildRunner extends EventEmitter {
|
|
|
88
88
|
|
|
89
89
|
async #lintAsync(fileSet: Set<string>) {
|
|
90
90
|
const lintFilePaths = Array.from(fileSet)
|
|
91
|
-
.filter((item) =>
|
|
91
|
+
.filter((item) => PathUtils.isChildPath(item, this._pkgPath))
|
|
92
92
|
.filter((item) => item.endsWith(".js"))
|
|
93
|
-
.filter((item) =>
|
|
93
|
+
.filter((item) => FsUtils.exists(item));
|
|
94
94
|
|
|
95
95
|
if (lintFilePaths.length === 0) {
|
|
96
96
|
return [];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FsUtils, SdLogger, PathUtils, SdFsWatcher, type TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
|
-
import { SdCliIndexFileGenerator } from "./
|
|
5
|
-
import { SdTsLibBuilder } from "./
|
|
6
|
-
import { ISdLibPackageConfig, ISdProjectConfig } from "../../types/
|
|
7
|
-
import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.
|
|
4
|
+
import { SdCliIndexFileGenerator } from "./sd-cli-index.file-generator";
|
|
5
|
+
import { SdTsLibBuilder } from "./sd-ts-lib.builder";
|
|
6
|
+
import { type ISdLibPackageConfig, type ISdProjectConfig } from "../../types/config.types";
|
|
7
|
+
import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../../types/build.types";
|
|
8
8
|
|
|
9
9
|
export class SdTsLibBuildRunner extends EventEmitter {
|
|
10
|
-
private _logger =
|
|
10
|
+
private _logger = SdLogger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
|
|
11
11
|
|
|
12
12
|
private _projConf: ISdProjectConfig;
|
|
13
13
|
private _pkgPath: string;
|
|
@@ -24,10 +24,10 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
24
24
|
this._pkgConf = projConf.packages[path.basename(pkgPath)] as ISdLibPackageConfig;
|
|
25
25
|
|
|
26
26
|
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {}).mapMany((key) =>
|
|
27
|
-
|
|
27
|
+
FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
|
|
28
28
|
);
|
|
29
29
|
this._watchScopePathSet = new Set(
|
|
30
|
-
[path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) =>
|
|
30
|
+
[path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtils.norm(item)),
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -40,7 +40,7 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
40
40
|
|
|
41
41
|
public async buildAsync(): Promise<ISdBuildRunnerResult> {
|
|
42
42
|
this._debug("dist 초기화...");
|
|
43
|
-
|
|
43
|
+
FsUtils.remove(path.resolve(this._pkgPath, "dist"));
|
|
44
44
|
|
|
45
45
|
if (!this._pkgConf.noGenIndex) {
|
|
46
46
|
this._debug("GEN index.ts...");
|
|
@@ -59,7 +59,7 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
59
59
|
this.emit("change");
|
|
60
60
|
|
|
61
61
|
this._debug("dist 초기화...");
|
|
62
|
-
|
|
62
|
+
FsUtils.remove(path.resolve(this._pkgPath, "dist"));
|
|
63
63
|
|
|
64
64
|
if (!this._pkgConf.noGenIndex) {
|
|
65
65
|
this._debug("WATCH GEN index.ts...");
|
|
@@ -82,7 +82,7 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
82
82
|
|
|
83
83
|
this.emit("change");
|
|
84
84
|
|
|
85
|
-
const changeFileSet = new Set(currentChangeInfos.map((item) =>
|
|
85
|
+
const changeFileSet = new Set(currentChangeInfos.map((item) => PathUtils.norm(item.path)));
|
|
86
86
|
|
|
87
87
|
const watchResult = await this._runAsync(true, changeFileSet);
|
|
88
88
|
const watchRes: ISdBuildRunnerResult = {
|
|
@@ -107,14 +107,14 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
107
107
|
emitFileSet: Set<TNormPath>;
|
|
108
108
|
}> {
|
|
109
109
|
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {})
|
|
110
|
-
.mapMany((key) =>
|
|
111
|
-
.map((item) =>
|
|
110
|
+
.mapMany((key) => FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key)))
|
|
111
|
+
.map((item) => PathUtils.norm(item));
|
|
112
112
|
|
|
113
113
|
this._debug(`BUILD...`);
|
|
114
114
|
this._builder ??= new SdTsLibBuilder(
|
|
115
|
-
|
|
115
|
+
PathUtils.norm(this._pkgPath),
|
|
116
116
|
dev,
|
|
117
|
-
[
|
|
117
|
+
[PathUtils.norm(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtils.norm(item)),
|
|
118
118
|
);
|
|
119
119
|
const buildResult = await this._builder.buildAsync(modifiedFileSet);
|
|
120
120
|
|
|
@@ -122,8 +122,8 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
122
122
|
const watchFileSet = new Set(
|
|
123
123
|
Array.from(buildResult.watchFileSet).filter(
|
|
124
124
|
(item) =>
|
|
125
|
-
|
|
126
|
-
localUpdatePaths.some((lu) =>
|
|
125
|
+
PathUtils.isChildPath(item, path.resolve(this._pkgPath, "../")) ||
|
|
126
|
+
localUpdatePaths.some((lu) => PathUtils.isChildPath(item, lu)),
|
|
127
127
|
),
|
|
128
128
|
);
|
|
129
129
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ISdBuildMessage } from "../../types/build.
|
|
5
|
-
import { SdTsCompiler } from "../../ts-
|
|
2
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
3
|
+
import { FsUtils, PathUtils, type TNormPath } from "@simplysm/sd-core-node";
|
|
4
|
+
import { type ISdBuildMessage } from "../../types/build.types";
|
|
5
|
+
import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
|
|
6
6
|
|
|
7
7
|
export class SdTsLibBuilder {
|
|
8
8
|
private _tsCompiler: SdTsCompiler;
|
|
@@ -16,7 +16,7 @@ export class SdTsLibBuilder {
|
|
|
16
16
|
pkgPath: this._pkgPath,
|
|
17
17
|
additionalOptions: { declaration: true },
|
|
18
18
|
isDevMode: dev,
|
|
19
|
-
globalStyleFilePath:
|
|
19
|
+
globalStyleFilePath: PathUtils.norm(this._pkgPath, "src/styles.scss"),
|
|
20
20
|
isForBundle: false,
|
|
21
21
|
watchScopePaths: watchScopePaths,
|
|
22
22
|
});
|
|
@@ -36,7 +36,7 @@ export class SdTsLibBuilder {
|
|
|
36
36
|
if (emitFileInfos) {
|
|
37
37
|
for (const emitFileInfo of emitFileInfos) {
|
|
38
38
|
if (emitFileInfo.outAbsPath != null) {
|
|
39
|
-
|
|
39
|
+
FsUtils.writeFile(emitFileInfo.outAbsPath, emitFileInfo.text);
|
|
40
40
|
emitFileSet.add(emitFileInfo.outAbsPath);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -45,9 +45,9 @@ export class SdTsLibBuilder {
|
|
|
45
45
|
const globalStylesheetBundlingResult = tsCompileResult.stylesheetBundlingResultMap.get(emitFile);
|
|
46
46
|
if (globalStylesheetBundlingResult) {
|
|
47
47
|
for (const outputFile of globalStylesheetBundlingResult.outputFiles ?? []) {
|
|
48
|
-
const distPath =
|
|
49
|
-
if (
|
|
50
|
-
|
|
48
|
+
const distPath = PathUtils.norm(this._pkgPath, "dist", path.relative(this._pkgPath, outputFile.path));
|
|
49
|
+
if (PathUtils.isChildPath(distPath, path.resolve(this._pkgPath, "dist"))) {
|
|
50
|
+
FsUtils.writeFile(distPath, outputFile.text);
|
|
51
51
|
emitFileSet.add(distPath);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -55,7 +55,7 @@ export class SdTsLibBuilder {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
const styleResults = Array.from(tsCompileResult.stylesheetBundlingResultMap.values()).mapMany((item) =>
|
|
58
|
-
|
|
58
|
+
SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(item, this._pkgPath),
|
|
59
59
|
);
|
|
60
60
|
|
|
61
61
|
return {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FsUtils, SdLogger, PathUtils, SdWorker, type TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
|
-
import { ISdServerPackageConfig } from "../types/
|
|
5
|
-
import { ISdBuildMessage, ISdBuildRunnerResult } from "../types/build.
|
|
6
|
-
import { TSdBuildRunnerWorkerType, TServerWorkerType } from "../types/
|
|
7
|
-
import { INpmConfig } from "../types/common-configs.
|
|
8
|
-
import { ISdBuildRunnerWorkerRequest } from "../types/build-runner.
|
|
4
|
+
import { type ISdServerPackageConfig } from "../types/config.types";
|
|
5
|
+
import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../types/build.types";
|
|
6
|
+
import { type TSdBuildRunnerWorkerType, type TServerWorkerType } from "../types/worker.types";
|
|
7
|
+
import { type INpmConfig } from "../types/common-configs.types";
|
|
8
|
+
import { type ISdBuildRunnerWorkerRequest } from "../types/build-runner.types";
|
|
9
9
|
|
|
10
10
|
export class SdMultiBuildRunner extends EventEmitter {
|
|
11
|
-
#logger =
|
|
11
|
+
#logger = SdLogger.get(["simplysm", "sd-cli", "SdMultiBuildRunner"]);
|
|
12
12
|
|
|
13
13
|
#busyCount = 0;
|
|
14
14
|
|
|
@@ -43,7 +43,7 @@ export class SdMultiBuildRunner extends EventEmitter {
|
|
|
43
43
|
async runAsync(req: ISdBuildRunnerWorkerRequest & { cmd: "watch" }): Promise<void>;
|
|
44
44
|
async runAsync(req: ISdBuildRunnerWorkerRequest & { cmd: "build" }): Promise<ISdBuildMessage[]>;
|
|
45
45
|
async runAsync(req: ISdBuildRunnerWorkerRequest): Promise<ISdBuildMessage[] | void> {
|
|
46
|
-
const worker = new SdWorker<TSdBuildRunnerWorkerType>(import.meta.resolve("../workers/build-runner
|
|
46
|
+
const worker = new SdWorker<TSdBuildRunnerWorkerType>(import.meta.resolve("../workers/build-runner.worker"))
|
|
47
47
|
.on("change", () => {
|
|
48
48
|
if (this.#busyCount === 0) {
|
|
49
49
|
this.emit("change");
|
|
@@ -80,7 +80,7 @@ export class SdMultiBuildRunner extends EventEmitter {
|
|
|
80
80
|
#onComplete(req: ISdBuildRunnerWorkerRequest, result: ISdBuildRunnerResult) {
|
|
81
81
|
this.#resultCache.delete(req.pkgPath);
|
|
82
82
|
for (const affectedFilePath of result.affectedFilePathSet) {
|
|
83
|
-
if (
|
|
83
|
+
if (PathUtils.isChildPath(affectedFilePath, req.pkgPath)) {
|
|
84
84
|
this.#resultCache.delete(affectedFilePath);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -215,16 +215,16 @@ export class SdMultiBuildRunner extends EventEmitter {
|
|
|
215
215
|
worker: SdWorker<TServerWorkerType>;
|
|
216
216
|
port: number;
|
|
217
217
|
}> {
|
|
218
|
-
const logger =
|
|
218
|
+
const logger = SdLogger.get(["simplysm", "sd-cli", "SdMultiBuildRunner", "#restartServerAsync"]);
|
|
219
219
|
|
|
220
220
|
if (prevWorker) {
|
|
221
221
|
await prevWorker.killAsync();
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
const npmConf =
|
|
225
|
-
"path" in pkgInfo ? (
|
|
225
|
+
"path" in pkgInfo ? (FsUtils.readJson(path.resolve(pkgInfo.path, "package.json")) as INpmConfig) : undefined;
|
|
226
226
|
|
|
227
|
-
const worker = new SdWorker<TServerWorkerType>(import.meta.resolve("../workers/server
|
|
227
|
+
const worker = new SdWorker<TServerWorkerType>(import.meta.resolve("../workers/server.worker"), {
|
|
228
228
|
env: {
|
|
229
229
|
NODE_ENV: "development",
|
|
230
230
|
TZ: "Asia/Seoul",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
|
-
import {
|
|
2
|
+
import { FsUtils, SdLogger, PathUtils, SdFsWatcher, type TNormPath } from "@simplysm/sd-core-node";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import {
|
|
5
|
-
import { SdServerBundler } from "./
|
|
6
|
-
import { ISdProjectConfig, ISdServerPackageConfig } from "../../types/
|
|
7
|
-
import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.
|
|
8
|
-
import { INpmConfig, ITsConfig } from "../../types/common-configs.
|
|
4
|
+
import { StringUtils } from "@simplysm/sd-core-common";
|
|
5
|
+
import { SdServerBundler } from "./sd-server.bundler";
|
|
6
|
+
import { type ISdProjectConfig, type ISdServerPackageConfig } from "../../types/config.types";
|
|
7
|
+
import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../../types/build.types";
|
|
8
|
+
import { type INpmConfig, type ITsConfig } from "../../types/common-configs.types";
|
|
9
9
|
|
|
10
10
|
export class SdServerBuildRunner extends EventEmitter {
|
|
11
|
-
private _logger =
|
|
11
|
+
private _logger = SdLogger.get(["simplysm", "sd-cli", "SdCliServerBuildRunner"]);
|
|
12
12
|
private _pkgConf: ISdServerPackageConfig;
|
|
13
13
|
private _serverBundler?: SdServerBundler;
|
|
14
14
|
private _extModules?: { name: string; exists: boolean }[];
|
|
@@ -22,10 +22,10 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
22
22
|
this._pkgConf = this._projConf.packages[path.basename(_pkgPath)] as ISdServerPackageConfig;
|
|
23
23
|
|
|
24
24
|
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {}).mapMany((key) =>
|
|
25
|
-
|
|
25
|
+
FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
|
|
26
26
|
);
|
|
27
27
|
this._watchScopePathSet = new Set(
|
|
28
|
-
[path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) =>
|
|
28
|
+
[path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtils.norm(item)),
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -40,11 +40,11 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
40
40
|
this.emit("change");
|
|
41
41
|
|
|
42
42
|
this._debug("dist 초기화...");
|
|
43
|
-
|
|
43
|
+
FsUtils.remove(path.resolve(this._pkgPath, "dist"));
|
|
44
44
|
|
|
45
45
|
this._debug("GEN .config...");
|
|
46
46
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
47
|
-
|
|
47
|
+
FsUtils.writeFile(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
48
48
|
|
|
49
49
|
const result = await this._runAsync(true);
|
|
50
50
|
const res: ISdBuildRunnerResult = {
|
|
@@ -64,7 +64,7 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
64
64
|
|
|
65
65
|
const watchResult = await this._runAsync(
|
|
66
66
|
true,
|
|
67
|
-
new Set(currentChangeInfos.map((item) =>
|
|
67
|
+
new Set(currentChangeInfos.map((item) => PathUtils.norm(item.path))),
|
|
68
68
|
);
|
|
69
69
|
const watchRes: ISdBuildRunnerResult = {
|
|
70
70
|
affectedFilePathSet: watchResult.affectedFileSet,
|
|
@@ -79,16 +79,16 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
public async buildAsync(): Promise<ISdBuildRunnerResult> {
|
|
82
|
-
const projNpmConfig =
|
|
83
|
-
const npmConfig =
|
|
82
|
+
const projNpmConfig = FsUtils.readJson(path.resolve(process.cwd(), "package.json")) as INpmConfig;
|
|
83
|
+
const npmConfig = FsUtils.readJson(path.resolve(this._pkgPath, "package.json")) as INpmConfig;
|
|
84
84
|
const extModules = await this._getExternalModulesAsync();
|
|
85
85
|
|
|
86
86
|
this._debug("dist 초기화...");
|
|
87
|
-
|
|
87
|
+
FsUtils.remove(path.resolve(this._pkgPath, "dist"));
|
|
88
88
|
|
|
89
89
|
this._debug("GEN .config.json...");
|
|
90
90
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
91
|
-
|
|
91
|
+
FsUtils.writeJson(confDistPath, this._pkgConf.configs ?? {}, { space: 2 });
|
|
92
92
|
|
|
93
93
|
this._debug("GEN package.json...");
|
|
94
94
|
{
|
|
@@ -113,17 +113,17 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
113
113
|
|
|
114
114
|
distNpmConfig.volta = projNpmConfig.volta;
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
FsUtils.writeJson(path.resolve(this._pkgPath, "dist/package.json"), distNpmConfig, { space: 2 });
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
this._debug("GEN .yarnrc.yml...");
|
|
120
120
|
{
|
|
121
|
-
|
|
121
|
+
FsUtils.writeFile(path.resolve(this._pkgPath, "dist/.yarnrc.yml"), "nodeLinker: node-modules");
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
this._debug("GEN openssl.cnf...");
|
|
125
125
|
{
|
|
126
|
-
|
|
126
|
+
FsUtils.writeFile(
|
|
127
127
|
path.resolve(this._pkgPath, "dist/openssl.cnf"),
|
|
128
128
|
`
|
|
129
129
|
nodejs_conf = openssl_init
|
|
@@ -187,7 +187,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
187
187
|
.replaceAll("\n ", "\n")
|
|
188
188
|
.trim();
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
FsUtils.writeFile(path.resolve(this._pkgPath, "dist/pm2.config.cjs"), str);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
if (this._pkgConf.iis) {
|
|
@@ -195,7 +195,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
195
195
|
|
|
196
196
|
const iisDistPath = path.resolve(this._pkgPath, "dist/web.config");
|
|
197
197
|
const serverExeFilePath = this._pkgConf.iis.nodeExeFilePath ?? "C:\\Program Files\\nodejs\\node.exe";
|
|
198
|
-
|
|
198
|
+
FsUtils.writeFile(
|
|
199
199
|
iisDistPath,
|
|
200
200
|
`
|
|
201
201
|
<configuration>
|
|
@@ -248,11 +248,11 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
248
248
|
emitFileSet: Set<TNormPath>;
|
|
249
249
|
}> {
|
|
250
250
|
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {}).mapMany((key) =>
|
|
251
|
-
|
|
251
|
+
FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
|
|
252
252
|
);
|
|
253
253
|
|
|
254
254
|
this._debug(`BUILD 준비...`);
|
|
255
|
-
const tsConfig =
|
|
255
|
+
const tsConfig = FsUtils.readJson(path.resolve(this._pkgPath, "tsconfig.json")) as ITsConfig;
|
|
256
256
|
this._extModules = this._extModules ?? (await this._getExternalModulesAsync());
|
|
257
257
|
this._serverBundler =
|
|
258
258
|
this._serverBundler ??
|
|
@@ -263,10 +263,10 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
263
263
|
? tsConfig.files.map((item) => path.resolve(this._pkgPath, item))
|
|
264
264
|
: [
|
|
265
265
|
path.resolve(this._pkgPath, "src/main.ts"),
|
|
266
|
-
...
|
|
266
|
+
...FsUtils.glob(path.resolve(this._pkgPath, "src/workers/*.ts")),
|
|
267
267
|
],
|
|
268
268
|
external: this._extModules.map((item) => item.name),
|
|
269
|
-
watchScopePaths: [path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) =>
|
|
269
|
+
watchScopePaths: [path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtils.norm(item)),
|
|
270
270
|
});
|
|
271
271
|
|
|
272
272
|
this._debug(`BUILD...`);
|
|
@@ -276,8 +276,8 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
276
276
|
const watchFileSet = new Set(
|
|
277
277
|
Array.from(bundleResult.watchFileSet).filter(
|
|
278
278
|
(item) =>
|
|
279
|
-
|
|
280
|
-
localUpdatePaths.some((lu) =>
|
|
279
|
+
PathUtils.isChildPath(item, path.resolve(this._pkgPath, "../")) ||
|
|
280
|
+
localUpdatePaths.some((lu) => PathUtils.isChildPath(item, lu)),
|
|
281
281
|
),
|
|
282
282
|
);
|
|
283
283
|
|
|
@@ -305,7 +305,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
305
305
|
const npmConfigMap = new Map<string, INpmConfig>();
|
|
306
306
|
|
|
307
307
|
const fn = async (currPath: string): Promise<void> => {
|
|
308
|
-
const npmConfig = npmConfigMap.getOrCreate(currPath,
|
|
308
|
+
const npmConfig = npmConfigMap.getOrCreate(currPath, FsUtils.readJson(path.resolve(currPath, "package.json")));
|
|
309
309
|
|
|
310
310
|
const deps = {
|
|
311
311
|
defaults: [
|
|
@@ -326,16 +326,16 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
326
326
|
if (loadedModuleNames.includes(moduleName)) continue;
|
|
327
327
|
loadedModuleNames.push(moduleName);
|
|
328
328
|
|
|
329
|
-
const modulePath =
|
|
329
|
+
const modulePath = FsUtils.findAllParentChildPaths(
|
|
330
330
|
"node_modules/" + moduleName,
|
|
331
331
|
currPath,
|
|
332
332
|
path.resolve(this._pkgPath, "../../"),
|
|
333
333
|
).first();
|
|
334
|
-
if (
|
|
334
|
+
if (StringUtils.isNullOrEmpty(modulePath)) {
|
|
335
335
|
continue;
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
if (
|
|
338
|
+
if (FsUtils.glob(path.resolve(modulePath, "binding.gyp")).length > 0) {
|
|
339
339
|
results.push({
|
|
340
340
|
name: moduleName,
|
|
341
341
|
exists: true,
|
|
@@ -356,12 +356,12 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
356
356
|
if (loadedModuleNames.includes(optModuleName)) continue;
|
|
357
357
|
loadedModuleNames.push(optModuleName);
|
|
358
358
|
|
|
359
|
-
const optModulePath =
|
|
359
|
+
const optModulePath = FsUtils.findAllParentChildPaths(
|
|
360
360
|
"node_modules/" + optModuleName,
|
|
361
361
|
currPath,
|
|
362
362
|
path.resolve(this._pkgPath, "../../"),
|
|
363
363
|
).first();
|
|
364
|
-
if (
|
|
364
|
+
if (StringUtils.isNullOrEmpty(optModulePath)) {
|
|
365
365
|
results.push({
|
|
366
366
|
name: optModuleName,
|
|
367
367
|
exists: false,
|
|
@@ -369,7 +369,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
369
369
|
continue;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
-
if (
|
|
372
|
+
if (FsUtils.glob(path.resolve(optModulePath, "binding.gyp")).length > 0) {
|
|
373
373
|
results.push({
|
|
374
374
|
name: optModuleName,
|
|
375
375
|
exists: true,
|