@simplysm/sd-cli 12.9.16 → 12.9.18
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-cordova.d.ts +1 -1
- package/dist/entry/sd-cli-cordova.js +3 -3
- package/dist/entry/sd-cli-cordova.js.map +1 -1
- package/dist/entry/sd-cli-electron.d.ts +2 -2
- package/dist/entry/sd-cli-local-update.d.ts +2 -2
- package/dist/entry/sd-cli-local-update.js.map +1 -1
- package/dist/entry/sd-cli-project.d.ts +3 -3
- package/dist/entry/sd-cli-project.js +4 -4
- package/dist/entry/sd-cli-project.js.map +1 -1
- package/dist/entry/utils/loadProjConfAsync.d.ts +1 -1
- package/dist/entry/utils/loadProjConfAsync.js +1 -1
- package/dist/entry/utils/loadProjConfAsync.js.map +1 -1
- package/dist/fix/convert-private-underscore.d.ts +1 -0
- package/dist/fix/convert-private-underscore.js +49 -0
- package/dist/fix/convert-private-underscore.js.map +1 -0
- package/dist/fix/convert-private.d.ts +1 -0
- package/dist/fix/convert-private.js +60 -0
- package/dist/fix/convert-private.js.map +1 -0
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.d.ts +1 -1
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js +3 -3
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +1 -1
- package/dist/pkg-builders/client/sd-client.build-runner.d.ts +5 -18
- package/dist/pkg-builders/client/sd-client.build-runner.js +32 -90
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -1
- package/dist/pkg-builders/client/sd-ng.bundler.d.ts +2 -1
- package/dist/pkg-builders/client/sd-ng.bundler.js +2 -2
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
- package/dist/pkg-builders/client/sd-ng.plugin-creator.d.ts +2 -1
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js +1 -1
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -1
- package/dist/pkg-builders/commons/build-runner.base.d.ts +27 -0
- package/dist/pkg-builders/commons/build-runner.base.js +93 -0
- package/dist/pkg-builders/commons/build-runner.base.js.map +1 -0
- package/dist/pkg-builders/commons/scope-path.d.ts +7 -0
- package/dist/pkg-builders/commons/scope-path.js +13 -0
- package/dist/pkg-builders/commons/scope-path.js.map +1 -0
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.d.ts +1 -1
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js +2 -2
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -1
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.d.ts +7 -15
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js +15 -54
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +1 -1
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.d.ts +5 -16
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js +31 -85
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -1
- package/dist/pkg-builders/lib/sd-ts-lib.builder.d.ts +2 -1
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js +2 -2
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -1
- package/dist/pkg-builders/sd-multi.build-runner.d.ts +2 -1
- package/dist/pkg-builders/sd-multi.build-runner.js +4 -4
- package/dist/pkg-builders/sd-multi.build-runner.js.map +1 -1
- package/dist/pkg-builders/server/sd-server.build-runner.d.ts +6 -17
- package/dist/pkg-builders/server/sd-server.build-runner.js +87 -137
- package/dist/pkg-builders/server/sd-server.build-runner.js.map +1 -1
- package/dist/pkg-builders/server/sd-server.bundler.d.ts +2 -1
- package/dist/pkg-builders/server/sd-server.bundler.js +2 -2
- package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -1
- package/dist/pkg-builders/server/sd-server.plugin-creator.d.ts +2 -1
- package/dist/pkg-builders/server/sd-server.plugin-creator.js +3 -2
- package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +1 -1
- package/dist/sd-cli-entry.js +69 -61
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.js +33 -28
- package/dist/sd-cli.js.map +1 -1
- package/dist/ts-compiler/sd-dependency-analyzer.d.ts +3 -3
- package/dist/ts-compiler/sd-dependency-analyzer.js +9 -16
- package/dist/ts-compiler/sd-dependency-analyzer.js.map +1 -1
- package/dist/ts-compiler/sd-ts-compiler.d.ts +1 -2
- package/dist/ts-compiler/sd-ts-compiler.js +70 -19
- package/dist/ts-compiler/sd-ts-compiler.js.map +1 -1
- package/dist/types/config.types.d.ts +3 -2
- package/dist/types/ts-compiler.types.d.ts +2 -1
- package/package.json +8 -7
- package/src/entry/sd-cli-cordova.ts +4 -4
- package/src/entry/sd-cli-electron.ts +2 -2
- package/src/entry/sd-cli-local-update.ts +2 -2
- package/src/entry/sd-cli-project.ts +6 -6
- package/src/entry/utils/loadProjConfAsync.ts +2 -2
- package/src/fix/convert-private-underscore.ts +69 -0
- package/src/fix/convert-private.ts +74 -0
- package/src/pkg-builders/client/sd-cli-ng-routes.file-generator.ts +3 -3
- package/src/pkg-builders/client/sd-client.build-runner.ts +39 -126
- package/src/pkg-builders/client/sd-ng.bundler.ts +4 -3
- package/src/pkg-builders/client/sd-ng.plugin-creator.ts +3 -2
- package/src/pkg-builders/commons/build-runner.base.ts +149 -0
- package/src/pkg-builders/commons/scope-path.ts +17 -0
- package/src/pkg-builders/lib/sd-cli-index.file-generator.ts +2 -2
- package/src/pkg-builders/lib/sd-js-lib.build-runner.ts +29 -74
- package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +35 -130
- package/src/pkg-builders/lib/sd-ts-lib.builder.ts +3 -2
- package/src/pkg-builders/sd-multi.build-runner.ts +4 -4
- package/src/pkg-builders/server/sd-server.build-runner.ts +99 -187
- package/src/pkg-builders/server/sd-server.bundler.ts +4 -3
- package/src/pkg-builders/server/sd-server.plugin-creator.ts +13 -8
- package/src/sd-cli-entry.ts +115 -81
- package/src/sd-cli.ts +14 -11
- package/src/ts-compiler/sd-dependency-analyzer.ts +10 -17
- package/src/ts-compiler/sd-ts-compiler.ts +79 -30
- package/src/types/config.types.ts +9 -2
- package/src/types/ts-compiler.types.ts +2 -1
- package/tests/deps/sd-dependency-analyzer.spec.ts +1 -1
- package/dist/workers/style-bundler.worker.d.ts +0 -1
- package/dist/workers/style-bundler.worker.js +0 -56
- package/dist/workers/style-bundler.worker.js.map +0 -1
- package/src/workers/style-bundler.worker.ts +0 -70
|
@@ -4,13 +4,14 @@ import { ISdCliServerPluginResultCache } from "../../types/build-plugin.types";
|
|
|
4
4
|
import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
5
5
|
import { ISdTsCompilerResult } from "../../types/ts-compiler.types";
|
|
6
6
|
import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
|
|
7
|
+
import { ScopePathSet } from "../commons/scope-path";
|
|
7
8
|
|
|
8
9
|
export function createSdServerPlugin(conf: {
|
|
9
10
|
pkgPath: TNormPath;
|
|
10
11
|
dev: boolean;
|
|
11
12
|
modifiedFileSet: Set<TNormPath>;
|
|
12
13
|
result: ISdCliServerPluginResultCache;
|
|
13
|
-
|
|
14
|
+
watchScopePathSet: ScopePathSet;
|
|
14
15
|
}): esbuild.Plugin {
|
|
15
16
|
return {
|
|
16
17
|
name: "sd-server-compile",
|
|
@@ -20,7 +21,7 @@ export function createSdServerPlugin(conf: {
|
|
|
20
21
|
additionalOptions: { declaration: false },
|
|
21
22
|
isDevMode: conf.dev,
|
|
22
23
|
isForBundle: true,
|
|
23
|
-
|
|
24
|
+
watchScopePathSet: conf.watchScopePathSet,
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
let tsCompileResult: ISdTsCompilerResult;
|
|
@@ -32,11 +33,15 @@ export function createSdServerPlugin(conf: {
|
|
|
32
33
|
conf.result.affectedFileSet = tsCompileResult.affectedFileSet;
|
|
33
34
|
|
|
34
35
|
//-- return err/warn
|
|
35
|
-
return SdCliConvertMessageUtils.convertToEsbuildFromBuildMessages(
|
|
36
|
+
return SdCliConvertMessageUtils.convertToEsbuildFromBuildMessages(
|
|
37
|
+
tsCompileResult.messages,
|
|
38
|
+
conf.pkgPath,
|
|
39
|
+
);
|
|
36
40
|
});
|
|
37
41
|
|
|
38
42
|
build.onLoad({ filter: /\.ts$/ }, (args) => {
|
|
39
|
-
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(PathUtils.norm(args.path))
|
|
43
|
+
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(PathUtils.norm(args.path))
|
|
44
|
+
?.last();
|
|
40
45
|
if (!emittedJsFile) {
|
|
41
46
|
return {
|
|
42
47
|
errors: [
|
|
@@ -60,10 +65,10 @@ export function createSdServerPlugin(conf: {
|
|
|
60
65
|
{
|
|
61
66
|
filter: new RegExp(
|
|
62
67
|
"(" +
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
Object.keys(build.initialOptions.loader!)
|
|
69
|
+
.map((item) => "\\" + item)
|
|
70
|
+
.join("|") +
|
|
71
|
+
")$",
|
|
67
72
|
),
|
|
68
73
|
},
|
|
69
74
|
(args) => {
|
package/src/sd-cli-entry.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
|
|
3
5
|
import yargs from "yargs";
|
|
4
6
|
import { hideBin } from "yargs/helpers";
|
|
5
7
|
import { SdCliProject } from "./entry/sd-cli-project";
|
|
@@ -10,11 +12,13 @@ import { SdCliLocalUpdate } from "./entry/sd-cli-local-update";
|
|
|
10
12
|
import { SdCliCordova } from "./entry/sd-cli-cordova";
|
|
11
13
|
import { SdCliAiCommand } from "./entry/sd-cli-ai-command";
|
|
12
14
|
import { SdCliPostinstall } from "./entry/sd-cli-postinstall";
|
|
15
|
+
import convertPrivate from "./fix/convert-private";
|
|
16
|
+
import convertPrivateUnderscore from "./fix/convert-private-underscore";
|
|
13
17
|
|
|
14
18
|
Error.stackTraceLimit = Infinity;
|
|
15
19
|
EventEmitter.defaultMaxListeners = 0;
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
await yargs(hideBin(process.argv))
|
|
18
22
|
.help("help", "도움말")
|
|
19
23
|
.alias("help", "h")
|
|
20
24
|
.options({
|
|
@@ -24,15 +28,29 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
24
28
|
default: false,
|
|
25
29
|
},
|
|
26
30
|
})
|
|
27
|
-
.
|
|
28
|
-
|
|
31
|
+
.middleware((argv) => {
|
|
32
|
+
if (argv.debug) {
|
|
33
|
+
process.env["SD_DEBUG"] = "true";
|
|
34
|
+
SdLogger.setConfig({
|
|
35
|
+
console: { level: SdLoggerSeverity.debug },
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
SdLogger.setConfig({ dot: true });
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
.command(
|
|
43
|
+
"local-update",
|
|
44
|
+
"로컬 라이브러리 업데이트를 수행합니다.",
|
|
45
|
+
cmd => cmd
|
|
29
46
|
.version(false)
|
|
30
47
|
.hide("help")
|
|
31
48
|
.hide("debug")
|
|
32
49
|
.options({
|
|
33
50
|
config: {
|
|
34
51
|
string: true,
|
|
35
|
-
describe: "
|
|
52
|
+
describe: "설정 파일 경로",
|
|
53
|
+
default: "simplysm.js",
|
|
36
54
|
},
|
|
37
55
|
options: {
|
|
38
56
|
string: true,
|
|
@@ -40,16 +58,20 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
40
58
|
describe: "옵션 설정",
|
|
41
59
|
},
|
|
42
60
|
}),
|
|
61
|
+
async (argv) => await SdCliLocalUpdate.runAsync(argv),
|
|
43
62
|
)
|
|
44
|
-
.command(
|
|
45
|
-
|
|
63
|
+
.command(
|
|
64
|
+
"watch",
|
|
65
|
+
"프로젝트의 각 패키지에 대한 변경감지 빌드를 수행합니다.",
|
|
66
|
+
(cmd) => cmd
|
|
46
67
|
.version(false)
|
|
47
68
|
.hide("help")
|
|
48
69
|
.hide("debug")
|
|
49
70
|
.options({
|
|
50
71
|
config: {
|
|
51
72
|
string: true,
|
|
52
|
-
describe: "
|
|
73
|
+
describe: "설정 파일 경로",
|
|
74
|
+
default: "simplysm.js",
|
|
53
75
|
},
|
|
54
76
|
options: {
|
|
55
77
|
string: true,
|
|
@@ -67,16 +89,20 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
67
89
|
describe: "크롬 inspect를 수행할 패키지 설정",
|
|
68
90
|
},
|
|
69
91
|
}),
|
|
92
|
+
async (argv) => await SdCliProject.watchAsync(argv),
|
|
70
93
|
)
|
|
71
|
-
.command(
|
|
72
|
-
|
|
94
|
+
.command(
|
|
95
|
+
"build",
|
|
96
|
+
"프로젝트의 각 패키지에 대한 빌드를 수행합니다.",
|
|
97
|
+
(cmd) => cmd
|
|
73
98
|
.version(false)
|
|
74
99
|
.hide("help")
|
|
75
100
|
.hide("debug")
|
|
76
101
|
.options({
|
|
77
102
|
config: {
|
|
78
103
|
string: true,
|
|
79
|
-
describe: "
|
|
104
|
+
describe: "설정 파일 경로",
|
|
105
|
+
default: "simplysm.js",
|
|
80
106
|
},
|
|
81
107
|
options: {
|
|
82
108
|
string: true,
|
|
@@ -89,9 +115,12 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
89
115
|
describe: "수행할 패키지 설정",
|
|
90
116
|
},
|
|
91
117
|
}),
|
|
118
|
+
async (argv) => await SdCliProject.buildAsync(argv),
|
|
92
119
|
)
|
|
93
|
-
.command(
|
|
94
|
-
|
|
120
|
+
.command(
|
|
121
|
+
"publish",
|
|
122
|
+
"프로젝트의 각 패키지를 배포합니다.",
|
|
123
|
+
(cmd) => cmd
|
|
95
124
|
.version(false)
|
|
96
125
|
.hide("help")
|
|
97
126
|
.hide("debug")
|
|
@@ -103,7 +132,8 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
103
132
|
},
|
|
104
133
|
config: {
|
|
105
134
|
type: "string",
|
|
106
|
-
describe: "
|
|
135
|
+
describe: "설정 파일 경로",
|
|
136
|
+
default: "simplysm.js",
|
|
107
137
|
},
|
|
108
138
|
options: {
|
|
109
139
|
type: "string",
|
|
@@ -116,9 +146,15 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
116
146
|
describe: "수행할 패키지 설정",
|
|
117
147
|
},
|
|
118
148
|
}),
|
|
149
|
+
async (argv) => await SdCliProject.publishAsync(argv),
|
|
119
150
|
)
|
|
120
|
-
.command(
|
|
121
|
-
|
|
151
|
+
.command(
|
|
152
|
+
"run-electron <package>",
|
|
153
|
+
"변경감지중인 플랫폼을 ELECTRON 앱 형태로 띄웁니다.",
|
|
154
|
+
(cmd) => cmd
|
|
155
|
+
.version(false)
|
|
156
|
+
.hide("help")
|
|
157
|
+
.hide("debug")
|
|
122
158
|
.positional("package", {
|
|
123
159
|
type: "string",
|
|
124
160
|
describe: "패키지명",
|
|
@@ -127,7 +163,8 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
127
163
|
.options({
|
|
128
164
|
config: {
|
|
129
165
|
type: "string",
|
|
130
|
-
describe: "
|
|
166
|
+
describe: "설정 파일 경로",
|
|
167
|
+
default: "simplysm.js",
|
|
131
168
|
},
|
|
132
169
|
options: {
|
|
133
170
|
type: "string",
|
|
@@ -135,9 +172,15 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
135
172
|
describe: "옵션 설정",
|
|
136
173
|
},
|
|
137
174
|
}),
|
|
175
|
+
async (argv) => await SdCliElectron.runAsync(argv),
|
|
138
176
|
)
|
|
139
|
-
.command(
|
|
140
|
-
|
|
177
|
+
.command(
|
|
178
|
+
"build-electron-for-dev <package>",
|
|
179
|
+
"변경감지중인 플랫폼을 ELECTRON 앱 형태로 띄웁니다.",
|
|
180
|
+
(cmd) => cmd
|
|
181
|
+
.version(false)
|
|
182
|
+
.hide("help")
|
|
183
|
+
.hide("debug")
|
|
141
184
|
.positional("package", {
|
|
142
185
|
type: "string",
|
|
143
186
|
describe: "패키지명",
|
|
@@ -146,7 +189,8 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
146
189
|
.options({
|
|
147
190
|
config: {
|
|
148
191
|
type: "string",
|
|
149
|
-
describe: "
|
|
192
|
+
describe: "설정 파일 경로",
|
|
193
|
+
default: "simplysm.js",
|
|
150
194
|
},
|
|
151
195
|
options: {
|
|
152
196
|
type: "string",
|
|
@@ -154,79 +198,69 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
154
198
|
describe: "옵션 설정",
|
|
155
199
|
},
|
|
156
200
|
}),
|
|
201
|
+
async (argv) => await SdCliElectron.buildForDevAsync(argv),
|
|
157
202
|
)
|
|
158
203
|
.command(
|
|
159
204
|
"run-cordova <platform> <package> [url]",
|
|
160
205
|
"변경감지중인 플랫폼을 코도바 디바이스에 앱 형태로 띄웁니다.",
|
|
161
|
-
(cmd) =>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
206
|
+
(cmd) => cmd
|
|
207
|
+
.version(false)
|
|
208
|
+
.hide("help")
|
|
209
|
+
.hide("debug")
|
|
210
|
+
.positional("platform", {
|
|
211
|
+
type: "string",
|
|
212
|
+
describe: "빌드 플랫폼(android,...)",
|
|
213
|
+
demandOption: true,
|
|
214
|
+
})
|
|
215
|
+
.positional("package", {
|
|
216
|
+
type: "string",
|
|
217
|
+
describe: "패키지명",
|
|
218
|
+
demandOption: true,
|
|
219
|
+
})
|
|
220
|
+
.positional("url", {
|
|
221
|
+
type: "string",
|
|
222
|
+
describe: "Webview로 오픈할 URL",
|
|
223
|
+
demandOption: true,
|
|
224
|
+
}),
|
|
225
|
+
async (argv) => await SdCliCordova.runWebviewOnDeviceAsync(argv),
|
|
178
226
|
)
|
|
179
227
|
.command(
|
|
180
228
|
"commit",
|
|
181
229
|
"AI를 통해 변경사항에 대한 커밋 메시지를 작성하여, 커밋 및 푸쉬를 수행합니다.",
|
|
230
|
+
(cmd) => cmd
|
|
231
|
+
.version(false)
|
|
232
|
+
.hide("help")
|
|
233
|
+
.hide("debug"),
|
|
234
|
+
async () => await SdCliAiCommand.commitAsync(),
|
|
182
235
|
)
|
|
183
236
|
.command(
|
|
184
237
|
"postinstall",
|
|
185
238
|
"설치후 자동실행할 작업",
|
|
239
|
+
(cmd) => cmd
|
|
240
|
+
.version(false)
|
|
241
|
+
.hide("help")
|
|
242
|
+
.hide("debug"),
|
|
243
|
+
() => SdCliPostinstall.run(),
|
|
186
244
|
)
|
|
187
|
-
.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
245
|
+
.command(
|
|
246
|
+
"fix",
|
|
247
|
+
"가능한 내용 자동 수정",
|
|
248
|
+
(cmd) => cmd
|
|
249
|
+
.version(false)
|
|
250
|
+
.hide("help")
|
|
251
|
+
.hide("debug"),
|
|
252
|
+
() => {
|
|
253
|
+
convertPrivate();
|
|
254
|
+
convertPrivateUnderscore();
|
|
194
255
|
},
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
else if (argv._[0] === "watch") {
|
|
207
|
-
await SdCliProject.watchAsync(argv);
|
|
208
|
-
}
|
|
209
|
-
else if (argv._[0] === "build") {
|
|
210
|
-
await SdCliProject.buildAsync(argv);
|
|
211
|
-
}
|
|
212
|
-
else if (argv._[0] === "publish") {
|
|
213
|
-
await SdCliProject.publishAsync(argv);
|
|
214
|
-
}
|
|
215
|
-
else if (argv._[0] === "run-electron") {
|
|
216
|
-
await SdCliElectron.runAsync(argv);
|
|
217
|
-
}
|
|
218
|
-
else if (argv._[0] === "build-electron-for-dev") {
|
|
219
|
-
await SdCliElectron.buildForDevAsync(argv);
|
|
220
|
-
}
|
|
221
|
-
else if (argv._[0] === "run-cordova") {
|
|
222
|
-
await SdCliCordova.runWebviewOnDeviceAsync(argv);
|
|
223
|
-
}
|
|
224
|
-
else if (argv._[0] === "commit") {
|
|
225
|
-
await SdCliAiCommand.commitAsync();
|
|
226
|
-
}
|
|
227
|
-
else if (argv._[0] === "postinstall") {
|
|
228
|
-
SdCliPostinstall.run();
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
|
|
232
|
-
}
|
|
256
|
+
)
|
|
257
|
+
.strict()
|
|
258
|
+
.recommendCommands()
|
|
259
|
+
.fail((msg, err, cmd) => {
|
|
260
|
+
console.error("🚫 지원되지 않는 명령입니다.");
|
|
261
|
+
console.error(msg);
|
|
262
|
+
console.log("\n명령어 목록:");
|
|
263
|
+
cmd.showHelp();
|
|
264
|
+
process.exit(1);
|
|
265
|
+
})
|
|
266
|
+
.parseAsync();
|
package/src/sd-cli.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { spawn } from "child_process";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import os from "os";
|
|
6
5
|
import path from "path";
|
|
7
6
|
|
|
7
|
+
// 어차피 sd-worker가 fork로 되어있어서 CPU 제한 안걸리는듯..
|
|
8
|
+
|
|
9
|
+
|
|
8
10
|
// ProcessorAffinity 마스크 계산
|
|
9
|
-
function calculateAffinityMask(cpuCount: number): string {
|
|
11
|
+
/*function calculateAffinityMask(cpuCount: number): string {
|
|
10
12
|
const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount / 12); // 12개당 1개씩 뺌
|
|
11
13
|
const usable = cpuCount - exclude;
|
|
12
14
|
|
|
@@ -16,31 +18,32 @@ function calculateAffinityMask(cpuCount: number): string {
|
|
|
16
18
|
|
|
17
19
|
const maskValue = (1 << usable) - 1;
|
|
18
20
|
return "0x" + maskValue.toString(16).toUpperCase();
|
|
19
|
-
}
|
|
21
|
+
}*/
|
|
20
22
|
|
|
21
23
|
// 논리 CPU 수 기반 affinity mask 계산 (전체 - 1)
|
|
22
|
-
const cpuCount = os.cpus().length;
|
|
23
|
-
const affinityMask = calculateAffinityMask(cpuCount)
|
|
24
|
+
/*const cpuCount = os.cpus().length;
|
|
25
|
+
const affinityMask = calculateAffinityMask(cpuCount);*/
|
|
24
26
|
|
|
25
27
|
// CLI 경로 확인
|
|
26
28
|
const cliPath = import.meta.resolve("./sd-cli-entry");
|
|
27
29
|
|
|
28
30
|
if (path.extname(cliPath) === ".ts") {
|
|
29
31
|
// 현재 프로세스에 affinity 적용
|
|
30
|
-
const pid = process.pid;
|
|
32
|
+
/*const pid = process.pid;
|
|
31
33
|
const command = `powershell -Command "$p = Get-Process -Id ${pid}; $p.ProcessorAffinity = ${affinityMask}"`;
|
|
32
34
|
|
|
33
35
|
exec(command, (err) => {
|
|
34
36
|
if (err) {
|
|
35
37
|
console.error("Affinity 설정 실패:", err.message);
|
|
36
38
|
}
|
|
37
|
-
})
|
|
39
|
+
});*/
|
|
38
40
|
|
|
39
41
|
await import(cliPath);
|
|
40
42
|
}
|
|
41
43
|
else {
|
|
42
44
|
// .js 등의 번들 실행
|
|
43
|
-
const child =
|
|
45
|
+
/*const child = */
|
|
46
|
+
spawn(
|
|
44
47
|
"node",
|
|
45
48
|
[
|
|
46
49
|
"--import=specifier-resolution-node/register",
|
|
@@ -50,7 +53,7 @@ else {
|
|
|
50
53
|
{ stdio: "inherit" },
|
|
51
54
|
);
|
|
52
55
|
|
|
53
|
-
child.on("spawn", () => {
|
|
56
|
+
/*child.on("spawn", () => {
|
|
54
57
|
const pid = child.pid;
|
|
55
58
|
const command = `powershell -Command "$p = Get-Process -Id ${pid}; $p.ProcessorAffinity = ${affinityMask}"`;
|
|
56
59
|
|
|
@@ -59,5 +62,5 @@ else {
|
|
|
59
62
|
console.error("Affinity 설정 실패:", err.message);
|
|
60
63
|
}
|
|
61
64
|
});
|
|
62
|
-
})
|
|
65
|
+
});*/
|
|
63
66
|
}
|
|
@@ -3,21 +3,18 @@ import { SdDependencyCache } from "./sd-dependency-cache";
|
|
|
3
3
|
import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { NgtscProgram } from "@angular/compiler-cli";
|
|
6
|
+
import { ScopePathSet } from "../pkg-builders/commons/scope-path";
|
|
6
7
|
|
|
7
8
|
export class SdDependencyAnalyzer {
|
|
8
9
|
static analyze(
|
|
9
10
|
program: ts.Program,
|
|
10
11
|
compilerHost: ts.CompilerHost,
|
|
11
|
-
|
|
12
|
+
scopePathSet: ScopePathSet,
|
|
12
13
|
depCache: SdDependencyCache,
|
|
13
14
|
): void {
|
|
14
15
|
const compilerOpts = program.getCompilerOptions();
|
|
15
16
|
const typeChecker = program.getTypeChecker();
|
|
16
17
|
|
|
17
|
-
const inScope = (filePath: string): boolean => {
|
|
18
|
-
return scopePaths.some((scope) => PathUtils.isChildPath(filePath, scope));
|
|
19
|
-
};
|
|
20
|
-
|
|
21
18
|
const resolveModule = (text: string, base: string): TNormPath[] => {
|
|
22
19
|
const res = ts.resolveModuleName(
|
|
23
20
|
text,
|
|
@@ -33,7 +30,7 @@ export class SdDependencyAnalyzer {
|
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
const absPath = path.resolve(path.dirname(base), text);
|
|
36
|
-
if (!inScope(absPath)) {
|
|
33
|
+
if (!scopePathSet.inScope(absPath)) {
|
|
37
34
|
return [];
|
|
38
35
|
}
|
|
39
36
|
else if (
|
|
@@ -220,7 +217,7 @@ export class SdDependencyAnalyzer {
|
|
|
220
217
|
for (const decl of valSymbol?.getDeclarations() ?? []) {
|
|
221
218
|
const declFile = decl.getSourceFile();
|
|
222
219
|
const declNPath = PathUtils.norm(declFile.fileName);
|
|
223
|
-
if (declNPath !== sfNPath && inScope(declNPath)) {
|
|
220
|
+
if (declNPath !== sfNPath && scopePathSet.inScope(declNPath)) {
|
|
224
221
|
depCache.addImport(sfNPath, declNPath, 0);
|
|
225
222
|
}
|
|
226
223
|
}
|
|
@@ -235,7 +232,7 @@ export class SdDependencyAnalyzer {
|
|
|
235
232
|
for (const decl of propSymbol.getDeclarations() ?? []) {
|
|
236
233
|
const declFile = decl.getSourceFile();
|
|
237
234
|
const declNPath = PathUtils.norm(declFile.fileName);
|
|
238
|
-
if (declNPath !== sfNPath && inScope(declNPath)) {
|
|
235
|
+
if (declNPath !== sfNPath && scopePathSet.inScope(declNPath)) {
|
|
239
236
|
depCache.addImport(sfNPath, declNPath, 0);
|
|
240
237
|
}
|
|
241
238
|
}
|
|
@@ -252,7 +249,7 @@ export class SdDependencyAnalyzer {
|
|
|
252
249
|
for (const decl of propSymbol.getDeclarations() ?? []) {
|
|
253
250
|
const declFile = decl.getSourceFile();
|
|
254
251
|
const declNPath = PathUtils.norm(declFile.fileName);
|
|
255
|
-
if (declNPath !== sfNPath && inScope(declNPath)) {
|
|
252
|
+
if (declNPath !== sfNPath && scopePathSet.inScope(declNPath)) {
|
|
256
253
|
depCache.addImport(sfNPath, declNPath, 0);
|
|
257
254
|
}
|
|
258
255
|
}
|
|
@@ -275,7 +272,7 @@ export class SdDependencyAnalyzer {
|
|
|
275
272
|
|
|
276
273
|
const sourceFileSet = new Set(
|
|
277
274
|
program.getSourceFiles()
|
|
278
|
-
.filter((sf) => inScope(sf.fileName))
|
|
275
|
+
.filter((sf) => scopePathSet.inScope(sf.fileName))
|
|
279
276
|
.map((sf) => getOrgSourceFile(sf))
|
|
280
277
|
.filterExists(),
|
|
281
278
|
);
|
|
@@ -288,23 +285,19 @@ export class SdDependencyAnalyzer {
|
|
|
288
285
|
|
|
289
286
|
static analyzeAngularResources(
|
|
290
287
|
ngProgram: NgtscProgram,
|
|
291
|
-
|
|
288
|
+
scopePathSet: ScopePathSet,
|
|
292
289
|
depCache: SdDependencyCache,
|
|
293
290
|
) {
|
|
294
|
-
const inScope = (filePath: string): boolean => {
|
|
295
|
-
return scopePaths.some((scope) => PathUtils.isChildPath(filePath, scope));
|
|
296
|
-
};
|
|
297
291
|
|
|
298
292
|
for (const sf of ngProgram.getTsProgram().getSourceFiles()) {
|
|
299
293
|
const fileNPath = PathUtils.norm(sf.fileName);
|
|
300
|
-
if (!inScope(fileNPath)) continue;
|
|
294
|
+
if (!scopePathSet.inScope(fileNPath)) continue;
|
|
301
295
|
|
|
302
296
|
const dependencies = ngProgram.compiler.getResourceDependencies(sf);
|
|
303
297
|
for (const dep of dependencies) {
|
|
304
298
|
const depNPath = PathUtils.norm(dep);
|
|
305
|
-
if (!inScope(depNPath)) continue;
|
|
299
|
+
if (!scopePathSet.inScope(depNPath)) continue;
|
|
306
300
|
|
|
307
|
-
console.log(fileNPath, depNPath);
|
|
308
301
|
depCache.addImport(fileNPath, depNPath, 0);
|
|
309
302
|
}
|
|
310
303
|
}
|