@simplysm/sd-cli 12.9.42 → 12.10.2
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-electron.js +11 -14
- package/dist/entry/sd-cli-electron.js.map +1 -1
- package/dist/entry/sd-cli-postinstall.js +1 -1
- package/dist/entry/sd-cli-postinstall.js.map +1 -1
- package/dist/fix/convert-extends-sd-modal-base-to-interface.d.ts +1 -0
- package/dist/fix/convert-extends-sd-modal-base-to-interface.js +289 -0
- package/dist/fix/convert-extends-sd-modal-base-to-interface.js.map +1 -0
- package/dist/fix/convert-modal-show-params.d.ts +1 -0
- package/dist/fix/convert-modal-show-params.js +32 -0
- package/dist/fix/convert-modal-show-params.js.map +1 -0
- package/dist/fix/convert-sd-angular-symbol-names.js +1 -0
- package/dist/fix/convert-sd-angular-symbol-names.js.map +1 -1
- package/dist/fix/convert-sd-sheet-bindings-inInline-template.js +6 -1
- package/dist/fix/convert-sd-sheet-bindings-inInline-template.js.map +1 -1
- package/dist/fix/core/convert-symbol.js +1 -0
- package/dist/fix/core/convert-symbol.js.map +1 -1
- package/dist/fix/core/remove-named-import.d.ts +1 -0
- package/dist/fix/core/remove-named-import.js +14 -0
- package/dist/fix/core/remove-named-import.js.map +1 -0
- package/dist/fix/core/remove-symbol.d.ts +1 -0
- package/dist/fix/core/remove-symbol.js +76 -0
- package/dist/fix/core/remove-symbol.js.map +1 -0
- package/dist/fix/remove-sd-angular-symbol-names.d.ts +1 -0
- package/dist/fix/remove-sd-angular-symbol-names.js +9 -0
- package/dist/fix/remove-sd-angular-symbol-names.js.map +1 -0
- package/dist/pkg-builders/client/sd-ng.bundler.js +1 -1
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
- package/dist/sd-cli-entry.js +12 -14
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.js +54 -38
- package/dist/sd-cli.js.map +1 -1
- package/package.json +12 -12
- package/src/entry/sd-cli-electron.ts +34 -38
- package/src/entry/sd-cli-postinstall.ts +1 -1
- package/src/fix/convert-extends-sd-modal-base-to-interface.ts +324 -0
- package/src/fix/convert-modal-show-params.ts +41 -0
- package/src/fix/convert-sd-angular-symbol-names.ts +1 -0
- package/src/fix/convert-sd-sheet-bindings-inInline-template.ts +32 -29
- package/src/fix/core/convert-symbol.ts +2 -0
- package/src/fix/core/remove-named-import.ts +14 -0
- package/src/fix/core/remove-symbol.ts +94 -0
- package/src/fix/remove-sd-angular-symbol-names.ts +11 -0
- package/src/pkg-builders/client/sd-ng.bundler.ts +1 -1
- package/src/sd-cli-entry.ts +170 -167
- package/src/sd-cli.ts +66 -44
package/src/sd-cli-entry.ts
CHANGED
|
@@ -13,12 +13,13 @@ import { SdCliLocalUpdate } from "./entry/sd-cli-local-update";
|
|
|
13
13
|
import { SdCliPostinstall } from "./entry/sd-cli-postinstall";
|
|
14
14
|
import { SdCliProject } from "./entry/sd-cli-project";
|
|
15
15
|
import convertEcmaPrivateToTsPrivate from "./fix/convert-ecma-private-to-ts-private";
|
|
16
|
+
import { convertExtendsSdModalBaseToInterface } from "./fix/convert-extends-sd-modal-base-to-interface";
|
|
17
|
+
import convertModalShowParams from "./fix/convert-modal-show-params";
|
|
16
18
|
import convertSdAngularSymbolNames from "./fix/convert-sd-angular-symbol-names";
|
|
17
|
-
import convertSdSheetBindingsInInlineTemplate
|
|
18
|
-
|
|
19
|
-
import convertSetupCumulateSelectedKeysToObjectParam
|
|
20
|
-
from "./fix/convert-setup-cumulate-selected-keys-to-object-param";
|
|
19
|
+
import convertSdSheetBindingsInInlineTemplate from "./fix/convert-sd-sheet-bindings-inInline-template";
|
|
20
|
+
import convertSetupCumulateSelectedKeysToObjectParam from "./fix/convert-setup-cumulate-selected-keys-to-object-param";
|
|
21
21
|
import prefixUnderscoreForAccessModifiers from "./fix/prefix-underscore-for-access-modifiers";
|
|
22
|
+
import removeSdAngularSymbolNames from "./fix/remove-sd-angular-symbol-names";
|
|
22
23
|
|
|
23
24
|
Error.stackTraceLimit = Infinity;
|
|
24
25
|
EventEmitter.defaultMaxListeners = 0;
|
|
@@ -39,221 +40,218 @@ await yargs(hideBin(process.argv))
|
|
|
39
40
|
SdLogger.setConfig({
|
|
40
41
|
console: { level: SdLoggerSeverity.debug },
|
|
41
42
|
});
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
43
|
+
} else {
|
|
44
44
|
SdLogger.setConfig({ dot: true });
|
|
45
45
|
}
|
|
46
46
|
})
|
|
47
47
|
.command(
|
|
48
48
|
"local-update",
|
|
49
49
|
"로컬 라이브러리 업데이트를 수행합니다.",
|
|
50
|
-
cmd =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
(cmd) =>
|
|
51
|
+
cmd
|
|
52
|
+
.version(false)
|
|
53
|
+
.hide("help")
|
|
54
|
+
.hide("debug")
|
|
55
|
+
.options({
|
|
56
|
+
config: {
|
|
57
|
+
string: true,
|
|
58
|
+
describe: "설정 파일 경로",
|
|
59
|
+
default: "simplysm.js",
|
|
60
|
+
},
|
|
61
|
+
options: {
|
|
62
|
+
string: true,
|
|
63
|
+
array: true,
|
|
64
|
+
describe: "옵션 설정",
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
66
67
|
async (argv) => await SdCliLocalUpdate.runAsync(argv),
|
|
67
68
|
)
|
|
68
69
|
.command(
|
|
69
70
|
"watch",
|
|
70
71
|
"프로젝트의 각 패키지에 대한 변경감지 빌드를 수행합니다.",
|
|
71
|
-
(cmd) =>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
72
|
+
(cmd) =>
|
|
73
|
+
cmd
|
|
74
|
+
.version(false)
|
|
75
|
+
.hide("help")
|
|
76
|
+
.hide("debug")
|
|
77
|
+
.options({
|
|
78
|
+
config: {
|
|
79
|
+
string: true,
|
|
80
|
+
describe: "설정 파일 경로",
|
|
81
|
+
default: "simplysm.js",
|
|
82
|
+
},
|
|
83
|
+
options: {
|
|
84
|
+
string: true,
|
|
85
|
+
array: true,
|
|
86
|
+
describe: "옵션 설정",
|
|
87
|
+
},
|
|
88
|
+
packages: {
|
|
89
|
+
string: true,
|
|
90
|
+
array: true,
|
|
91
|
+
describe: "수행할 패키지 설정",
|
|
92
|
+
},
|
|
93
|
+
inspects: {
|
|
94
|
+
string: true,
|
|
95
|
+
array: true,
|
|
96
|
+
describe: "크롬 inspect를 수행할 패키지 설정",
|
|
97
|
+
},
|
|
98
|
+
}),
|
|
97
99
|
async (argv) => await SdCliProject.watchAsync(argv),
|
|
98
100
|
)
|
|
99
101
|
.command(
|
|
100
102
|
"build",
|
|
101
103
|
"프로젝트의 각 패키지에 대한 빌드를 수행합니다.",
|
|
102
|
-
(cmd) =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
104
|
+
(cmd) =>
|
|
105
|
+
cmd
|
|
106
|
+
.version(false)
|
|
107
|
+
.hide("help")
|
|
108
|
+
.hide("debug")
|
|
109
|
+
.options({
|
|
110
|
+
config: {
|
|
111
|
+
string: true,
|
|
112
|
+
describe: "설정 파일 경로",
|
|
113
|
+
default: "simplysm.js",
|
|
114
|
+
},
|
|
115
|
+
options: {
|
|
116
|
+
string: true,
|
|
117
|
+
array: true,
|
|
118
|
+
describe: "옵션 설정",
|
|
119
|
+
},
|
|
120
|
+
packages: {
|
|
121
|
+
string: true,
|
|
122
|
+
array: true,
|
|
123
|
+
describe: "수행할 패키지 설정",
|
|
124
|
+
},
|
|
125
|
+
}),
|
|
123
126
|
async (argv) => await SdCliProject.buildAsync(argv),
|
|
124
127
|
)
|
|
125
128
|
.command(
|
|
126
129
|
"publish",
|
|
127
130
|
"프로젝트의 각 패키지를 배포합니다.",
|
|
128
|
-
(cmd) =>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
131
|
+
(cmd) =>
|
|
132
|
+
cmd
|
|
133
|
+
.version(false)
|
|
134
|
+
.hide("help")
|
|
135
|
+
.hide("debug")
|
|
136
|
+
.options({
|
|
137
|
+
noBuild: {
|
|
138
|
+
type: "boolean",
|
|
139
|
+
describe: "빌드를 하지않고 배포합니다.",
|
|
140
|
+
default: false,
|
|
141
|
+
},
|
|
142
|
+
config: {
|
|
143
|
+
type: "string",
|
|
144
|
+
describe: "설정 파일 경로",
|
|
145
|
+
default: "simplysm.js",
|
|
146
|
+
},
|
|
147
|
+
options: {
|
|
148
|
+
type: "string",
|
|
149
|
+
array: true,
|
|
150
|
+
describe: "옵션 설정",
|
|
151
|
+
},
|
|
152
|
+
packages: {
|
|
153
|
+
type: "string",
|
|
154
|
+
array: true,
|
|
155
|
+
describe: "수행할 패키지 설정",
|
|
156
|
+
},
|
|
157
|
+
}),
|
|
154
158
|
async (argv) => await SdCliProject.publishAsync(argv),
|
|
155
159
|
)
|
|
156
160
|
.command(
|
|
157
161
|
"run-electron <package>",
|
|
158
162
|
"변경감지중인 플랫폼을 ELECTRON 앱 형태로 띄웁니다.",
|
|
159
|
-
(cmd) =>
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
describe: "패키지명",
|
|
166
|
-
demandOption: true,
|
|
167
|
-
})
|
|
168
|
-
.options({
|
|
169
|
-
config: {
|
|
170
|
-
type: "string",
|
|
171
|
-
describe: "설정 파일 경로",
|
|
172
|
-
default: "simplysm.js",
|
|
173
|
-
},
|
|
174
|
-
options: {
|
|
163
|
+
(cmd) =>
|
|
164
|
+
cmd
|
|
165
|
+
.version(false)
|
|
166
|
+
.hide("help")
|
|
167
|
+
.hide("debug")
|
|
168
|
+
.positional("package", {
|
|
175
169
|
type: "string",
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
170
|
+
describe: "패키지명",
|
|
171
|
+
demandOption: true,
|
|
172
|
+
})
|
|
173
|
+
.options({
|
|
174
|
+
config: {
|
|
175
|
+
type: "string",
|
|
176
|
+
describe: "설정 파일 경로",
|
|
177
|
+
default: "simplysm.js",
|
|
178
|
+
},
|
|
179
|
+
options: {
|
|
180
|
+
type: "string",
|
|
181
|
+
array: true,
|
|
182
|
+
describe: "옵션 설정",
|
|
183
|
+
},
|
|
184
|
+
}),
|
|
180
185
|
async (argv) => await SdCliElectron.runAsync(argv),
|
|
181
186
|
)
|
|
182
187
|
.command(
|
|
183
188
|
"build-electron-for-dev <package>",
|
|
184
189
|
"변경감지중인 플랫폼을 ELECTRON 앱 형태로 띄웁니다.",
|
|
185
|
-
(cmd) =>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
describe: "패키지명",
|
|
192
|
-
demandOption: true,
|
|
193
|
-
})
|
|
194
|
-
.options({
|
|
195
|
-
config: {
|
|
196
|
-
type: "string",
|
|
197
|
-
describe: "설정 파일 경로",
|
|
198
|
-
default: "simplysm.js",
|
|
199
|
-
},
|
|
200
|
-
options: {
|
|
190
|
+
(cmd) =>
|
|
191
|
+
cmd
|
|
192
|
+
.version(false)
|
|
193
|
+
.hide("help")
|
|
194
|
+
.hide("debug")
|
|
195
|
+
.positional("package", {
|
|
201
196
|
type: "string",
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
197
|
+
describe: "패키지명",
|
|
198
|
+
demandOption: true,
|
|
199
|
+
})
|
|
200
|
+
.options({
|
|
201
|
+
config: {
|
|
202
|
+
type: "string",
|
|
203
|
+
describe: "설정 파일 경로",
|
|
204
|
+
default: "simplysm.js",
|
|
205
|
+
},
|
|
206
|
+
options: {
|
|
207
|
+
type: "string",
|
|
208
|
+
array: true,
|
|
209
|
+
describe: "옵션 설정",
|
|
210
|
+
},
|
|
211
|
+
}),
|
|
206
212
|
async (argv) => await SdCliElectron.buildForDevAsync(argv),
|
|
207
213
|
)
|
|
208
214
|
.command(
|
|
209
215
|
"run-cordova <platform> <package> [url]",
|
|
210
216
|
"변경감지중인 플랫폼을 코도바 디바이스에 앱 형태로 띄웁니다.",
|
|
211
|
-
(cmd) =>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
217
|
+
(cmd) =>
|
|
218
|
+
cmd
|
|
219
|
+
.version(false)
|
|
220
|
+
.hide("help")
|
|
221
|
+
.hide("debug")
|
|
222
|
+
.positional("platform", {
|
|
223
|
+
type: "string",
|
|
224
|
+
describe: "빌드 플랫폼(android,...)",
|
|
225
|
+
demandOption: true,
|
|
226
|
+
})
|
|
227
|
+
.positional("package", {
|
|
228
|
+
type: "string",
|
|
229
|
+
describe: "패키지명",
|
|
230
|
+
demandOption: true,
|
|
231
|
+
})
|
|
232
|
+
.positional("url", {
|
|
233
|
+
type: "string",
|
|
234
|
+
describe: "Webview로 오픈할 URL",
|
|
235
|
+
demandOption: true,
|
|
236
|
+
}),
|
|
230
237
|
async (argv) => await SdCliCordova.runWebviewOnDeviceAsync(argv),
|
|
231
238
|
)
|
|
232
239
|
.command(
|
|
233
240
|
"commit",
|
|
234
241
|
"AI를 통해 변경사항에 대한 커밋 메시지를 작성하여, 커밋 및 푸쉬를 수행합니다.",
|
|
235
|
-
(cmd) => cmd
|
|
236
|
-
.version(false)
|
|
237
|
-
.hide("help")
|
|
238
|
-
.hide("debug"),
|
|
242
|
+
(cmd) => cmd.version(false).hide("help").hide("debug"),
|
|
239
243
|
async () => await SdCliAiCommand.commitAsync(),
|
|
240
244
|
)
|
|
241
245
|
.command(
|
|
242
246
|
"postinstall",
|
|
243
247
|
"설치후 자동실행할 작업",
|
|
244
|
-
(cmd) => cmd
|
|
245
|
-
.version(false)
|
|
246
|
-
.hide("help")
|
|
247
|
-
.hide("debug"),
|
|
248
|
+
(cmd) => cmd.version(false).hide("help").hide("debug"),
|
|
248
249
|
() => SdCliPostinstall.run(),
|
|
249
250
|
)
|
|
250
251
|
.command(
|
|
251
252
|
"fix",
|
|
252
253
|
"가능한 내용 자동 수정",
|
|
253
|
-
(cmd) => cmd
|
|
254
|
-
.version(false)
|
|
255
|
-
.hide("help")
|
|
256
|
-
.hide("debug"),
|
|
254
|
+
(cmd) => cmd.version(false).hide("help").hide("debug"),
|
|
257
255
|
() => {
|
|
258
256
|
// GIT 사용중일 경우, 커밋되지 않은 수정사항이 있는지 확인
|
|
259
257
|
/*if (FsUtils.exists(path.resolve(process.cwd(), ".git"))) {
|
|
@@ -266,8 +264,13 @@ await yargs(hideBin(process.argv))
|
|
|
266
264
|
convertEcmaPrivateToTsPrivate();
|
|
267
265
|
prefixUnderscoreForAccessModifiers();
|
|
268
266
|
convertSdSheetBindingsInInlineTemplate();
|
|
269
|
-
convertSdAngularSymbolNames();
|
|
270
267
|
convertSetupCumulateSelectedKeysToObjectParam();
|
|
268
|
+
convertExtendsSdModalBaseToInterface();
|
|
269
|
+
convertModalShowParams();
|
|
270
|
+
|
|
271
|
+
//-- last
|
|
272
|
+
removeSdAngularSymbolNames();
|
|
273
|
+
convertSdAngularSymbolNames();
|
|
271
274
|
},
|
|
272
275
|
)
|
|
273
276
|
.strict()
|
package/src/sd-cli.ts
CHANGED
|
@@ -1,67 +1,89 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
|
|
5
|
+
import { exec, spawn } from "child_process";
|
|
6
|
+
import os from "os";
|
|
5
7
|
import path from "path";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
6
9
|
|
|
7
|
-
//
|
|
8
|
-
|
|
10
|
+
// CLI 경로 확인
|
|
11
|
+
const cliPath = import.meta.resolve("./sd-cli-entry");
|
|
9
12
|
|
|
13
|
+
if (path.extname(cliPath) === ".ts") {
|
|
14
|
+
// .ts 바로실행 (개발)
|
|
10
15
|
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount / 12); // 12개당 1개씩 뺌
|
|
14
|
-
const usable = cpuCount - exclude;
|
|
16
|
+
// 현재 프로세스에 affinity 적용
|
|
17
|
+
configureProcessorAffinity(process.pid);
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
await import(cliPath);
|
|
20
|
+
} else {
|
|
21
|
+
// .js 번들 실행 (배포본)
|
|
22
|
+
|
|
23
|
+
// 로컬 업데이트
|
|
24
|
+
if (!process.argv.slice(2).includes("local-update")) {
|
|
25
|
+
await spawnWaitAsync(`node`, [
|
|
26
|
+
"--import=specifier-resolution-node/register",
|
|
27
|
+
fileURLToPath(cliPath),
|
|
28
|
+
"local-update",
|
|
29
|
+
]);
|
|
18
30
|
}
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
32
|
+
// 프로세스 실행
|
|
33
|
+
const child = spawn(
|
|
34
|
+
"node",
|
|
35
|
+
[
|
|
36
|
+
"--import=specifier-resolution-node/register",
|
|
37
|
+
fileURLToPath(cliPath),
|
|
38
|
+
...process.argv.slice(2),
|
|
39
|
+
],
|
|
40
|
+
{ stdio: "inherit" },
|
|
41
|
+
);
|
|
23
42
|
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
43
|
+
// 실행된 프로세스에 Affinity 적용
|
|
44
|
+
child.on("spawn", () => {
|
|
45
|
+
if (child.pid == null) return;
|
|
46
|
+
configureProcessorAffinity(child.pid);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
27
49
|
|
|
28
|
-
|
|
29
|
-
|
|
50
|
+
function configureProcessorAffinity(pid: number) {
|
|
51
|
+
// 논리 CPU 수 기반 affinity mask 계산 (전체 - 1)
|
|
52
|
+
const cpuCount = os.cpus().length;
|
|
53
|
+
const affinityMask = calculateAffinityMask(cpuCount);
|
|
30
54
|
|
|
31
|
-
if (path.extname(cliPath) === ".ts") {
|
|
32
|
-
// 현재 프로세스에 affinity 적용
|
|
33
|
-
/*const pid = process.pid;
|
|
34
55
|
const command = `powershell -Command "$p = Get-Process -Id ${pid}; $p.ProcessorAffinity = ${affinityMask}"`;
|
|
35
56
|
|
|
36
57
|
exec(command, (err) => {
|
|
37
58
|
if (err) {
|
|
38
59
|
console.error("Affinity 설정 실패:", err.message);
|
|
39
60
|
}
|
|
40
|
-
})
|
|
61
|
+
});
|
|
62
|
+
}
|
|
41
63
|
|
|
42
|
-
|
|
64
|
+
// ProcessorAffinity 마스크 계산
|
|
65
|
+
function calculateAffinityMask(cpuCount: number): string {
|
|
66
|
+
const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount / 12); // 12개당 1개씩 뺌
|
|
67
|
+
const usable = cpuCount - exclude;
|
|
68
|
+
|
|
69
|
+
if (usable <= 0) {
|
|
70
|
+
throw new Error(`CPU 사용 가능 개수가 0 이하입니다 (총: ${cpuCount}, 제외: ${exclude})`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const maskValue = (1 << usable) - 1;
|
|
74
|
+
return "0x" + maskValue.toString(16).toUpperCase();
|
|
43
75
|
}
|
|
44
|
-
else {
|
|
45
|
-
// .js 등의 번들 실행
|
|
46
|
-
/*const child = */
|
|
47
|
-
spawn(
|
|
48
|
-
"node",
|
|
49
|
-
[
|
|
50
|
-
"--import=specifier-resolution-node/register",
|
|
51
|
-
fileURLToPath(cliPath),
|
|
52
|
-
...process.argv.slice(2),
|
|
53
|
-
],
|
|
54
|
-
{ stdio: "inherit" },
|
|
55
|
-
);
|
|
56
76
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
77
|
+
async function spawnWaitAsync(command: string, args: string[]) {
|
|
78
|
+
await new Promise<void>((resolve) => {
|
|
79
|
+
const child = spawn(command, args, {
|
|
80
|
+
cwd: process.cwd(),
|
|
81
|
+
env: { ...process.env },
|
|
82
|
+
stdio: "inherit",
|
|
83
|
+
});
|
|
60
84
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
console.error("Affinity 설정 실패:", err.message);
|
|
64
|
-
}
|
|
85
|
+
child.on("close", () => {
|
|
86
|
+
resolve();
|
|
65
87
|
});
|
|
66
|
-
})
|
|
67
|
-
}
|
|
88
|
+
});
|
|
89
|
+
}
|