@reliverse/dler 1.6.6 → 1.6.7

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 (82) hide show
  1. package/README.md +92 -10
  2. package/bin/app/build/cmd.js +1 -1
  3. package/bin/app/build/impl.js +1 -1
  4. package/bin/app/check/cmd.d.ts +0 -3
  5. package/bin/app/check/cmd.js +68 -351
  6. package/bin/app/cmds.d.ts +21 -437
  7. package/bin/app/cmds.js +38 -22
  8. package/bin/app/deps/cmd.js +2 -2
  9. package/bin/app/migrate/cmd.d.ts +12 -2
  10. package/bin/app/migrate/cmd.js +105 -58
  11. package/bin/app/migrate/codemods/anything-to-bun.d.ts +5 -0
  12. package/bin/app/migrate/codemods/anything-to-bun.js +597 -0
  13. package/bin/app/migrate/codemods/fs-to-relifso.d.ts +8 -0
  14. package/bin/app/migrate/codemods/fs-to-relifso.js +179 -0
  15. package/bin/app/migrate/codemods/path-to-pathkit.d.ts +8 -0
  16. package/bin/app/migrate/codemods/{lib-pathe-pathkit.js → path-to-pathkit.js} +22 -111
  17. package/bin/app/pub/cmd.js +1 -1
  18. package/bin/app/rempts/cmd/cmd.js +10 -3
  19. package/bin/cli.js +14 -4
  20. package/bin/libs/sdk/sdk-impl/build/build-library.js +23 -19
  21. package/bin/libs/sdk/sdk-impl/build/build-regular.js +13 -13
  22. package/bin/libs/sdk/sdk-impl/check/check-consts.d.ts +29 -0
  23. package/bin/libs/sdk/sdk-impl/check/check-consts.js +48 -0
  24. package/bin/libs/sdk/sdk-impl/check/check-mod.d.ts +2 -0
  25. package/bin/libs/sdk/sdk-impl/check/check-mod.js +87 -0
  26. package/bin/libs/sdk/sdk-impl/check/check-utils.d.ts +5 -0
  27. package/bin/libs/sdk/sdk-impl/check/check-utils.js +56 -0
  28. package/bin/libs/sdk/sdk-impl/check/rules/dler-config-health.d.ts +2 -0
  29. package/bin/libs/sdk/sdk-impl/check/rules/dler-config-health.js +37 -0
  30. package/bin/libs/sdk/sdk-impl/check/rules/file-extensions.d.ts +2 -0
  31. package/bin/libs/sdk/sdk-impl/check/rules/file-extensions.js +69 -0
  32. package/bin/{app/deps/impl/wrapper.d.ts → libs/sdk/sdk-impl/check/rules/missing-deps.d.ts} +1 -1
  33. package/bin/{app/deps/impl/wrapper.js → libs/sdk/sdk-impl/check/rules/missing-deps.js} +2 -2
  34. package/bin/libs/sdk/sdk-impl/check/rules/package-json-health.d.ts +2 -0
  35. package/bin/libs/sdk/sdk-impl/check/rules/package-json-health.js +67 -0
  36. package/bin/libs/sdk/sdk-impl/check/rules/path-extensions.d.ts +2 -0
  37. package/bin/libs/sdk/sdk-impl/check/rules/path-extensions.js +93 -0
  38. package/bin/libs/sdk/sdk-impl/check/rules/self-include.d.ts +2 -0
  39. package/bin/libs/sdk/sdk-impl/check/rules/self-include.js +98 -0
  40. package/bin/libs/sdk/sdk-impl/check/rules/tsconfig-health.d.ts +2 -0
  41. package/bin/libs/sdk/sdk-impl/check/rules/tsconfig-health.js +35 -0
  42. package/bin/libs/sdk/{default.d.ts → sdk-impl/config/default.d.ts} +1 -1
  43. package/bin/libs/sdk/{default.js → sdk-impl/config/default.js} +15 -5
  44. package/bin/libs/sdk/sdk-impl/config/define.d.ts +2 -0
  45. package/bin/libs/sdk/sdk-impl/config/define.js +4 -0
  46. package/bin/{init → libs/sdk/sdk-impl/config}/info.js +1 -1
  47. package/bin/{init → libs/sdk/sdk-impl/config}/init.js +8 -8
  48. package/bin/{init → libs/sdk/sdk-impl/config}/load.d.ts +2 -1
  49. package/bin/{init → libs/sdk/sdk-impl/config}/load.js +15 -6
  50. package/bin/libs/sdk/sdk-impl/library-flow.d.ts +1 -1
  51. package/bin/libs/sdk/sdk-impl/library-flow.js +3 -3
  52. package/bin/libs/sdk/sdk-impl/spell/spell-executors.js +1 -1
  53. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.d.ts +1 -1
  54. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.js +7 -1
  55. package/bin/libs/sdk/sdk-impl/utils/utils-build.d.ts +8 -2
  56. package/bin/libs/sdk/sdk-impl/utils/utils-build.js +5 -5
  57. package/bin/libs/sdk/sdk-impl/utils/utils-deps.js +36 -10
  58. package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +20 -8
  59. package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.d.ts +2 -1
  60. package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.js +15 -4
  61. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.d.ts +5 -0
  62. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +98 -29
  63. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +12 -5
  64. package/bin/libs/sdk/sdk-types.d.ts +67 -33
  65. package/bin/mod.d.ts +1 -2
  66. package/bin/mod.js +1 -4
  67. package/package.json +1 -1
  68. package/bin/app/migrate/codemods/lib-pathe-pathkit.d.ts +0 -9
  69. /package/bin/app/migrate/codemods/{ts-module-resolution.d.ts → module-resolution.d.ts} +0 -0
  70. /package/bin/app/migrate/codemods/{ts-module-resolution.js → module-resolution.js} +0 -0
  71. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/analyzer.d.ts +0 -0
  72. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/analyzer.js +0 -0
  73. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/deps-types.d.ts +0 -0
  74. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/deps-types.js +0 -0
  75. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/filesystem.d.ts +0 -0
  76. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/filesystem.js +0 -0
  77. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/formatter.d.ts +0 -0
  78. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/formatter.js +0 -0
  79. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/parser.d.ts +0 -0
  80. /package/bin/{app/deps/impl → libs/sdk/sdk-impl/check/rules/deps}/parser.js +0 -0
  81. /package/bin/{init → libs/sdk/sdk-impl/config}/info.d.ts +0 -0
  82. /package/bin/{init → libs/sdk/sdk-impl/config}/init.d.ts +0 -0
