@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.
Files changed (36) hide show
  1. package/dist/fix/convert-extends-sd-print-template-base-to-interface.d.ts +1 -0
  2. package/dist/fix/convert-extends-sd-print-template-base-to-interface.js +179 -0
  3. package/dist/fix/convert-extends-sd-print-template-base-to-interface.js.map +1 -0
  4. package/dist/fix/convert-flat-pages-to-flat-menus.d.ts +1 -0
  5. package/dist/fix/convert-flat-pages-to-flat-menus.js +68 -0
  6. package/dist/fix/convert-flat-pages-to-flat-menus.js.map +1 -0
  7. package/dist/fix/convert-get-menus-to-usable-menus.d.ts +1 -0
  8. package/dist/fix/convert-get-menus-to-usable-menus.js +48 -0
  9. package/dist/fix/convert-get-menus-to-usable-menus.js.map +1 -0
  10. package/dist/fix/convert-modal-show-params.d.ts +1 -1
  11. package/dist/fix/convert-modal-show-params.js +1 -1
  12. package/dist/fix/convert-modal-show-params.js.map +1 -1
  13. package/dist/fix/convert-print-params.d.ts +1 -0
  14. package/dist/fix/convert-print-params.js +37 -0
  15. package/dist/fix/convert-print-params.js.map +1 -0
  16. package/dist/fix/convert-to-use-perms-signal.d.ts +1 -0
  17. package/dist/fix/convert-to-use-perms-signal.js +99 -0
  18. package/dist/fix/convert-to-use-perms-signal.js.map +1 -0
  19. package/dist/fix/remove-unused-imports.d.ts +1 -0
  20. package/dist/fix/remove-unused-imports.js +42 -0
  21. package/dist/fix/remove-unused-imports.js.map +1 -0
  22. package/dist/fix/remove-unused-injects.d.ts +1 -0
  23. package/dist/fix/remove-unused-injects.js +38 -0
  24. package/dist/fix/remove-unused-injects.js.map +1 -0
  25. package/dist/sd-cli-entry.js +16 -1
  26. package/dist/sd-cli-entry.js.map +1 -1
  27. package/package.json +9 -9
  28. package/src/fix/convert-extends-sd-print-template-base-to-interface.ts +201 -0
  29. package/src/fix/convert-flat-pages-to-flat-menus.ts +83 -0
  30. package/src/fix/convert-get-menus-to-usable-menus.ts +60 -0
  31. package/src/fix/convert-modal-show-params.ts +1 -1
  32. package/src/fix/convert-print-params.ts +51 -0
  33. package/src/fix/convert-to-use-perms-signal.ts +133 -0
  34. package/src/fix/remove-unused-imports.ts +50 -0
  35. package/src/fix/remove-unused-injects.ts +50 -0
  36. package/src/sd-cli-entry.ts +26 -4
