@simplysm/sd-cli 12.5.22 → 12.5.24
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/SdCliCordova.js +2 -2
- package/dist/entry/SdCliCordova.js.map +1 -1
- package/dist/entry/SdCliElectron.js +2 -2
- package/dist/entry/SdCliElectron.js.map +1 -1
- package/dist/entry/SdCliLocalUpdate.js +6 -8
- package/dist/entry/SdCliLocalUpdate.js.map +1 -1
- package/dist/entry/SdCliProject.js +4 -4
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pkg-builders/SdMultiBuildRunner.d.ts +3 -10
- package/dist/pkg-builders/SdMultiBuildRunner.js +133 -117
- package/dist/pkg-builders/SdMultiBuildRunner.js.map +1 -1
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js +1 -1
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +1 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +6 -5
- package/dist/pkg-builders/client/SdClientBuildRunner.js +16 -8
- package/dist/pkg-builders/client/SdClientBuildRunner.js.map +1 -1
- package/dist/pkg-builders/client/SdNgBundler.js +13 -61
- package/dist/pkg-builders/client/SdNgBundler.js.map +1 -1
- package/dist/pkg-builders/client/createSdNgPlugin.js +3 -3
- package/dist/pkg-builders/client/createSdNgPlugin.js.map +1 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js +1 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +1 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +1 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +6 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +27 -28
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +1 -1
- package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +3 -4
- package/dist/pkg-builders/lib/SdTsLibBuilder.js +7 -11
- package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +1 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +5 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.js +32 -29
- package/dist/pkg-builders/server/SdServerBuildRunner.js.map +1 -1
- package/dist/pkg-builders/server/createSdServerPlugin.js +3 -3
- package/dist/pkg-builders/server/createSdServerPlugin.js.map +1 -1
- package/dist/ts-builder/SdTsCompiler.d.ts +1 -1
- package/dist/ts-builder/SdTsCompiler.js +222 -201
- package/dist/ts-builder/SdTsCompiler.js.map +1 -1
- package/dist/types/build-runner.type.d.ts +7 -0
- package/dist/types/build-runner.type.js +2 -0
- package/dist/types/build-runner.type.js.map +1 -0
- package/dist/types/workers.type.d.ts +15 -1
- package/dist/workers/build-runner-worker.js +45 -0
- package/dist/workers/build-runner-worker.js.map +1 -0
- package/package.json +6 -6
- package/src/entry/SdCliCordova.ts +2 -2
- package/src/entry/SdCliElectron.ts +2 -2
- package/src/entry/SdCliLocalUpdate.ts +8 -8
- package/src/entry/SdCliProject.ts +4 -4
- package/src/index.ts +1 -1
- package/src/pkg-builders/SdMultiBuildRunner.ts +123 -121
- package/src/pkg-builders/client/SdCliNgRoutesFileGenerator.ts +1 -1
- package/src/pkg-builders/client/SdClientBuildRunner.ts +26 -22
- package/src/pkg-builders/client/SdNgBundler.ts +16 -74
- package/src/pkg-builders/client/createSdNgPlugin.ts +3 -3
- package/src/pkg-builders/lib/SdCliIndexFileGenerator.ts +1 -1
- package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +1 -1
- package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +42 -29
- package/src/pkg-builders/lib/SdTsLibBuilder.ts +13 -14
- package/src/pkg-builders/server/SdServerBuildRunner.ts +44 -29
- package/src/pkg-builders/server/createSdServerPlugin.ts +3 -3
- package/src/ts-builder/SdTsCompiler.ts +282 -261
- package/src/types/build-runner.type.ts +8 -0
- package/src/types/workers.type.ts +14 -1
- package/src/workers/build-runner-worker.ts +52 -0
- package/tsconfig.json +1 -1
- package/dist/ts-builder/SdTsCompileWorker.d.ts +0 -9
- package/dist/ts-builder/SdTsCompileWorker.js +0 -16
- package/dist/ts-builder/SdTsCompileWorker.js.map +0 -1
- package/dist/workers/compile-worker.js +0 -27
- package/dist/workers/compile-worker.js.map +0 -1
- package/lib/dev-worker.cjs +0 -5
- package/src/ts-builder/SdTsCompileWorker.ts +0 -21
- package/src/workers/compile-worker.ts +0 -31
- /package/dist/workers/{compile-worker.d.ts → build-runner-worker.d.ts} +0 -0
|
@@ -7,20 +7,28 @@ import { ISdLibPackageConfig, ISdProjectConfig } from "../../types/sd-configs.ty
|
|
|
7
7
|
import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.type";
|
|
8
8
|
|
|
9
9
|
export class SdTsLibBuildRunner extends EventEmitter {
|
|
10
|
-
|
|
10
|
+
private _logger = Logger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
private _projConf: ISdProjectConfig;
|
|
13
|
+
private _pkgPath: string;
|
|
14
|
+
private _pkgConf: ISdLibPackageConfig;
|
|
15
|
+
private _watchScopePathSet: Set<TNormPath>;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
private _builder?: SdTsLibBuilder;
|
|
17
18
|
|
|
18
19
|
public constructor(projConf: ISdProjectConfig, pkgPath: string) {
|
|
19
20
|
super();
|
|
20
|
-
this
|
|
21
|
-
this
|
|
21
|
+
this._projConf = projConf;
|
|
22
|
+
this._pkgPath = pkgPath;
|
|
22
23
|
|
|
23
|
-
this
|
|
24
|
+
this._pkgConf = projConf.packages[path.basename(pkgPath)] as ISdLibPackageConfig;
|
|
25
|
+
|
|
26
|
+
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {}).mapMany((key) =>
|
|
27
|
+
FsUtil.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
|
|
28
|
+
);
|
|
29
|
+
this._watchScopePathSet = new Set(
|
|
30
|
+
[path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtil.norm(item)),
|
|
31
|
+
);
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
public override on(event: "change", listener: () => void): this;
|
|
@@ -32,14 +40,14 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
32
40
|
|
|
33
41
|
public async buildAsync(): Promise<ISdBuildRunnerResult> {
|
|
34
42
|
this._debug("dist 초기화...");
|
|
35
|
-
FsUtil.remove(path.resolve(this
|
|
43
|
+
FsUtil.remove(path.resolve(this._pkgPath, "dist"));
|
|
36
44
|
|
|
37
|
-
if (!this
|
|
45
|
+
if (!this._pkgConf.noGenIndex) {
|
|
38
46
|
this._debug("GEN index.ts...");
|
|
39
|
-
SdCliIndexFileGenerator.run(this
|
|
47
|
+
SdCliIndexFileGenerator.run(this._pkgPath, this._pkgConf.polyfills);
|
|
40
48
|
}
|
|
41
49
|
|
|
42
|
-
const result = await this._runAsync(false);
|
|
50
|
+
const result = await this._runAsync(false, new Set<TNormPath>());
|
|
43
51
|
return {
|
|
44
52
|
affectedFilePathSet: result.affectedFileSet,
|
|
45
53
|
buildMessages: result.buildMessages,
|
|
@@ -51,14 +59,14 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
51
59
|
this.emit("change");
|
|
52
60
|
|
|
53
61
|
this._debug("dist 초기화...");
|
|
54
|
-
FsUtil.remove(path.resolve(this
|
|
62
|
+
FsUtil.remove(path.resolve(this._pkgPath, "dist"));
|
|
55
63
|
|
|
56
|
-
if (!this
|
|
64
|
+
if (!this._pkgConf.noGenIndex) {
|
|
57
65
|
this._debug("WATCH GEN index.ts...");
|
|
58
|
-
SdCliIndexFileGenerator.watch(this
|
|
66
|
+
SdCliIndexFileGenerator.watch(this._pkgPath, this._pkgConf.polyfills);
|
|
59
67
|
}
|
|
60
68
|
|
|
61
|
-
const result = await this._runAsync(true);
|
|
69
|
+
const result = await this._runAsync(true, new Set<TNormPath>());
|
|
62
70
|
const res: ISdBuildRunnerResult = {
|
|
63
71
|
affectedFilePathSet: result.affectedFileSet,
|
|
64
72
|
buildMessages: result.buildMessages,
|
|
@@ -67,10 +75,14 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
67
75
|
this.emit("complete", res);
|
|
68
76
|
|
|
69
77
|
this._debug("WATCH...");
|
|
70
|
-
|
|
78
|
+
let lastWatchFileSet = result.watchFileSet;
|
|
79
|
+
SdFsWatcher.watch(Array.from(this._watchScopePathSet)).onChange({ delay: 100 }, async (changeInfos) => {
|
|
80
|
+
const currentChangeInfos = changeInfos.filter((item) => lastWatchFileSet.has(item.path));
|
|
81
|
+
if (currentChangeInfos.length < 1) return;
|
|
82
|
+
|
|
71
83
|
this.emit("change");
|
|
72
84
|
|
|
73
|
-
const changeFileSet = new Set(
|
|
85
|
+
const changeFileSet = new Set(currentChangeInfos.map((item) => PathUtil.norm(item.path)));
|
|
74
86
|
|
|
75
87
|
const watchResult = await this._runAsync(true, changeFileSet);
|
|
76
88
|
const watchRes: ISdBuildRunnerResult = {
|
|
@@ -81,35 +93,36 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
81
93
|
|
|
82
94
|
this.emit("complete", watchRes);
|
|
83
95
|
|
|
84
|
-
|
|
96
|
+
lastWatchFileSet = watchResult.watchFileSet;
|
|
85
97
|
});
|
|
86
98
|
}
|
|
87
99
|
|
|
88
100
|
private async _runAsync(
|
|
89
101
|
dev: boolean,
|
|
90
|
-
modifiedFileSet
|
|
102
|
+
modifiedFileSet: Set<TNormPath>,
|
|
91
103
|
): Promise<{
|
|
92
104
|
watchFileSet: Set<TNormPath>;
|
|
93
105
|
affectedFileSet: Set<TNormPath>;
|
|
94
106
|
buildMessages: ISdBuildMessage[];
|
|
95
107
|
emitFileSet: Set<TNormPath>;
|
|
96
108
|
}> {
|
|
97
|
-
const localUpdatePaths = Object.keys(this
|
|
98
|
-
.mapMany((key) => FsUtil.glob(path.resolve(this
|
|
109
|
+
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {})
|
|
110
|
+
.mapMany((key) => FsUtil.glob(path.resolve(this._pkgPath, "../../node_modules", key)))
|
|
99
111
|
.map((item) => PathUtil.norm(item));
|
|
100
112
|
|
|
101
113
|
this._debug(`BUILD...`);
|
|
102
|
-
this
|
|
103
|
-
PathUtil.norm(this
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
this._builder ??= new SdTsLibBuilder(
|
|
115
|
+
PathUtil.norm(this._pkgPath),
|
|
116
|
+
dev,
|
|
117
|
+
[PathUtil.norm(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtil.norm(item)),
|
|
118
|
+
);
|
|
119
|
+
const buildResult = await this._builder.buildAsync(modifiedFileSet);
|
|
107
120
|
|
|
108
121
|
this._debug(`빌드 완료`);
|
|
109
122
|
const watchFileSet = new Set(
|
|
110
123
|
Array.from(buildResult.watchFileSet).filter(
|
|
111
124
|
(item) =>
|
|
112
|
-
PathUtil.isChildPath(item, path.resolve(this
|
|
125
|
+
PathUtil.isChildPath(item, path.resolve(this._pkgPath, "../")) ||
|
|
113
126
|
localUpdatePaths.some((lu) => PathUtil.isChildPath(item, lu)),
|
|
114
127
|
),
|
|
115
128
|
);
|
|
@@ -123,6 +136,6 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
123
136
|
}
|
|
124
137
|
|
|
125
138
|
private _debug(msg: string): void {
|
|
126
|
-
this
|
|
139
|
+
this._logger.debug(`[${path.basename(this._pkgPath)}] ${msg}`);
|
|
127
140
|
}
|
|
128
141
|
}
|
|
@@ -2,34 +2,33 @@ import path from "path";
|
|
|
2
2
|
import { SdCliConvertMessageUtil } from "../../utils/SdCliConvertMessageUtil";
|
|
3
3
|
import { FsUtil, PathUtil, TNormPath } from "@simplysm/sd-core-node";
|
|
4
4
|
import { ISdBuildMessage } from "../../types/build.type";
|
|
5
|
-
import {
|
|
5
|
+
import { SdTsCompiler } from "../../ts-builder/SdTsCompiler";
|
|
6
6
|
|
|
7
7
|
export class SdTsLibBuilder {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
private _tsCompiler: SdTsCompiler;
|
|
9
|
+
|
|
10
|
+
constructor(
|
|
11
|
+
private _pkgPath: TNormPath,
|
|
12
|
+
dev: boolean,
|
|
13
|
+
watchScopePaths: TNormPath[],
|
|
14
|
+
) {
|
|
15
|
+
this._tsCompiler = new SdTsCompiler({
|
|
16
|
+
pkgPath: this._pkgPath,
|
|
11
17
|
additionalOptions: { declaration: true },
|
|
12
18
|
isDevMode: dev,
|
|
13
|
-
globalStyleFilePath: PathUtil.norm(
|
|
19
|
+
globalStyleFilePath: PathUtil.norm(this._pkgPath, "src/styles.scss"),
|
|
14
20
|
isForBundle: false,
|
|
15
21
|
watchScopePaths: watchScopePaths,
|
|
16
22
|
});
|
|
17
|
-
|
|
18
|
-
return new SdTsLibBuilder(tsCompiler, pkgPath);
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
private _compiler: SdTsCompileWorker,
|
|
23
|
-
private _pkgPath: string,
|
|
24
|
-
) {}
|
|
25
|
-
|
|
26
|
-
public async buildAsync(modifiedFileSet?: Set<TNormPath>): Promise<{
|
|
25
|
+
public async buildAsync(modifiedFileSet: Set<TNormPath>): Promise<{
|
|
27
26
|
watchFileSet: Set<TNormPath>;
|
|
28
27
|
affectedFileSet: Set<TNormPath>;
|
|
29
28
|
results: ISdBuildMessage[];
|
|
30
29
|
emitFileSet: Set<TNormPath>;
|
|
31
30
|
}> {
|
|
32
|
-
const tsCompileResult = await this.
|
|
31
|
+
const tsCompileResult = await this._tsCompiler.compileAsync(modifiedFileSet);
|
|
33
32
|
|
|
34
33
|
const emitFileSet = new Set<TNormPath>();
|
|
35
34
|
for (const emitFile of tsCompileResult.emitFileSet) {
|
|
@@ -8,17 +8,25 @@ import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.type";
|
|
|
8
8
|
import { INpmConfig, ITsConfig } from "../../types/common-configs.type";
|
|
9
9
|
|
|
10
10
|
export class SdServerBuildRunner extends EventEmitter {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
private _logger = Logger.get(["simplysm", "sd-cli", "SdCliServerBuildRunner"]);
|
|
12
|
+
private _pkgConf: ISdServerPackageConfig;
|
|
13
|
+
private _serverBundler?: SdServerBundler;
|
|
14
|
+
private _extModules?: { name: string; exists: boolean }[];
|
|
15
|
+
private _watchScopePathSet: Set<TNormPath>;
|
|
15
16
|
|
|
16
17
|
public constructor(
|
|
17
18
|
private readonly _projConf: ISdProjectConfig,
|
|
18
19
|
private readonly _pkgPath: TNormPath,
|
|
19
20
|
) {
|
|
20
21
|
super();
|
|
21
|
-
this
|
|
22
|
+
this._pkgConf = this._projConf.packages[path.basename(_pkgPath)] as ISdServerPackageConfig;
|
|
23
|
+
|
|
24
|
+
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {}).mapMany((key) =>
|
|
25
|
+
FsUtil.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
|
|
26
|
+
);
|
|
27
|
+
this._watchScopePathSet = new Set(
|
|
28
|
+
[path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtil.norm(item)),
|
|
29
|
+
);
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
public override on(event: "change", listener: () => void): this;
|
|
@@ -36,7 +44,7 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
36
44
|
|
|
37
45
|
this._debug("GEN .config...");
|
|
38
46
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
39
|
-
FsUtil.writeFile(confDistPath, JSON.stringify(this
|
|
47
|
+
FsUtil.writeFile(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
40
48
|
|
|
41
49
|
const result = await this._runAsync(true);
|
|
42
50
|
const res: ISdBuildRunnerResult = {
|
|
@@ -47,10 +55,17 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
47
55
|
this.emit("complete", res);
|
|
48
56
|
|
|
49
57
|
this._debug("WATCH...");
|
|
50
|
-
|
|
58
|
+
let lastWatchFileSet = result.watchFileSet;
|
|
59
|
+
SdFsWatcher.watch(Array.from(this._watchScopePathSet)).onChange({ delay: 100 }, async (changeInfos) => {
|
|
60
|
+
const currentChangeInfos = changeInfos.filter((item) => lastWatchFileSet.has(item.path));
|
|
61
|
+
if (currentChangeInfos.length < 1) return;
|
|
62
|
+
|
|
51
63
|
this.emit("change");
|
|
52
64
|
|
|
53
|
-
const watchResult = await this._runAsync(
|
|
65
|
+
const watchResult = await this._runAsync(
|
|
66
|
+
true,
|
|
67
|
+
new Set(currentChangeInfos.map((item) => PathUtil.norm(item.path))),
|
|
68
|
+
);
|
|
54
69
|
const watchRes: ISdBuildRunnerResult = {
|
|
55
70
|
affectedFilePathSet: watchResult.affectedFileSet,
|
|
56
71
|
buildMessages: watchResult.buildMessages,
|
|
@@ -59,7 +74,7 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
59
74
|
|
|
60
75
|
this.emit("complete", watchRes);
|
|
61
76
|
|
|
62
|
-
|
|
77
|
+
lastWatchFileSet = watchResult.watchFileSet;
|
|
63
78
|
});
|
|
64
79
|
}
|
|
65
80
|
|
|
@@ -72,7 +87,7 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
72
87
|
|
|
73
88
|
this._debug("GEN .config.json...");
|
|
74
89
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
75
|
-
FsUtil.writeJson(confDistPath, this
|
|
90
|
+
FsUtil.writeJson(confDistPath, this._pkgConf.configs ?? {}, { space: 2 });
|
|
76
91
|
|
|
77
92
|
this._debug("GEN package.json...");
|
|
78
93
|
{
|
|
@@ -87,7 +102,7 @@ export class SdServerBuildRunner extends EventEmitter {
|
|
|
87
102
|
delete distNpmConfig.devDependencies;
|
|
88
103
|
delete distNpmConfig.peerDependencies;
|
|
89
104
|
|
|
90
|
-
if (this
|
|
105
|
+
if (this._pkgConf.pm2 && !this._pkgConf.pm2.noStartScript) {
|
|
91
106
|
distNpmConfig.scripts = { start: "pm2 start pm2.json" };
|
|
92
107
|
}
|
|
93
108
|
|
|
@@ -123,18 +138,18 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
123
138
|
);
|
|
124
139
|
}
|
|
125
140
|
|
|
126
|
-
if (this
|
|
141
|
+
if (this._pkgConf.pm2) {
|
|
127
142
|
this._debug("GEN pm2.json...");
|
|
128
143
|
|
|
129
144
|
FsUtil.writeJson(
|
|
130
145
|
path.resolve(this._pkgPath, "dist/pm2.json"),
|
|
131
146
|
{
|
|
132
|
-
name: this
|
|
147
|
+
name: this._pkgConf.pm2.name ?? npmConfig.name.replace(/@/g, "").replace(/\//g, "-"),
|
|
133
148
|
script: "main.js",
|
|
134
149
|
watch: true,
|
|
135
150
|
watch_delay: 2000,
|
|
136
|
-
ignore_watch: ["node_modules", "www", ...(this
|
|
137
|
-
...(this
|
|
151
|
+
ignore_watch: ["node_modules", "www", ...(this._pkgConf.pm2.ignoreWatchPaths ?? [])],
|
|
152
|
+
...(this._pkgConf.pm2.noInterpreter
|
|
138
153
|
? {}
|
|
139
154
|
: {
|
|
140
155
|
interpreter: "node@" + process.versions.node,
|
|
@@ -144,7 +159,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
144
159
|
NODE_ENV: "production",
|
|
145
160
|
TZ: "Asia/Seoul",
|
|
146
161
|
SD_VERSION: npmConfig.version,
|
|
147
|
-
...this
|
|
162
|
+
...this._pkgConf.env,
|
|
148
163
|
},
|
|
149
164
|
arrayProcess: "concat",
|
|
150
165
|
useDelTargetNull: true,
|
|
@@ -155,11 +170,11 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
155
170
|
);
|
|
156
171
|
}
|
|
157
172
|
|
|
158
|
-
if (this
|
|
173
|
+
if (this._pkgConf.iis) {
|
|
159
174
|
this._debug("GEN web.config...");
|
|
160
175
|
|
|
161
176
|
const iisDistPath = path.resolve(this._pkgPath, "dist/web.config");
|
|
162
|
-
const serverExeFilePath = this
|
|
177
|
+
const serverExeFilePath = this._pkgConf.iis.nodeExeFilePath ?? "C:\\Program Files\\nodejs\\node.exe";
|
|
163
178
|
FsUtil.writeFile(
|
|
164
179
|
iisDistPath,
|
|
165
180
|
`
|
|
@@ -168,8 +183,8 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
168
183
|
<add key="NODE_ENV" value="production" />
|
|
169
184
|
<add key="TZ" value="Asia/Seoul" />
|
|
170
185
|
<add key="SD_VERSION" value="${npmConfig.version}" />
|
|
171
|
-
${Object.keys(this
|
|
172
|
-
.map((key) => `<add key="${key}" value="${this
|
|
186
|
+
${Object.keys(this._pkgConf.env ?? {})
|
|
187
|
+
.map((key) => `<add key="${key}" value="${this._pkgConf.env![key]}"/>`)
|
|
173
188
|
.join("\n ")}
|
|
174
189
|
</appSettings>
|
|
175
190
|
<system.webServer>
|
|
@@ -218,21 +233,21 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
218
233
|
|
|
219
234
|
this._debug(`BUILD 준비...`);
|
|
220
235
|
const tsConfig = FsUtil.readJson(path.resolve(this._pkgPath, "tsconfig.json")) as ITsConfig;
|
|
221
|
-
this
|
|
222
|
-
this
|
|
223
|
-
this
|
|
236
|
+
this._extModules = this._extModules ?? (await this._getExternalModulesAsync());
|
|
237
|
+
this._serverBundler =
|
|
238
|
+
this._serverBundler ??
|
|
224
239
|
new SdServerBundler({
|
|
225
240
|
dev,
|
|
226
241
|
pkgPath: this._pkgPath,
|
|
227
242
|
entryPoints: tsConfig.files
|
|
228
243
|
? tsConfig.files.map((item) => path.resolve(this._pkgPath, item))
|
|
229
244
|
: [path.resolve(this._pkgPath, "src/main.ts")],
|
|
230
|
-
external: this
|
|
245
|
+
external: this._extModules.map((item) => item.name),
|
|
231
246
|
watchScopePaths: [path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtil.norm(item)),
|
|
232
247
|
});
|
|
233
248
|
|
|
234
249
|
this._debug(`BUILD...`);
|
|
235
|
-
const bundleResult = await this
|
|
250
|
+
const bundleResult = await this._serverBundler.bundleAsync(modifiedFileSet);
|
|
236
251
|
|
|
237
252
|
//-- filePaths
|
|
238
253
|
const watchFileSet = new Set(
|
|
@@ -304,7 +319,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
304
319
|
});
|
|
305
320
|
}
|
|
306
321
|
|
|
307
|
-
if (this
|
|
322
|
+
if (this._pkgConf.externals?.includes(moduleName)) {
|
|
308
323
|
results.push({
|
|
309
324
|
name: moduleName,
|
|
310
325
|
exists: true,
|
|
@@ -338,7 +353,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
338
353
|
});
|
|
339
354
|
}
|
|
340
355
|
|
|
341
|
-
if (this
|
|
356
|
+
if (this._pkgConf.externals?.includes(optModuleName)) {
|
|
342
357
|
results.push({
|
|
343
358
|
name: optModuleName,
|
|
344
359
|
exists: true,
|
|
@@ -351,7 +366,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
351
366
|
|
|
352
367
|
await fn(this._pkgPath);
|
|
353
368
|
|
|
354
|
-
for (const external of this
|
|
369
|
+
for (const external of this._pkgConf.externals ?? []) {
|
|
355
370
|
if (!results.some((item) => item.name === external)) {
|
|
356
371
|
results.push({
|
|
357
372
|
name: external,
|
|
@@ -364,6 +379,6 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
364
379
|
}
|
|
365
380
|
|
|
366
381
|
private _debug(msg: string): void {
|
|
367
|
-
this
|
|
382
|
+
this._logger.debug(`[${path.basename(this._pkgPath)}] ${msg}`);
|
|
368
383
|
}
|
|
369
384
|
}
|
|
@@ -2,8 +2,8 @@ import esbuild from "esbuild";
|
|
|
2
2
|
import { SdCliConvertMessageUtil } from "../../utils/SdCliConvertMessageUtil";
|
|
3
3
|
import { ISdCliServerPluginResultCache } from "../../types/build-plugin.type";
|
|
4
4
|
import { PathUtil, TNormPath } from "@simplysm/sd-core-node";
|
|
5
|
-
import { SdTsCompileWorker } from "../../ts-builder/SdTsCompileWorker";
|
|
6
5
|
import { ISdTsCompilerResult } from "../../types/ts-compiler.type";
|
|
6
|
+
import { SdTsCompiler } from "../../ts-builder/SdTsCompiler";
|
|
7
7
|
|
|
8
8
|
export function createSdServerPlugin(conf: {
|
|
9
9
|
pkgPath: TNormPath;
|
|
@@ -14,8 +14,8 @@ export function createSdServerPlugin(conf: {
|
|
|
14
14
|
}): esbuild.Plugin {
|
|
15
15
|
return {
|
|
16
16
|
name: "sd-server-compile",
|
|
17
|
-
setup:
|
|
18
|
-
const tsCompiler =
|
|
17
|
+
setup: (build: esbuild.PluginBuild) => {
|
|
18
|
+
const tsCompiler = new SdTsCompiler({
|
|
19
19
|
pkgPath: conf.pkgPath,
|
|
20
20
|
additionalOptions: { declaration: false },
|
|
21
21
|
isDevMode: conf.dev,
|