@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.
Files changed (45) hide show
  1. package/dist/entry/sd-cli-electron.js +11 -14
  2. package/dist/entry/sd-cli-electron.js.map +1 -1
  3. package/dist/entry/sd-cli-postinstall.js +1 -1
  4. package/dist/entry/sd-cli-postinstall.js.map +1 -1
  5. package/dist/fix/convert-extends-sd-modal-base-to-interface.d.ts +1 -0
  6. package/dist/fix/convert-extends-sd-modal-base-to-interface.js +289 -0
  7. package/dist/fix/convert-extends-sd-modal-base-to-interface.js.map +1 -0
  8. package/dist/fix/convert-modal-show-params.d.ts +1 -0
  9. package/dist/fix/convert-modal-show-params.js +32 -0
  10. package/dist/fix/convert-modal-show-params.js.map +1 -0
  11. package/dist/fix/convert-sd-angular-symbol-names.js +1 -0
  12. package/dist/fix/convert-sd-angular-symbol-names.js.map +1 -1
  13. package/dist/fix/convert-sd-sheet-bindings-inInline-template.js +6 -1
  14. package/dist/fix/convert-sd-sheet-bindings-inInline-template.js.map +1 -1
  15. package/dist/fix/core/convert-symbol.js +1 -0
  16. package/dist/fix/core/convert-symbol.js.map +1 -1
  17. package/dist/fix/core/remove-named-import.d.ts +1 -0
  18. package/dist/fix/core/remove-named-import.js +14 -0
  19. package/dist/fix/core/remove-named-import.js.map +1 -0
  20. package/dist/fix/core/remove-symbol.d.ts +1 -0
  21. package/dist/fix/core/remove-symbol.js +76 -0
  22. package/dist/fix/core/remove-symbol.js.map +1 -0
  23. package/dist/fix/remove-sd-angular-symbol-names.d.ts +1 -0
  24. package/dist/fix/remove-sd-angular-symbol-names.js +9 -0
  25. package/dist/fix/remove-sd-angular-symbol-names.js.map +1 -0
  26. package/dist/pkg-builders/client/sd-ng.bundler.js +1 -1
  27. package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
  28. package/dist/sd-cli-entry.js +12 -14
  29. package/dist/sd-cli-entry.js.map +1 -1
  30. package/dist/sd-cli.js +54 -38
  31. package/dist/sd-cli.js.map +1 -1
  32. package/package.json +12 -12
  33. package/src/entry/sd-cli-electron.ts +34 -38
  34. package/src/entry/sd-cli-postinstall.ts +1 -1
  35. package/src/fix/convert-extends-sd-modal-base-to-interface.ts +324 -0
  36. package/src/fix/convert-modal-show-params.ts +41 -0
  37. package/src/fix/convert-sd-angular-symbol-names.ts +1 -0
  38. package/src/fix/convert-sd-sheet-bindings-inInline-template.ts +32 -29
  39. package/src/fix/core/convert-symbol.ts +2 -0
  40. package/src/fix/core/remove-named-import.ts +14 -0
  41. package/src/fix/core/remove-symbol.ts +94 -0
  42. package/src/fix/remove-sd-angular-symbol-names.ts +11 -0
  43. package/src/pkg-builders/client/sd-ng.bundler.ts +1 -1
  44. package/src/sd-cli-entry.ts +170 -167
  45. package/src/sd-cli.ts +66 -44
