@simplysm/sd-cli 12.11.2 → 12.11.4
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/fix/convert-extends-sd-print-template-base-to-interface.d.ts +1 -0
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.js +179 -0
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.js.map +1 -0
- package/dist/fix/convert-flat-pages-to-flat-menus.d.ts +1 -0
- package/dist/fix/convert-flat-pages-to-flat-menus.js +68 -0
- package/dist/fix/convert-flat-pages-to-flat-menus.js.map +1 -0
- package/dist/fix/convert-get-menus-to-usable-menus.d.ts +1 -0
- package/dist/fix/convert-get-menus-to-usable-menus.js +48 -0
- package/dist/fix/convert-get-menus-to-usable-menus.js.map +1 -0
- package/dist/fix/convert-modal-show-params.d.ts +1 -1
- package/dist/fix/convert-modal-show-params.js +1 -1
- package/dist/fix/convert-modal-show-params.js.map +1 -1
- package/dist/fix/convert-print-params.d.ts +1 -0
- package/dist/fix/convert-print-params.js +37 -0
- package/dist/fix/convert-print-params.js.map +1 -0
- package/dist/fix/convert-to-use-perms-signal.d.ts +1 -0
- package/dist/fix/convert-to-use-perms-signal.js +99 -0
- package/dist/fix/convert-to-use-perms-signal.js.map +1 -0
- package/dist/fix/remove-unused-imports.d.ts +1 -0
- package/dist/fix/remove-unused-imports.js +42 -0
- package/dist/fix/remove-unused-imports.js.map +1 -0
- package/dist/fix/remove-unused-injects.d.ts +1 -0
- package/dist/fix/remove-unused-injects.js +38 -0
- package/dist/fix/remove-unused-injects.js.map +1 -0
- package/dist/sd-cli-entry.js +16 -1
- package/dist/sd-cli-entry.js.map +1 -1
- package/package.json +9 -9
- package/src/fix/convert-extends-sd-print-template-base-to-interface.ts +201 -0
- package/src/fix/convert-flat-pages-to-flat-menus.ts +83 -0
- package/src/fix/convert-get-menus-to-usable-menus.ts +60 -0
- package/src/fix/convert-modal-show-params.ts +1 -1
- package/src/fix/convert-print-params.ts +51 -0
- package/src/fix/convert-to-use-perms-signal.ts +133 -0
- package/src/fix/remove-unused-imports.ts +50 -0
- package/src/fix/remove-unused-injects.ts +50 -0
- package/src/sd-cli-entry.ts +26 -4
package/dist/sd-cli-entry.js
CHANGED
|
@@ -18,6 +18,13 @@ import convertSdSheetBindingsInInlineTemplate from "./fix/convert-sd-sheet-bindi
|
|
|
18
18
|
import convertSetupCumulateSelectedKeysToObjectParam from "./fix/convert-setup-cumulate-selected-keys-to-object-param";
|
|
19
19
|
import prefixUnderscoreForAccessModifiers from "./fix/prefix-underscore-for-access-modifiers";
|
|
20
20
|
import removeSdAngularSymbolNames from "./fix/remove-sd-angular-symbol-names";
|
|
21
|
+
import { convertExtendsSdPrintTemplateBaseToInterface } from "./fix/convert-extends-sd-print-template-base-to-interface";
|
|
22
|
+
import convertPrintParams from "./fix/convert-print-params";
|
|
23
|
+
import { convertToUsePermsSignal } from "./fix/convert-to-use-perms-signal";
|
|
24
|
+
import { convertGetMenusToUsableMenus } from "./fix/convert-get-menus-to-usable-menus";
|
|
25
|
+
import { removeUnusedInjects } from "./fix/remove-unused-injects";
|
|
26
|
+
import { removeUnusedImports } from "./fix/remove-unused-imports";
|
|
27
|
+
import { convertFlatPagesToUsableFlatMenus } from "./fix/convert-flat-pages-to-flat-menus";
|
|
21
28
|
Error.stackTraceLimit = Infinity;
|
|
22
29
|
EventEmitter.defaultMaxListeners = 0;
|
|
23
30
|
await yargs(hideBin(process.argv))
|
|
@@ -207,9 +214,17 @@ await yargs(hideBin(process.argv))
|
|
|
207
214
|
convertSetupCumulateSelectedKeysToObjectParam();
|
|
208
215
|
convertExtendsSdModalBaseToInterface();
|
|
209
216
|
convertModalShowParams();
|
|
210
|
-
|
|
217
|
+
convertExtendsSdPrintTemplateBaseToInterface();
|
|
218
|
+
convertPrintParams();
|
|
219
|
+
convertToUsePermsSignal();
|
|
220
|
+
convertGetMenusToUsableMenus();
|
|
221
|
+
convertFlatPagesToUsableFlatMenus();
|
|
222
|
+
//-- 심볼정리
|
|
211
223
|
removeSdAngularSymbolNames();
|
|
212
224
|
convertSdAngularSymbolNames();
|
|
225
|
+
//-- inject/import 정리
|
|
226
|
+
removeUnusedInjects();
|
|
227
|
+
removeUnusedImports();
|
|
213
228
|
})
|
|
214
229
|
.strict()
|
|
215
230
|
.recommendCommands()
|
package/dist/sd-cli-entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-cli-entry.js","sourceRoot":"","sources":["../src/sd-cli-entry.ts"],"names":[],"mappings":";AAEA,+BAA+B;AAE/B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,6BAA6B,MAAM,0CAA0C,CAAC;AACrF,OAAO,
|
|
1
|
+
{"version":3,"file":"sd-cli-entry.js","sourceRoot":"","sources":["../src/sd-cli-entry.ts"],"names":[],"mappings":";AAEA,+BAA+B;AAE/B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,O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,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;KACD,UAAU,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/sd-cli",
|
|
3
|
-
"version": "12.11.
|
|
3
|
+
"version": "12.11.4",
|
|
4
4
|
"description": "심플리즘 패키지 - CLI",
|
|
5
5
|
"author": "김석래",
|
|
6
6
|
"repository": {
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
"bin": "./dist/sd-cli.js",
|
|
13
13
|
"type": "module",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@angular/build": "^19.2.
|
|
16
|
-
"@angular/compiler": "^19.2.
|
|
17
|
-
"@angular/compiler-cli": "^19.2.
|
|
15
|
+
"@angular/build": "^19.2.14",
|
|
16
|
+
"@angular/compiler": "^19.2.14",
|
|
17
|
+
"@angular/compiler-cli": "^19.2.14",
|
|
18
18
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
19
19
|
"@electron/rebuild": "^4.0.1",
|
|
20
|
-
"@simplysm/sd-core-common": "12.11.
|
|
21
|
-
"@simplysm/sd-core-node": "12.11.
|
|
22
|
-
"@simplysm/sd-service-server": "12.11.
|
|
23
|
-
"@simplysm/sd-storage": "12.11.
|
|
20
|
+
"@simplysm/sd-core-common": "12.11.4",
|
|
21
|
+
"@simplysm/sd-core-node": "12.11.4",
|
|
22
|
+
"@simplysm/sd-service-server": "12.11.4",
|
|
23
|
+
"@simplysm/sd-storage": "12.11.4",
|
|
24
24
|
"browserslist": "^4.24.5",
|
|
25
25
|
"cordova": "^12.0.0",
|
|
26
26
|
"css-has-pseudo": "^7.0.2",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"specifier-resolution-node": "^1.1.4",
|
|
38
38
|
"ts-morph": "^26.0.0",
|
|
39
39
|
"typescript": "~5.7.3",
|
|
40
|
-
"yargs": "^
|
|
40
|
+
"yargs": "^18.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/xml2js": "^0.4.14",
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import { SyntaxKind } from "ts-morph";
|
|
4
|
+
import getTsMorphSourceFiles from "./core/get-ts-morph-source-files";
|
|
5
|
+
import removeNamedImport from "./core/remove-named-import";
|
|
6
|
+
|
|
7
|
+
export function convertExtendsSdPrintTemplateBaseToInterface() {
|
|
8
|
+
const sourceFiles = getTsMorphSourceFiles();
|
|
9
|
+
|
|
10
|
+
let totalChanged = 0;
|
|
11
|
+
|
|
12
|
+
for (const sourceFile of sourceFiles) {
|
|
13
|
+
let changed = false;
|
|
14
|
+
const relPath = path.basename(sourceFile.getFilePath());
|
|
15
|
+
|
|
16
|
+
const printClass = sourceFile.getClasses().find((classDecl) => {
|
|
17
|
+
const extendsClause = classDecl
|
|
18
|
+
.getHeritageClauses()
|
|
19
|
+
.find((h) => h.getToken() === SyntaxKind.ExtendsKeyword);
|
|
20
|
+
if (!extendsClause) return false;
|
|
21
|
+
const typeNodes = extendsClause.getTypeNodes();
|
|
22
|
+
return typeNodes.some((typeNode) =>
|
|
23
|
+
/^SdPrintTemplateBase\s*<[^>]+>$/.test(typeNode.getText()),
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (!printClass) continue;
|
|
28
|
+
|
|
29
|
+
const extendsClause = printClass
|
|
30
|
+
.getHeritageClauses()
|
|
31
|
+
.find((h) => h.getToken() === SyntaxKind.ExtendsKeyword);
|
|
32
|
+
if (!extendsClause) continue;
|
|
33
|
+
const typeNodes = extendsClause.getTypeNodes();
|
|
34
|
+
const match = typeNodes[0]?.getText().match(/^SdPrintTemplateBase\s*<([^>]+)>$/);
|
|
35
|
+
if (!match) continue;
|
|
36
|
+
const paramTypeName = match[1].trim();
|
|
37
|
+
const paramInterface = sourceFile.getInterface(paramTypeName);
|
|
38
|
+
if (!paramInterface) continue;
|
|
39
|
+
const props = paramInterface.getProperties();
|
|
40
|
+
const paramNames = props.map((p) => p.getName());
|
|
41
|
+
|
|
42
|
+
// 1. property/class 필드 추가
|
|
43
|
+
let lastPropIdx = 0;
|
|
44
|
+
for (const prop of props) {
|
|
45
|
+
const propName = prop.getName();
|
|
46
|
+
const isOptional = prop.hasQuestionToken();
|
|
47
|
+
const propType = prop.getTypeNode()?.getText() ?? "any";
|
|
48
|
+
const initializer = `input${isOptional ? "" : ".required"}<${propType}>()`;
|
|
49
|
+
if (!printClass.getProperty(propName)) {
|
|
50
|
+
printClass.insertProperty(lastPropIdx, { name: propName, initializer });
|
|
51
|
+
lastPropIdx++;
|
|
52
|
+
changed = true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 2. implements 추가
|
|
57
|
+
if (!printClass.getImplements().some(i => i.getText() === "ISdPrint")) {
|
|
58
|
+
printClass.addImplements("ISdPrint");
|
|
59
|
+
changed = true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 3. super() 삭제 (생성자)
|
|
63
|
+
const ctor = printClass.getConstructors().first();
|
|
64
|
+
if (ctor) {
|
|
65
|
+
ctor.getStatements().forEach((stmt) => {
|
|
66
|
+
if (stmt.getKind() === SyntaxKind.ExpressionStatement) {
|
|
67
|
+
const expr = stmt.asKind(SyntaxKind.ExpressionStatement)?.getExpression();
|
|
68
|
+
if (expr?.asKind(SyntaxKind.CallExpression)?.getExpression().getText() === "super") {
|
|
69
|
+
stmt.remove();
|
|
70
|
+
changed = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 4. this.print() 전체 삭제
|
|
77
|
+
printClass
|
|
78
|
+
.getDescendantsOfKind(SyntaxKind.CallExpression)
|
|
79
|
+
.filter((expr) =>
|
|
80
|
+
expr.getExpression().getKind() === SyntaxKind.PropertyAccessExpression &&
|
|
81
|
+
expr.getExpression().getText() === "this.print",
|
|
82
|
+
)
|
|
83
|
+
.forEach((expr) => {
|
|
84
|
+
const parentStmt = expr.getFirstAncestorByKind(SyntaxKind.ExpressionStatement);
|
|
85
|
+
if (parentStmt) {
|
|
86
|
+
parentStmt.remove();
|
|
87
|
+
changed = true;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// 5. params().xxx → xxx() 및 this.params().xxx → this.xxx() AST 치환
|
|
92
|
+
printClass.forEachDescendant((node) => {
|
|
93
|
+
if (node.getKind() === SyntaxKind.PropertyAccessExpression) {
|
|
94
|
+
const propAccess = node.asKind(SyntaxKind.PropertyAccessExpression)!;
|
|
95
|
+
const propName = propAccess.getName();
|
|
96
|
+
if (!paramNames.includes(propName)) return;
|
|
97
|
+
const expr = propAccess.getExpression();
|
|
98
|
+
|
|
99
|
+
if (expr.getKind() === SyntaxKind.CallExpression) {
|
|
100
|
+
const callExpr = expr.asKind(SyntaxKind.CallExpression)!;
|
|
101
|
+
const innerExpr = callExpr.getExpression();
|
|
102
|
+
|
|
103
|
+
if (innerExpr.getKind() === SyntaxKind.Identifier && innerExpr.getText() === "params") {
|
|
104
|
+
propAccess.replaceWithText(`${propName}()`);
|
|
105
|
+
changed = true;
|
|
106
|
+
} else if (
|
|
107
|
+
innerExpr.getKind() === SyntaxKind.PropertyAccessExpression &&
|
|
108
|
+
innerExpr.asKind(SyntaxKind.PropertyAccessExpression)!.getExpression().getKind() === SyntaxKind.ThisKeyword &&
|
|
109
|
+
innerExpr.asKind(SyntaxKind.PropertyAccessExpression)!.getName() === "params"
|
|
110
|
+
) {
|
|
111
|
+
propAccess.replaceWithText(`this.${propName}()`);
|
|
112
|
+
changed = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// 6. @Component template: params().xxx → xxx() 치환
|
|
119
|
+
const componentDecorator = printClass.getDecorator("Component");
|
|
120
|
+
if (componentDecorator) {
|
|
121
|
+
const arg = componentDecorator.getArguments().first();
|
|
122
|
+
if (arg?.getKind() === SyntaxKind.ObjectLiteralExpression) {
|
|
123
|
+
const tplProp = arg.asKind(SyntaxKind.ObjectLiteralExpression)!.getProperty("template");
|
|
124
|
+
if (
|
|
125
|
+
tplProp?.getKind() === SyntaxKind.PropertyAssignment &&
|
|
126
|
+
tplProp.asKind(SyntaxKind.PropertyAssignment)!.getInitializer()
|
|
127
|
+
) {
|
|
128
|
+
const propAssign = tplProp.asKind(SyntaxKind.PropertyAssignment)!;
|
|
129
|
+
const init = propAssign.getInitializerOrThrow();
|
|
130
|
+
let tplText = init.getText();
|
|
131
|
+
let tplTextRaw = tplText;
|
|
132
|
+
for (const paramName of paramNames) {
|
|
133
|
+
const paramsPattern = new RegExp(`params\\(\\)\\.${paramName}\\b`, "g");
|
|
134
|
+
tplTextRaw = tplTextRaw.replace(paramsPattern, `${paramName}()`);
|
|
135
|
+
}
|
|
136
|
+
if (tplTextRaw !== tplText) {
|
|
137
|
+
propAssign.setInitializer(tplTextRaw);
|
|
138
|
+
changed = true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 7. import 정리
|
|
145
|
+
const sdAngularImport = sourceFile.getImportDeclaration(
|
|
146
|
+
d => d.getModuleSpecifierValue() === "@simplysm/sd-angular"
|
|
147
|
+
);
|
|
148
|
+
if (sdAngularImport) {
|
|
149
|
+
const namedImports = sdAngularImport.getNamedImports();
|
|
150
|
+
if (!namedImports.some(n => n.getName() === "ISdPrint")) {
|
|
151
|
+
sdAngularImport.addNamedImport("ISdPrint");
|
|
152
|
+
changed = true;
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
sourceFile.addImportDeclaration({
|
|
156
|
+
namedImports: ["ISdPrint"],
|
|
157
|
+
moduleSpecifier: "@simplysm/sd-angular"
|
|
158
|
+
});
|
|
159
|
+
changed = true;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const ngCoreImport = sourceFile.getImportDeclaration(
|
|
163
|
+
(d) => d.getModuleSpecifierValue() === "@angular/core",
|
|
164
|
+
);
|
|
165
|
+
if (ngCoreImport) {
|
|
166
|
+
const imports = ngCoreImport.getNamedImports().map((n) => n.getName());
|
|
167
|
+
if (!imports.includes("input")) {
|
|
168
|
+
ngCoreImport.addNamedImport("input");
|
|
169
|
+
changed = true;
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
sourceFile.addImportDeclaration({
|
|
173
|
+
namedImports: ["input"],
|
|
174
|
+
moduleSpecifier: "@angular/core",
|
|
175
|
+
});
|
|
176
|
+
changed = true;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// 8. interface 선언 삭제
|
|
180
|
+
paramInterface.remove();
|
|
181
|
+
|
|
182
|
+
// 9. extends 삭제
|
|
183
|
+
printClass.removeExtends();
|
|
184
|
+
|
|
185
|
+
// 10. 불필요한 import 제거
|
|
186
|
+
removeNamedImport(sourceFile, "@simplysm/sd-angular", "SdPrintTemplateBase");
|
|
187
|
+
|
|
188
|
+
// 11. 저장 및 로그 출력
|
|
189
|
+
if (changed) {
|
|
190
|
+
sourceFile.saveSync();
|
|
191
|
+
totalChanged++;
|
|
192
|
+
console.log(`[print-updated] ${relPath} :: 프린트 기반 변경 완료`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (totalChanged > 0) {
|
|
197
|
+
console.log(`\n[완료] 프린트 변환 완료 (총 ${totalChanged}개)`);
|
|
198
|
+
} else {
|
|
199
|
+
console.log(`[완료] 변환 대상 없음`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { SyntaxKind } from "ts-morph";
|
|
3
|
+
import getTsMorphSourceFiles from "./core/get-ts-morph-source-files";
|
|
4
|
+
|
|
5
|
+
export function convertFlatPagesToUsableFlatMenus() {
|
|
6
|
+
const sourceFiles = getTsMorphSourceFiles();
|
|
7
|
+
let totalChanged = 0;
|
|
8
|
+
|
|
9
|
+
for (const sourceFile of sourceFiles) {
|
|
10
|
+
let changed = false;
|
|
11
|
+
|
|
12
|
+
for (const cls of sourceFile.getClasses()) {
|
|
13
|
+
// 1. flatPages property 선언 확인
|
|
14
|
+
const prop = cls.getInstanceProperty("flatPages")?.asKind(SyntaxKind.PropertyDeclaration);
|
|
15
|
+
if (!prop) continue;
|
|
16
|
+
|
|
17
|
+
const initializer = prop.getInitializer();
|
|
18
|
+
if (!initializer) continue;
|
|
19
|
+
|
|
20
|
+
const callExpr = initializer.asKind(SyntaxKind.CallExpression);
|
|
21
|
+
if (!callExpr) continue;
|
|
22
|
+
|
|
23
|
+
const expr = callExpr.getExpression();
|
|
24
|
+
if (
|
|
25
|
+
expr.getKind() === SyntaxKind.PropertyAccessExpression &&
|
|
26
|
+
expr.getText() === "this._sdAppStructure.getFlatPages"
|
|
27
|
+
) {
|
|
28
|
+
// 2. 선언 변경
|
|
29
|
+
prop.rename("flatMenus");
|
|
30
|
+
prop.setInitializer("this._sdAppStructure.usableFlatMenus()");
|
|
31
|
+
changed = true;
|
|
32
|
+
console.log(`[변환됨] ${sourceFile.getBaseName()} → flatPages 선언 → flatMenus`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 3. 클래스 내 this.flatPages → this.flatMenus 치환
|
|
36
|
+
cls.forEachDescendant((node) => {
|
|
37
|
+
if (node.getKind() === SyntaxKind.PropertyAccessExpression) {
|
|
38
|
+
const propAccess = node.asKind(SyntaxKind.PropertyAccessExpression)!;
|
|
39
|
+
if (
|
|
40
|
+
propAccess.getExpression().getKind() === SyntaxKind.ThisKeyword &&
|
|
41
|
+
propAccess.getName() === "flatPages"
|
|
42
|
+
) {
|
|
43
|
+
propAccess.replaceWithText("this.flatMenus");
|
|
44
|
+
changed = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// 4. @Component의 template 내 문자열 치환
|
|
50
|
+
const componentDecorator = cls.getDecorator("Component");
|
|
51
|
+
const arg = componentDecorator?.getArguments()[0]?.asKind(SyntaxKind.ObjectLiteralExpression);
|
|
52
|
+
const templateProp = arg?.getProperty("template")?.asKind(SyntaxKind.PropertyAssignment);
|
|
53
|
+
const templateInit = templateProp?.getInitializer();
|
|
54
|
+
if (
|
|
55
|
+
templateInit &&
|
|
56
|
+
(templateInit.getKind() === SyntaxKind.NoSubstitutionTemplateLiteral ||
|
|
57
|
+
templateInit.getKind() === SyntaxKind.StringLiteral ||
|
|
58
|
+
templateInit.getKind() === SyntaxKind.TemplateExpression)
|
|
59
|
+
) {
|
|
60
|
+
const originalText = templateInit.getText();
|
|
61
|
+
const newText = originalText.replace(/\bflatPages\b/g, "flatMenus");
|
|
62
|
+
|
|
63
|
+
if (newText !== originalText) {
|
|
64
|
+
templateInit.replaceWithText(newText);
|
|
65
|
+
changed = true;
|
|
66
|
+
console.log(`[변환됨] ${sourceFile.getBaseName()} → 템플릿 내 flatPages → flatMenus`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (changed) {
|
|
72
|
+
sourceFile.saveSync();
|
|
73
|
+
totalChanged++;
|
|
74
|
+
console.log(`[updated] ${sourceFile.getBaseName()} :: flatMenus 변환 완료`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log(
|
|
79
|
+
totalChanged > 0
|
|
80
|
+
? `\n[완료] flatPages → flatMenus 전체 변환 완료 (총 ${totalChanged}개)`
|
|
81
|
+
: `[완료] 변환 대상 없음`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { SyntaxKind } from "ts-morph";
|
|
3
|
+
import getTsMorphSourceFiles from "./core/get-ts-morph-source-files";
|
|
4
|
+
|
|
5
|
+
export function convertGetMenusToUsableMenus() {
|
|
6
|
+
const sourceFiles = getTsMorphSourceFiles();
|
|
7
|
+
let totalChanged = 0;
|
|
8
|
+
|
|
9
|
+
for (const sourceFile of sourceFiles) {
|
|
10
|
+
let changed = false;
|
|
11
|
+
|
|
12
|
+
for (const cls of sourceFile.getClasses()) {
|
|
13
|
+
const menusProp = cls.getInstanceProperty("menus")?.asKind(SyntaxKind.PropertyDeclaration);
|
|
14
|
+
if (!menusProp) continue;
|
|
15
|
+
|
|
16
|
+
const initializer = menusProp.getInitializer()?.asKind(SyntaxKind.CallExpression);
|
|
17
|
+
if (
|
|
18
|
+
!initializer ||
|
|
19
|
+
initializer.getFirstChildByKind(SyntaxKind.Identifier)?.getText() !== "$computed"
|
|
20
|
+
) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const arrowFn = initializer
|
|
25
|
+
.asKind(SyntaxKind.CallExpression)
|
|
26
|
+
?.getArguments()
|
|
27
|
+
.first()
|
|
28
|
+
?.asKind(SyntaxKind.ArrowFunction);
|
|
29
|
+
if (!arrowFn) continue;
|
|
30
|
+
|
|
31
|
+
const body = arrowFn.getBody().asKind(SyntaxKind.CallExpression);
|
|
32
|
+
if (!body || !body.getText().includes("this._sdAppStructure.getMenus")) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const callExpr = body.asKind(SyntaxKind.CallExpression)!;
|
|
37
|
+
const calleeExpr = callExpr.getExpression();
|
|
38
|
+
if (
|
|
39
|
+
calleeExpr.getKind() === SyntaxKind.PropertyAccessExpression &&
|
|
40
|
+
calleeExpr.getText() === "this._sdAppStructure.getMenus"
|
|
41
|
+
) {
|
|
42
|
+
// 수정 실행: getMenus → usableMenus
|
|
43
|
+
calleeExpr.replaceWithText("this._sdAppStructure.usableMenus");
|
|
44
|
+
changed = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (changed) {
|
|
49
|
+
sourceFile.saveSync();
|
|
50
|
+
totalChanged++;
|
|
51
|
+
console.log(`[updated] ${sourceFile.getBaseName()} :: menus → usableMenus 변경 완료`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log(
|
|
56
|
+
totalChanged > 0
|
|
57
|
+
? `\n[완료] usableMenus 변경 완료 (총 ${totalChanged}개)`
|
|
58
|
+
: `[완료] 변환 대상 없음`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Node, SyntaxKind } from "ts-morph";
|
|
2
2
|
import getTsMorphSourceFiles from "./core/get-ts-morph-source-files";
|
|
3
3
|
|
|
4
|
-
export default function
|
|
4
|
+
export default function convertModalShowParams() {
|
|
5
5
|
const sourceFiles = getTsMorphSourceFiles();
|
|
6
6
|
|
|
7
7
|
for (const sourceFile of sourceFiles) {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Node, SyntaxKind } from "ts-morph";
|
|
2
|
+
import getTsMorphSourceFiles from "./core/get-ts-morph-source-files";
|
|
3
|
+
|
|
4
|
+
export default function convertPrintParams() {
|
|
5
|
+
const sourceFiles = getTsMorphSourceFiles();
|
|
6
|
+
|
|
7
|
+
for (const sourceFile of sourceFiles) {
|
|
8
|
+
const typeChecker = sourceFile.getProject().getTypeChecker();
|
|
9
|
+
|
|
10
|
+
const callExprs = sourceFile
|
|
11
|
+
.getDescendantsOfKind(SyntaxKind.CallExpression)
|
|
12
|
+
.filter((callExpr) => {
|
|
13
|
+
const expr = callExpr.getExpression();
|
|
14
|
+
return (
|
|
15
|
+
Node.isPropertyAccessExpression(expr) &&
|
|
16
|
+
expr.getName() === "printAsync" &&
|
|
17
|
+
expr.getExpression().getText() === "this._sdPrint"
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
for (const callExpr of callExprs) {
|
|
22
|
+
const args = callExpr.getArguments();
|
|
23
|
+
if (args.length < 2) continue;
|
|
24
|
+
|
|
25
|
+
const firstArg = args[0];
|
|
26
|
+
const type = typeChecker.getTypeAtLocation(firstArg);
|
|
27
|
+
|
|
28
|
+
// 클래스 타입인지 확인 (Symbol이 존재하고, 선언이 class인지 여부 판단)
|
|
29
|
+
const symbol = type.getSymbol();
|
|
30
|
+
const isClass =
|
|
31
|
+
symbol?.getDeclarations().some((decl) => Node.isClassDeclaration(decl)) ?? false;
|
|
32
|
+
|
|
33
|
+
if (!isClass) continue;
|
|
34
|
+
|
|
35
|
+
// 변환 처리
|
|
36
|
+
const typeText = firstArg.getText();
|
|
37
|
+
const inputsText = args[1]?.getText() ?? "{}";
|
|
38
|
+
|
|
39
|
+
const props = [`type: ${typeText}`, `inputs: ${inputsText}`];
|
|
40
|
+
const objectLiteralText = `{\n ${props.join(",\n ")}\n}`;
|
|
41
|
+
|
|
42
|
+
const newArgs = [`${objectLiteralText}`, ...args.slice(2).map((arg) => arg.getText())].join(
|
|
43
|
+
", ",
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
callExpr.replaceWithText(`this._sdPrint.printAsync(${newArgs})`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
sourceFile.saveSync();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import {
|
|
3
|
+
ArrowFunction,
|
|
4
|
+
CallExpression,
|
|
5
|
+
PropertyDeclaration,
|
|
6
|
+
SourceFile,
|
|
7
|
+
SyntaxKind,
|
|
8
|
+
} from "ts-morph";
|
|
9
|
+
import getTsMorphSourceFiles from "./core/get-ts-morph-source-files";
|
|
10
|
+
|
|
11
|
+
export function convertToUsePermsSignal() {
|
|
12
|
+
const sourceFiles = getTsMorphSourceFiles();
|
|
13
|
+
let totalChanged = 0;
|
|
14
|
+
|
|
15
|
+
for (const sourceFile of sourceFiles) {
|
|
16
|
+
let changed = false;
|
|
17
|
+
|
|
18
|
+
for (const cls of sourceFile.getClasses()) {
|
|
19
|
+
try {
|
|
20
|
+
const result = processClass(cls);
|
|
21
|
+
if (result.success) {
|
|
22
|
+
changed = true;
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error(`[오류] ${sourceFile.getBaseName()} 클래스 처리 중 오류:`, error);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (changed) {
|
|
30
|
+
addImportIfNeeded(sourceFile);
|
|
31
|
+
sourceFile.saveSync();
|
|
32
|
+
totalChanged++;
|
|
33
|
+
console.log(`[updated] ${sourceFile.getBaseName()} :: usePermsSignal 변환 완료`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log(
|
|
38
|
+
totalChanged > 0 ? `\n[완료] 변환 완료 (총 ${totalChanged}개)` : `[완료] 변환 대상 없음`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function processClass(cls: any) {
|
|
43
|
+
const viewCodesProp = getPropertyDeclaration(cls, "viewCodes");
|
|
44
|
+
const permsProp = getPropertyDeclaration(cls, "perms");
|
|
45
|
+
|
|
46
|
+
if (!viewCodesProp || !permsProp) {
|
|
47
|
+
return { success: false, reason: "필수 프로퍼티 없음" };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const viewCodesInit = viewCodesProp.getInitializer();
|
|
51
|
+
const permsInit = permsProp.getInitializer();
|
|
52
|
+
|
|
53
|
+
if (!isValidViewCodesInit(viewCodesInit) || !isValidPermsInit(permsInit)) {
|
|
54
|
+
return { success: false, reason: "초기화 값이 유효하지 않음" };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const permsCallExpr = permsInit as CallExpression;
|
|
58
|
+
const arrowFunction = getArrowFunction(permsCallExpr);
|
|
59
|
+
|
|
60
|
+
if (!arrowFunction) {
|
|
61
|
+
return { success: false, reason: "Arrow function을 찾을 수 없음" };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const callExpression = getPermsCallExpression(arrowFunction);
|
|
65
|
+
|
|
66
|
+
if (!callExpression) {
|
|
67
|
+
return { success: false, reason: "getViewPerms 호출을 찾을 수 없음" };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const args = callExpression.getArguments();
|
|
71
|
+
if (args.length !== 2) {
|
|
72
|
+
return { success: false, reason: "인자 개수가 맞지 않음" };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 변환 실행
|
|
76
|
+
const viewCodesText = viewCodesInit!.getText();
|
|
77
|
+
const permsText = args[1].getText();
|
|
78
|
+
|
|
79
|
+
permsProp.setInitializer(`usePermsSignal(${viewCodesText}, ${permsText})`);
|
|
80
|
+
viewCodesProp.remove();
|
|
81
|
+
|
|
82
|
+
return { success: true };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function getPropertyDeclaration(cls: any, name: string): PropertyDeclaration | undefined {
|
|
86
|
+
const prop = cls.getInstanceProperty(name);
|
|
87
|
+
return prop?.getKind() === SyntaxKind.PropertyDeclaration ? prop : undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function isValidViewCodesInit(init: any): boolean {
|
|
91
|
+
return init?.getKind() === SyntaxKind.ArrayLiteralExpression;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function isValidPermsInit(init: any): boolean {
|
|
95
|
+
return init?.getKind() === SyntaxKind.CallExpression;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getArrowFunction(callExpr: CallExpression): ArrowFunction | undefined {
|
|
99
|
+
const firstArg = callExpr.getArguments().first();
|
|
100
|
+
return firstArg?.getKind() === SyntaxKind.ArrowFunction ? (firstArg as ArrowFunction) : undefined;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function getPermsCallExpression(arrowFn: ArrowFunction): CallExpression | undefined {
|
|
104
|
+
const body = arrowFn.getBody();
|
|
105
|
+
|
|
106
|
+
if (body.getKind() !== SyntaxKind.CallExpression) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const callExpr = body as CallExpression;
|
|
111
|
+
return callExpr.getText().includes("this._sdAppStructure.getViewPerms") ? callExpr : undefined;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function addImportIfNeeded(sourceFile: SourceFile) {
|
|
115
|
+
const sdAngularImport = sourceFile.getImportDeclaration(
|
|
116
|
+
(d: any) => d.getModuleSpecifierValue() === "@simplysm/sd-angular",
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
if (sdAngularImport) {
|
|
120
|
+
const hasImport = sdAngularImport
|
|
121
|
+
.getNamedImports()
|
|
122
|
+
.some((n: any) => n.getName() === "usePermsSignal");
|
|
123
|
+
|
|
124
|
+
if (!hasImport) {
|
|
125
|
+
sdAngularImport.addNamedImport("usePermsSignal");
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
sourceFile.addImportDeclaration({
|
|
129
|
+
namedImports: ["usePermsSignal"],
|
|
130
|
+
moduleSpecifier: "@simplysm/sd-angular",
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|