@@ -1,9 +1,9 @@
1
+ import { relinka } from "@reliverse/relinka";
1
2
  import { defineArgs, defineCommand } from "@reliverse/rempts";
2
- import {
3
- migratePatheToPathkit,
4
- migratePathkitToPathe
5
- } from "./codemods/lib-pathe-pathkit.js";
6
- import { migrateModuleResolution } from "./codemods/ts-module-resolution.js";
3
+ import { migrateAnythingToBun } from "./codemods/anything-to-bun.js";
4
+ import { migrateFsToRelifso } from "./codemods/fs-to-relifso.js";
5
+ import { migrateModuleResolution } from "./codemods/module-resolution.js";
6
+ import { migratePathToPathkit } from "./codemods/path-to-pathkit.js";
7
7
  export default defineCommand({
8
8
  meta: {
9
9
  name: "migrate",
@@ -11,11 +11,16 @@ export default defineCommand({
11
11
  description: "Migrate between different libraries and usages"
12
12
  },
13
13
  args: defineArgs({
14
- lib: {
14
+ codemod: {
15
15
  type: "string",
16
- description: "The migration to perform (pathe-to-pathkit | pathkit-to-pathe | module-resolution)"
16
+ description: "The migration to perform (anything-to-bun | path-to-pathkit | fs-to-relifso | module-resolution)"
17
17
  },
18
- target: {
18
+ project: {
19
+ type: "string",
20
+ description: "Project directory to migrate (default: current directory)",
21
+ default: "."
22
+ },
23
+ mrTarget: {
19
24
  type: "string",
20
25
  description: "Target for module resolution migration (nodenext | bundler)",
21
26
  default: "nodenext"
@@ -23,94 +28,136 @@ export default defineCommand({
23
28
  dryRun: {
24
29
  type: "boolean",
25
30
  description: "Preview changes without applying them"
31
+ },
32
+ noBackup: {
33
+ type: "boolean",
34
+ description: "Skip creating backup files",
35
+ default: false
26
36
  }
27
37
  }),
28
38
  async run({ args }) {
39
+ if (args.codemod === "anything-to-bun") {
40
+ relinka("log", "Migrating to Bun...");
41
+ await migrateAnythingToBun({
42
+ project: args.project,
43
+ dryRun: args.dryRun,
44
+ noBackup: args.noBackup
45
+ });
46
+ if (!args.dryRun) {
47
+ relinka("log", "\nMigration completed!");
48
+ relinka("log", "Next steps:");
49
+ relinka("log", "1. Run 'bun install' to install dependencies with Bun");
50
+ relinka("log", "2. Test your application thoroughly");
51
+ relinka(
52
+ "log",
53
+ "3. Review async/await usage in converted file operations"
54
+ );
55
+ relinka(
56
+ "log",
57
+ "4. Update any custom database queries to use Bun.sql syntax"
58
+ );
59
+ relinka(
60
+ "log",
61
+ "5. Review and update any custom middleware in Express apps"
62
+ );
63
+ }
64
+ return;
65
+ }
29
66
  let results = [];
30
- if (args.lib === "pathe-to-pathkit") {
31
- console.log("Migrating from pathe to pathkit...");
32
- results = await migratePatheToPathkit(args.dryRun);
33
- } else if (args.lib === "pathkit-to-pathe") {
34
- console.log("Migrating from pathkit to pathe...");
35
- results = await migratePathkitToPathe(args.dryRun);
36
- } else if (args.lib === "module-resolution") {
37
- if (!["nodenext", "bundler"].includes(args.target)) {
38
- console.error(`Invalid target: ${args.target}`);
39
- console.log("Available targets:");
40
- console.log(" - nodenext");
41
- console.log(" - bundler");
67
+ if (args.codemod === "path-to-pathkit") {
68
+ relinka(
69
+ "log",
70
+ "Migrating from node:path and/or pathe to @reliverse/pathkit..."
71
+ );
72
+ results = await migratePathToPathkit(args.dryRun);
73
+ } else if (args.codemod === "fs-to-relifso") {
74
+ relinka(
75
+ "log",
76
+ "Migrating from node:fs and/or fs-extra to @reliverse/relifso..."
77
+ );
78
+ results = await migrateFsToRelifso(args.dryRun);
79
+ } else if (args.codemod === "module-resolution") {
80
+ if (!["nodenext", "bundler"].includes(args.mrTarget)) {
81
+ relinka("error", `Invalid mrTarget: ${args.mrTarget}`);
82
+ relinka("log", "Available targets:");
83
+ relinka("log", " - nodenext");
84
+ relinka("log", " - bundler");
42
85
  return;
43
86
  }
44
- console.log(`Migrating to ${args.target} module resolution...`);
87
+ relinka("log", `Migrating to ${args.mrTarget} module resolution...`);
45
88
  results = await migrateModuleResolution(
46
- args.target,
89
+ args.mrTarget,
47
90
  args.dryRun
48
91
  );
49
92
  } else {
50
- console.error(`Unknown migration: ${args.lib}`);
51
- console.log("Available migrations:");
52
- console.log(" - pathe-to-pathkit");
53
- console.log(" - pathkit-to-pathe");
54
- console.log(" - module-resolution");
93
+ relinka("error", `Unknown migration: ${args.codemod}`);
94
+ relinka("log", "Available migrations:");
95
+ relinka("log", " - anything-to-bun");
96
+ relinka("log", " - path-to-pathkit");
97
+ relinka("log", " - fs-to-relifso");
98
+ relinka("log", " - module-resolution");
55
99
  return;
56
100
  }
57
- console.log("\nMigration Results:");
101
+ relinka("info", "\nMigration Results:");
58
102
  let successCount = 0;
59
103
  let errorCount = 0;
60
104
  let warningCount = 0;
61
105
  for (const result of results) {
62
106
  const status = result.success ? "\u2713" : "\u2717";
63
- console.log(`${status} ${result.file}: ${result.message}`);
107
+ relinka("log", `${status} ${result.file}: ${result.message}`);
64
108
  if (result.changes && result.changes.length > 0) {
65
109
  for (const change of result.changes) {
66
110
  if (change.startsWith("\u26A0\uFE0F")) {
67
- console.log(` ${change}`);
111
+ relinka("log", ` ${change}`);
68
112
  warningCount++;
69
113
  } else {
70
- console.log(` - ${change}`);
114
+ relinka("log", ` - ${change}`);
71
115
  }
72
116
  }
73
117
  }
74
118
  if (result.success) successCount++;
75
119
  else errorCount++;
76
120
  }
77
- console.log(
121
+ relinka(
122
+ "log",
78
123
  `
79
124
  Summary: ${successCount} files updated, ${errorCount} errors, ${warningCount} warnings`
80
125
  );
81
126
  if (args.dryRun) {
82
- console.log("\nThis was a dry run. No changes were made.");
83
- console.log("Run without --dryRun to apply the changes.");
127
+ relinka("info", "\nThis was a dry run. No changes were made.");
128
+ relinka("log", "Run without --dryRun to apply the changes.");
84
129
  } else {
85
- console.log("\nMigration completed!");
86
- if (args.lib === "pathe-to-pathkit") {
87
- console.log("Next steps:");
88
- console.log("1. Run 'bun install' to install @reliverse/pathkit");
89
- console.log("2. Test your application");
90
- console.log(
91
- "3. Consider using advanced pathkit features like alias resolution"
130
+ relinka("success", "\nMigration completed!");
131
+ if (args.codemod === "path-to-pathkit") {
132
+ relinka("log", "Next steps:");
133
+ relinka("log", "1. Run 'bun install' to install @reliverse/pathkit");
134
+ relinka("log", "2. Test your application");
135
+ relinka(
136
+ "log",
137
+ "3. Tip: Consider using advanced pathkit features like alias resolution"
92
138
  );
93
- } else if (args.lib === "pathkit-to-pathe") {
94
- console.log("Next steps:");
95
- console.log("1. Run 'bun install' to install pathe");
96
- console.log("2. Test your application");
97
- if (warningCount > 0) {
98
- console.log(
99
- "3. \u26A0\uFE0F Review files with warnings - they may need manual updates"
100
- );
101
- }
102
- } else if (args.lib === "module-resolution") {
103
- console.log("Next steps:");
104
- console.log("1. Test your application");
105
- if (args.target === "nodenext") {
106
- console.log(
139
+ } else if (args.codemod === "fs-to-relifso") {
140
+ relinka("log", "Next steps:");
141
+ relinka("log", "1. Run 'bun install' to install @reliverse/relifso");
142
+ relinka("log", "2. Test your application");
143
+ relinka(
144
+ "log",
145
+ "3. Review any file system operations that might need manual updates"
146
+ );
147
+ } else if (args.codemod === "module-resolution") {
148
+ relinka("log", "Next steps:");
149
+ relinka("log", "1. Test your application");
150
+ if (args.mrTarget === "nodenext") {
151
+ relinka(
152
+ "log",
107
153
  "2. Ensure your build tools support .js extensions in imports"
108
154
  );
109
- } else if (args.target === "bundler") {
110
- console.log("2. Ensure your bundler is configured correctly");
155
+ } else if (args.mrTarget === "bundler") {
156
+ relinka("log", "2. Ensure your bundler is configured correctly");
111
157
  }
112
158
  if (warningCount > 0) {
113
- console.log(
159
+ relinka(
160
+ "warn",
114
161
  "3. \u26A0\uFE0F Review files with warnings - they may need manual updates"
115
162
  );
116
163
  }
@@ -0,0 +1,5 @@
1
+ export declare function migrateAnythingToBun({ project, dryRun, noBackup, }: {
2
+ project?: string;
3
+ dryRun?: boolean;
4
+ noBackup?: boolean;
5
+ }): Promise<void>;