@@ -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
- from "./fix/convert-sd-sheet-bindings-inInline-template";
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 => cmd
51
- .version(false)
52
- .hide("help")
53
- .hide("debug")
54
- .options({
55
- config: {
56
- string: true,
57
- describe: "설정 파일 경로",
58
- default: "simplysm.js",
59
- },
60
- options: {
61
- string: true,
62
- array: true,
63
- describe: "옵션 설정",
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) => cmd
72
- .version(false)
73
- .hide("help")
74
- .hide("debug")
75
- .options({
76
- config: {
77
- string: true,
78
- describe: "설정 파일 경로",
79
- default: "simplysm.js",
80
- },
81
- options: {
82
- string: true,
83
- array: true,
84
- describe: "옵션 설정",
85
- },
86
- packages: {
87
- string: true,
88
- array: true,
89
- describe: "수행할 패키지 설정",
90
- },
91
- inspects: {
92
- string: true,
93
- array: true,
94
- describe: "크롬 inspect를 수행할 패키지 설정",
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) => cmd
103
- .version(false)
104
- .hide("help")
105
- .hide("debug")
106
- .options({
107
- config: {
108
- string: true,
109
- describe: "설정 파일 경로",
110
- default: "simplysm.js",
111
- },
112
- options: {
113
- string: true,
114
- array: true,
115
- describe: "옵션 설정",
116
- },
117
- packages: {
118
- string: true,
119
- array: true,
120
- describe: "수행할 패키지 설정",
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) => cmd
129
- .version(false)
130
- .hide("help")
131
- .hide("debug")
132
- .options({
133
- noBuild: {
134
- type: "boolean",
135
- describe: "빌드를 하지않고 배포합니다.",
136
- default: false,
137
- },
138
- config: {
139
- type: "string",
140
- describe: "설정 파일 경로",
141
- default: "simplysm.js",
142
- },
143
- options: {
144
- type: "string",
145
- array: true,
146
- describe: "옵션 설정",
147
- },
148
- packages: {
149
- type: "string",
150
- array: true,
151
- describe: "수행할 패키지 설정",
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) => cmd
160
- .version(false)
161
- .hide("help")
162
- .hide("debug")
163
- .positional("package", {
164
- type: "string",
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
- array: true,
177
- describe: "옵션 설정",
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) => cmd
186
- .version(false)
187
- .hide("help")
188
- .hide("debug")
189
- .positional("package", {
190
- type: "string",
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
- array: true,
203
- describe: "옵션 설정",
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) => cmd
212
- .version(false)
213
- .hide("help")
214
- .hide("debug")
215
- .positional("platform", {
216
- type: "string",
217
- describe: "빌드 플랫폼(android,...)",
218
- demandOption: true,
219
- })
220
- .positional("package", {
221
- type: "string",
222
- describe: "패키지명",
223
- demandOption: true,
224
- })
225
- .positional("url", {
226
- type: "string",
227
- describe: "Webview로 오픈할 URL",
228
- demandOption: true,
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
- import { spawn } from "child_process";
4
- import { fileURLToPath } from "node:url";
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
- // 어차피 sd-worker가 fork로 되어있어서 CPU 제한 안걸리는듯..
8
- // tsx사용을 해야해서 fork말고 worker로는 동작 못시킴..
10
+ // CLI 경로 확인
11
+ const cliPath = import.meta.resolve("./sd-cli-entry");
9
12
 
13
+ if (path.extname(cliPath) === ".ts") {
14
+ // .ts 바로실행 (개발)
10
15
 
11
- // ProcessorAffinity 마스크 계산
12
- /*function calculateAffinityMask(cpuCount: number): string {
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
- if (usable <= 0) {
17
- throw new Error(`CPU 사용 가능 개수가 0 이하입니다 (총: ${cpuCount}, 제외: ${exclude})`);
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
- const maskValue = (1 << usable) - 1;
21
- return "0x" + maskValue.toString(16).toUpperCase();
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
- // 논리 CPU 기반 affinity mask 계산 (전체 - 1)
25
- /*const cpuCount = os.cpus().length;
26
- const affinityMask = calculateAffinityMask(cpuCount);*/
43
+ // 실행된 프로세스에 Affinity 적용
44
+ child.on("spawn", () => {
45
+ if (child.pid == null) return;
46
+ configureProcessorAffinity(child.pid);
47
+ });
48
+ }
27
49
 
28
- // CLI 경로 확인
29
- const cliPath = import.meta.resolve("./sd-cli-entry");
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
- await import(cliPath);
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
- /*child.on("spawn", () => {
58
- const pid = child.pid;
59
- const command = `powershell -Command "$p = Get-Process -Id ${pid}; $p.ProcessorAffinity = ${affinityMask}"`;
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
- exec(command, (err) => {
62
- if (err) {
63
- console.error("Affinity 설정 실패:", err.message);
64
- }
85
+ child.on("close", () => {
86
+ resolve();
65
87
  });
66
- });*/
67
- }
88
+ });
89
+ }