@simplysm/sd-cli 12.7.5 → 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/{SdAiCommand.d.ts → sd-cli-ai-command.d.ts} +1 -1
- package/dist/entry/{SdAiCommand.js → sd-cli-ai-command.js} +5 -5
- 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 -33
- 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 -18
- package/dist/entry/sd-cli-electron.js.map +1 -0
- package/dist/entry/{SdCliLocalUpdate.js → sd-cli-local-update.js} +12 -12
- package/dist/entry/sd-cli-local-update.js.map +1 -0
- package/dist/entry/{SdCliProject.js → sd-cli-project.js} +36 -36
- 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} +12 -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} +2 -2
- package/dist/pkg-builders/client/{SdClientBuildRunner.js → sd-client.build-runner.js} +34 -27
- 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} +2 -2
- package/dist/pkg-builders/client/{SdNgBundler.js → sd-ng.bundler.js} +55 -37
- 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} +1 -1
- package/dist/pkg-builders/client/{createSdNgPlugin.js → sd-ng.plugin-creator.js} +17 -17
- 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} +17 -17
- 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 -17
- 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} +1 -1
- package/dist/pkg-builders/lib/{SdTsLibBuilder.js → sd-ts-lib.builder.js} +11 -11
- 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 -13
- 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} +2 -2
- package/dist/pkg-builders/server/{SdServerBuildRunner.js → sd-server.build-runner.js} +35 -35
- 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} +1 -1
- package/dist/pkg-builders/server/{SdServerBundler.js → sd-server.bundler.js} +15 -15
- 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} +1 -1
- package/dist/pkg-builders/server/{createSdServerPlugin.js → sd-server.plugin-creator.js} +10 -10
- 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} +1 -1
- package/dist/{ts-builder/SdTsCompiler.js → ts-compiler/sd-ts-compiler.js} +60 -60
- package/dist/ts-compiler/sd-ts-compiler.js.map +1 -0
- package/dist/types/{build-plugin.type.js → build-plugin.types.js} +1 -1
- package/dist/types/build-plugin.types.js.map +1 -0
- package/dist/types/{build-runner.type.d.ts → build-runner.types.d.ts} +1 -1
- package/dist/types/build-runner.types.js +3 -0
- package/dist/types/build-runner.types.js.map +1 -0
- package/dist/types/{build.type.js → build.types.js} +1 -1
- 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} +1 -1
- package/dist/types/{ts-compiler.type.js → ts-compiler.types.js} +2 -2
- 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} +2 -2
- package/dist/utils/{SdCliConvertMessageUtil.js → sd-cli-convert-message.utils.js} +7 -7
- 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 -13
- package/dist/workers/build-runner.worker.js.map +1 -0
- package/dist/workers/{server-worker.js → server.worker.js} +6 -6
- package/dist/workers/server.worker.js.map +1 -0
- package/package.json +5 -5
- package/src/entry/{SdAiCommand.ts → sd-cli-ai-command.ts} +4 -4
- 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} +11 -11
- 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} +94 -61
- 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} +14 -14
- 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} +60 -60
- package/src/types/{build-runner.type.ts → build-runner.types.ts} +1 -1
- package/src/types/{ts-compiler.type.ts → ts-compiler.types.ts} +1 -1
- package/src/types/{workers.type.ts → worker.types.ts} +2 -2
- package/src/utils/{SdCliConvertMessageUtil.ts → sd-cli-convert-message.utils.ts} +6 -6
- 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/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.map +0 -1
- package/dist/types/build-runner.type.js +0 -3
- package/dist/types/build-runner.type.js.map +0 -1
- 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.map +0 -1
- package/dist/types/workers.type.js +0 -3
- 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/{build-plugin.type.d.ts → build-plugin.types.d.ts} +0 -0
- /package/dist/types/{build.type.d.ts → build.types.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/{build-plugin.type.ts → build-plugin.types.ts} +0 -0
- /package/src/types/{build.type.ts → build.types.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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { type 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 { type ISdServerPackageConfig } from "../types/
|
|
5
|
-
import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../types/build.
|
|
6
|
-
import { type TSdBuildRunnerWorkerType, type TServerWorkerType } from "../types/
|
|
7
|
-
import { type INpmConfig } from "../types/common-configs.
|
|
8
|
-
import { type 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 { type ISdProjectConfig, type ISdServerPackageConfig } from "../../types/
|
|
7
|
-
import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../../types/build.
|
|
8
|
-
import { type INpmConfig, type 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,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import esbuild from "esbuild";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { type ISdCliServerPluginResultCache } from "../../types/build-plugin.
|
|
6
|
-
import { type ISdBuildMessage } from "../../types/build.
|
|
7
|
-
import { createSdServerPlugin } from "./
|
|
3
|
+
import { FsUtils, SdLogger, PathUtils, type TNormPath } from "@simplysm/sd-core-node";
|
|
4
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
5
|
+
import { type ISdCliServerPluginResultCache } from "../../types/build-plugin.types";
|
|
6
|
+
import { type ISdBuildMessage } from "../../types/build.types";
|
|
7
|
+
import { createSdServerPlugin } from "./sd-server.plugin-creator";
|
|
8
8
|
import { type BuildOutputFile, BuildOutputFileType } from "@angular/build/src/tools/esbuild/bundler-context";
|
|
9
9
|
import { convertOutputFile } from "@angular/build/src/tools/esbuild/utils";
|
|
10
10
|
import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
|
|
11
11
|
|
|
12
12
|
export class SdServerBundler {
|
|
13
|
-
readonly #logger =
|
|
13
|
+
readonly #logger = SdLogger.get(["simplysm", "sd-cli", "SdServerBundler"]);
|
|
14
14
|
|
|
15
15
|
#context?: esbuild.BuildContext;
|
|
16
16
|
|
|
@@ -122,10 +122,10 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
122
122
|
result.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root)) ?? [];
|
|
123
123
|
|
|
124
124
|
for (const outputFile of outputFiles) {
|
|
125
|
-
const distFilePath =
|
|
125
|
+
const distFilePath = PathUtils.norm(this._opt.pkgPath, outputFile.path);
|
|
126
126
|
const prev = this.#outputCache.get(distFilePath);
|
|
127
127
|
if (prev !== Buffer.from(outputFile.contents).toString("base64")) {
|
|
128
|
-
|
|
128
|
+
FsUtils.writeFile(distFilePath, outputFile.contents);
|
|
129
129
|
this.#outputCache.set(distFilePath, Buffer.from(outputFile.contents).toString("base64"));
|
|
130
130
|
emitFileSet.add(distFilePath);
|
|
131
131
|
}
|
|
@@ -141,12 +141,12 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
141
141
|
);
|
|
142
142
|
|
|
143
143
|
for (const assetFile of assetFiles) {
|
|
144
|
-
const prev = this.#outputCache.get(
|
|
145
|
-
const curr =
|
|
144
|
+
const prev = this.#outputCache.get(PathUtils.norm(assetFile.source));
|
|
145
|
+
const curr = FsUtils.lstat(assetFile.source).mtime.getTime();
|
|
146
146
|
if (prev !== curr) {
|
|
147
|
-
|
|
148
|
-
this.#outputCache.set(
|
|
149
|
-
emitFileSet.add(
|
|
147
|
+
FsUtils.copy(assetFile.source, path.resolve(this._opt.pkgPath, "dist", assetFile.destination));
|
|
148
|
+
this.#outputCache.set(PathUtils.norm(assetFile.source), curr);
|
|
149
|
+
emitFileSet.add(PathUtils.norm(assetFile.destination));
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -162,7 +162,7 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
162
162
|
return {
|
|
163
163
|
watchFileSet: this.#resultCache.watchFileSet!,
|
|
164
164
|
affectedFileSet: this.#resultCache.affectedFileSet!,
|
|
165
|
-
results:
|
|
165
|
+
results: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(result, this._opt.pkgPath),
|
|
166
166
|
emitFileSet: emitFileSet,
|
|
167
167
|
};
|
|
168
168
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import esbuild from "esbuild";
|
|
2
|
-
import {
|
|
3
|
-
import { type ISdCliServerPluginResultCache } from "../../types/build-plugin.
|
|
4
|
-
import {
|
|
5
|
-
import { type ISdTsCompilerResult } from "../../types/ts-compiler.
|
|
6
|
-
import { SdTsCompiler } from "../../ts-
|
|
2
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
3
|
+
import { type ISdCliServerPluginResultCache } from "../../types/build-plugin.types";
|
|
4
|
+
import { PathUtils, type TNormPath } from "@simplysm/sd-core-node";
|
|
5
|
+
import { type ISdTsCompilerResult } from "../../types/ts-compiler.types";
|
|
6
|
+
import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
|
|
7
7
|
|
|
8
8
|
export function createSdServerPlugin(conf: {
|
|
9
9
|
pkgPath: TNormPath;
|
|
@@ -32,11 +32,11 @@ export function createSdServerPlugin(conf: {
|
|
|
32
32
|
conf.result.affectedFileSet = tsCompileResult.affectedFileSet;
|
|
33
33
|
|
|
34
34
|
//-- return err/warn
|
|
35
|
-
return
|
|
35
|
+
return SdCliConvertMessageUtils.convertToEsbuildFromBuildMessages(tsCompileResult.messages, conf.pkgPath);
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
build.onLoad({ filter: /\.ts$/ }, (args) => {
|
|
39
|
-
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(
|
|
39
|
+
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(PathUtils.norm(args.path))?.last();
|
|
40
40
|
if (!emittedJsFile) {
|
|
41
41
|
return {
|
|
42
42
|
errors: [
|
|
@@ -52,7 +52,7 @@ export function createSdServerPlugin(conf: {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
build.onLoad({ filter: /\.[cm]?js$/ }, (args) => {
|
|
55
|
-
conf.result.watchFileSet!.add(
|
|
55
|
+
conf.result.watchFileSet!.add(PathUtils.norm(args.path));
|
|
56
56
|
return null;
|
|
57
57
|
});
|
|
58
58
|
|
|
@@ -67,7 +67,7 @@ export function createSdServerPlugin(conf: {
|
|
|
67
67
|
),
|
|
68
68
|
},
|
|
69
69
|
(args) => {
|
|
70
|
-
conf.result.watchFileSet!.add(
|
|
70
|
+
conf.result.watchFileSet!.add(PathUtils.norm(args.path));
|
|
71
71
|
return null;
|
|
72
72
|
},
|
|
73
73
|
);
|
package/src/sd-cli.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import yargs from "yargs";
|
|
4
4
|
import { hideBin } from "yargs/helpers";
|
|
5
|
-
import { SdCliProject } from "./entry/
|
|
6
|
-
import {
|
|
5
|
+
import { SdCliProject } from "./entry/sd-cli-project";
|
|
6
|
+
import { SdLogger, SdLoggerSeverity } from "@simplysm/sd-core-node";
|
|
7
7
|
import { EventEmitter } from "events";
|
|
8
|
-
import { SdCliElectron } from "./entry/
|
|
9
|
-
import { SdCliLocalUpdate } from "./entry/
|
|
10
|
-
import { SdCliCordova } from "./entry/
|
|
11
|
-
import {
|
|
8
|
+
import { SdCliElectron } from "./entry/sd-cli-electron";
|
|
9
|
+
import { SdCliLocalUpdate } from "./entry/sd-cli-local-update";
|
|
10
|
+
import { SdCliCordova } from "./entry/sd-cli-cordova";
|
|
11
|
+
import { SdCliAiCommand } from "./entry/sd-cli-ai-command";
|
|
12
12
|
|
|
13
13
|
Error.stackTraceLimit = Infinity;
|
|
14
14
|
EventEmitter.defaultMaxListeners = 0;
|
|
@@ -183,14 +183,14 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
183
183
|
|
|
184
184
|
if (Boolean(argv.debug)) {
|
|
185
185
|
process.env["SD_DEBUG"] = "true";
|
|
186
|
-
|
|
186
|
+
SdLogger.setConfig({
|
|
187
187
|
console: {
|
|
188
|
-
level:
|
|
188
|
+
level: SdLoggerSeverity.debug,
|
|
189
189
|
},
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
else {
|
|
193
|
-
|
|
193
|
+
SdLogger.setConfig({
|
|
194
194
|
dot: true,
|
|
195
195
|
});
|
|
196
196
|
}
|
|
@@ -246,7 +246,7 @@ else if (argv._[0] === "run-cordova") {
|
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
248
|
else if (argv._[0] === "commit") {
|
|
249
|
-
await
|
|
249
|
+
await SdCliAiCommand.commitAsync();
|
|
250
250
|
}
|
|
251
251
|
else {
|
|
252
252
|
throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
|