@@ -0,0 +1,50 @@
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 removeUnusedImports() {
6
+ const sourceFiles = getTsMorphSourceFiles();
7
+ let totalChanged = 0;
8
+
9
+ for (const sourceFile of sourceFiles) {
10
+ let changed = false;
11
+
12
+ for (const importDecl of sourceFile.getImportDeclarations()) {
13
+ // ⚠️ 사이드이펙트 import는 유지
14
+ if (importDecl.getNamedImports().length === 0) {
15
+ continue;
16
+ }
17
+
18
+ // ⚙️ Named import 제거
19
+ for (const namedImport of importDecl.getNamedImports()) {
20
+ const name = namedImport.getName();
21
+ const used = sourceFile
22
+ .getDescendantsOfKind(SyntaxKind.Identifier)
23
+ .some((id) => id.getText() === name && id !== namedImport.getNameNode());
24
+ if (!used) {
25
+ namedImport.remove();
26
+ changed = true;
27
+ console.log(`[정리됨] ${sourceFile.getBaseName()} → 미사용 import: ${name}`);
28
+ }
29
+ }
30
+
31
+ // 모든 import가 제거된 경우 전체 import 선언 제거
32
+ if (importDecl.getNamedImports().length === 0) {
33
+ importDecl.remove();
34
+ changed = true;
35
+ }
36
+ }
37
+
38
+ if (changed) {
39
+ sourceFile.saveSync();
40
+ totalChanged++;
41
+ console.log(`[updated] ${sourceFile.getBaseName()} :: import 정리 완료`);
42
+ }
43
+ }
44
+
45
+ console.log(
46
+ totalChanged > 0
47
+ ? `\n[완료] 미사용 import 정리 완료 (총 ${totalChanged}개)`
48
+ : `[완료] 정리 대상 없음`,
49
+ );
50
+ }
@@ -0,0 +1,50 @@
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 removeUnusedInjects() {
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 injectVars = cls
14
+ .getInstanceProperties()
15
+ .filter(
16
+ (p) =>
17
+ p.isKind(SyntaxKind.PropertyDeclaration) &&
18
+ p.getInitializer()?.isKind(SyntaxKind.CallExpression) &&
19
+ p.getInitializer()!.getText().startsWith("inject("),
20
+ );
21
+
22
+ for (const propDecl of injectVars) {
23
+ const name = propDecl.getName();
24
+
25
+ // 클래스 전체에서 해당 변수명이 참조되고 있는지 확인
26
+ const references = cls
27
+ .getDescendants()
28
+ .filter((desc) => desc.getText() === name && desc !== propDecl.getNameNode());
29
+
30
+ if (references.length === 0) {
31
+ propDecl.remove();
32
+ changed = true;
33
+ console.log(`[정리됨] ${sourceFile.getBaseName()} → 미사용 inject: ${name}`);
34
+ }
35
+ }
36
+ }
37
+
38
+ if (changed) {
39
+ sourceFile.saveSync();
40
+ totalChanged++;
41
+ console.log(`[updated] ${sourceFile.getBaseName()} :: inject 정리 완료`);
42
+ }
43
+ }
44
+
45
+ console.log(
46
+ totalChanged > 0
47
+ ? `\n[완료] 미사용 inject 정리 완료 (총 ${totalChanged}개)`
48
+ : `[완료] 정리 대상 없음`,
49
+ );
50
+ }
@@ -13,13 +13,26 @@ 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";
16
+ import {
17
+ convertExtendsSdModalBaseToInterface
18
+ } from "./fix/convert-extends-sd-modal-base-to-interface";
17
19
  import convertModalShowParams from "./fix/convert-modal-show-params";
18
20
  import convertSdAngularSymbolNames from "./fix/convert-sd-angular-symbol-names";
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
+ import convertSdSheetBindingsInInlineTemplate
22
+ from "./fix/convert-sd-sheet-bindings-inInline-template";
23
+ import convertSetupCumulateSelectedKeysToObjectParam
24
+ from "./fix/convert-setup-cumulate-selected-keys-to-object-param";
21
25
  import prefixUnderscoreForAccessModifiers from "./fix/prefix-underscore-for-access-modifiers";
22
26
  import removeSdAngularSymbolNames from "./fix/remove-sd-angular-symbol-names";
27
+ import {
28
+ convertExtendsSdPrintTemplateBaseToInterface
29
+ } from "./fix/convert-extends-sd-print-template-base-to-interface";
30
+ import convertPrintParams from "./fix/convert-print-params";
31
+ import { convertToUsePermsSignal } from "./fix/convert-to-use-perms-signal";
32
+ import { convertGetMenusToUsableMenus } from "./fix/convert-get-menus-to-usable-menus";
33
+ import { removeUnusedInjects } from "./fix/remove-unused-injects";
34
+ import { removeUnusedImports } from "./fix/remove-unused-imports";
35
+ import { convertFlatPagesToUsableFlatMenus } from "./fix/convert-flat-pages-to-flat-menus";
23
36
 
24
37
  Error.stackTraceLimit = Infinity;
25
38
  EventEmitter.defaultMaxListeners = 0;
@@ -267,10 +280,19 @@ await yargs(hideBin(process.argv))
267
280
  convertSetupCumulateSelectedKeysToObjectParam();
268
281
  convertExtendsSdModalBaseToInterface();
269
282
  convertModalShowParams();
283
+ convertExtendsSdPrintTemplateBaseToInterface();
284
+ convertPrintParams();
285
+ convertToUsePermsSignal();
286
+ convertGetMenusToUsableMenus();
287
+ convertFlatPagesToUsableFlatMenus();
270
288
 
271
- //-- last
289
+ //-- 심볼정리
272
290
  removeSdAngularSymbolNames();
273
291
  convertSdAngularSymbolNames();
292
+
293
+ //-- inject/import 정리
294
+ removeUnusedInjects();
295
+ removeUnusedImports();
274
296
  },
275
297
  )
276
298
  .strict()