@reliverse/dler 1.7.1 → 1.7.3

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 (120) hide show
  1. package/README.md +134 -87
  2. package/bin/app/agg/run.js +2 -2
  3. package/bin/app/build/cmd.js +1 -1
  4. package/bin/app/build/impl.js +1 -1
  5. package/bin/app/check/cmd.d.ts +37 -0
  6. package/bin/app/check/cmd.js +103 -13
  7. package/bin/app/cmds.d.ts +15 -20
  8. package/bin/app/cmds.js +16 -76
  9. package/bin/app/{deps → copy}/cmd.d.ts +9 -23
  10. package/bin/app/copy/cmd.js +173 -0
  11. package/bin/app/inject/cmd.d.ts +13 -0
  12. package/bin/app/inject/cmd.js +33 -21
  13. package/bin/app/merge/cmd.d.ts +63 -5
  14. package/bin/app/merge/cmd.js +220 -25
  15. package/bin/app/migrate/cmd.d.ts +17 -0
  16. package/bin/app/migrate/cmd.js +68 -17
  17. package/bin/app/migrate/codemods/{anything-to-bun.js → anything-bun.js} +9 -6
  18. package/bin/app/{rempts/migrate/impl/commander.js → migrate/codemods/commander-rempts.js} +2 -8
  19. package/bin/app/migrate/codemods/console-relinka.d.ts +3 -0
  20. package/bin/app/migrate/codemods/console-relinka.js +157 -0
  21. package/bin/app/migrate/codemods/readdir-glob.d.ts +8 -0
  22. package/bin/app/migrate/codemods/readdir-glob.js +144 -0
  23. package/bin/app/pub/cmd.js +1 -1
  24. package/bin/app/rempts/{cmdsTs/cmd.d.ts → cmd.d.ts} +13 -4
  25. package/bin/app/rempts/cmd.js +304 -0
  26. package/bin/cli.js +33 -12
  27. package/bin/libs/sdk/sdk-impl/{config → cfg}/info.js +1 -1
  28. package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/dler-config-health}/dler-config-health.d.ts +1 -1
  29. package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/dler-config-health}/dler-config-health.js +1 -1
  30. package/bin/libs/sdk/sdk-impl/rules/reliverse/file-extensions/file-extensions.d.ts +2 -0
  31. package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/file-extensions}/file-extensions.js +2 -2
  32. package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/analyzer.js +15 -1
  33. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-mod.d.ts +2 -0
  34. package/bin/libs/sdk/sdk-impl/{check/rules/missing-deps.js → rules/reliverse/missing-deps/deps-mod.js} +2 -2
  35. package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/deps-types.d.ts +2 -0
  36. package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/filesystem.js +2 -3
  37. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/formatter.js +113 -0
  38. package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.d.ts +2 -0
  39. package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js +31 -0
  40. package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/package-json-health}/package-json-health.d.ts +1 -1
  41. package/bin/libs/sdk/sdk-impl/rules/reliverse/path-extensions/path-extensions.d.ts +2 -0
  42. package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/path-extensions}/path-extensions.js +2 -2
  43. package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.d.ts +2 -0
  44. package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/self-include}/self-include.js +2 -2
  45. package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/tsconfig-health}/tsconfig-health.d.ts +1 -1
  46. package/bin/libs/sdk/sdk-impl/{check/check-mod.js → rules/rules-mod.js} +10 -0
  47. package/bin/libs/sdk/sdk-impl/{check/check-utils.d.ts → rules/rules-utils.d.ts} +1 -1
  48. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +6 -4
  49. package/bin/libs/sdk/sdk-types.d.ts +2 -2
  50. package/bin/mod.d.ts +1 -1
  51. package/bin/mod.js +1 -1
  52. package/package.json +2 -4
  53. package/bin/app/deps/cmd.js +0 -84
  54. package/bin/app/inject/README.md +0 -139
  55. package/bin/app/inject/expect/cmd.d.ts +0 -20
  56. package/bin/app/inject/expect/cmd.js +0 -43
  57. package/bin/app/relifso/cmd.d.ts +0 -11
  58. package/bin/app/relifso/cmd.js +0 -47
  59. package/bin/app/relinka/cmd.d.ts +0 -18
  60. package/bin/app/relinka/cmd.js +0 -149
  61. package/bin/app/rempts/README.md +0 -121
  62. package/bin/app/rempts/cmd/cmd.d.ts +0 -16
  63. package/bin/app/rempts/cmd/cmd.js +0 -157
  64. package/bin/app/rempts/cmd/templates.d.ts +0 -2
  65. package/bin/app/rempts/cmd/templates.js +0 -30
  66. package/bin/app/rempts/cmdsTs/cmd.js +0 -96
  67. package/bin/app/rempts/migrate/cmd.d.ts +0 -14
  68. package/bin/app/rempts/migrate/cmd.js +0 -38
  69. package/bin/libs/sdk/sdk-impl/check/rules/deps/formatter.js +0 -64
  70. package/bin/libs/sdk/sdk-impl/check/rules/file-extensions.d.ts +0 -2
  71. package/bin/libs/sdk/sdk-impl/check/rules/missing-deps.d.ts +0 -2
  72. package/bin/libs/sdk/sdk-impl/check/rules/path-extensions.d.ts +0 -2
  73. package/bin/libs/sdk/sdk-impl/check/rules/self-include.d.ts +0 -2
  74. /package/bin/app/{relifso/init → init}/cmd.d.ts +0 -0
  75. /package/bin/app/{relifso/init → init}/cmd.js +0 -0
  76. /package/bin/app/{relifso/init → init}/init-const.d.ts +0 -0
  77. /package/bin/app/{relifso/init → init}/init-const.js +0 -0
  78. /package/bin/app/{relifso/init → init}/init-impl.d.ts +0 -0
  79. /package/bin/app/{relifso/init → init}/init-impl.js +0 -0
  80. /package/bin/app/{relifso/init → init}/init-types.d.ts +0 -0
  81. /package/bin/app/{relifso/init → init}/init-types.js +0 -0
  82. /package/bin/app/{relifso/init → init}/templates/t-gitignore.d.ts +0 -0
  83. /package/bin/app/{relifso/init → init}/templates/t-gitignore.js +0 -0
  84. /package/bin/app/{relifso/init → init}/templates/t-license.d.ts +0 -0
  85. /package/bin/app/{relifso/init → init}/templates/t-license.js +0 -0
  86. /package/bin/app/{relifso/init → init}/templates/t-readme.d.ts +0 -0
  87. /package/bin/app/{relifso/init → init}/templates/t-readme.js +0 -0
  88. /package/bin/app/inject/{expect/impl.d.ts → impl.d.ts} +0 -0
  89. /package/bin/app/inject/{expect/impl.js → impl.js} +0 -0
  90. /package/bin/app/migrate/codemods/{anything-to-bun.d.ts → anything-bun.d.ts} +0 -0
  91. /package/bin/app/{rempts/migrate/impl/commander.d.ts → migrate/codemods/commander-rempts.d.ts} +0 -0
  92. /package/bin/app/migrate/codemods/{fs-to-relifso.d.ts → fs-relifso.d.ts} +0 -0
  93. /package/bin/app/migrate/codemods/{fs-to-relifso.js → fs-relifso.js} +0 -0
  94. /package/bin/app/migrate/codemods/{module-resolution.d.ts → nodenext-bundler.d.ts} +0 -0
  95. /package/bin/app/migrate/codemods/{module-resolution.js → nodenext-bundler.js} +0 -0
  96. /package/bin/app/migrate/codemods/{path-to-pathkit.d.ts → path-pathkit.d.ts} +0 -0
  97. /package/bin/app/migrate/codemods/{path-to-pathkit.js → path-pathkit.js} +0 -0
  98. /package/bin/app/{relifso/rename → rename}/cmd.d.ts +0 -0
  99. /package/bin/app/{relifso/rename → rename}/cmd.js +0 -0
  100. /package/bin/libs/sdk/sdk-impl/{config → cfg}/default.d.ts +0 -0
  101. /package/bin/libs/sdk/sdk-impl/{config → cfg}/default.js +0 -0
  102. /package/bin/libs/sdk/sdk-impl/{config → cfg}/define.d.ts +0 -0
  103. /package/bin/libs/sdk/sdk-impl/{config → cfg}/define.js +0 -0
  104. /package/bin/libs/sdk/sdk-impl/{config → cfg}/info.d.ts +0 -0
  105. /package/bin/libs/sdk/sdk-impl/{config → cfg}/init.d.ts +0 -0
  106. /package/bin/libs/sdk/sdk-impl/{config → cfg}/init.js +0 -0
  107. /package/bin/libs/sdk/sdk-impl/{config → cfg}/load.d.ts +0 -0
  108. /package/bin/libs/sdk/sdk-impl/{config → cfg}/load.js +0 -0
  109. /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/analyzer.d.ts +0 -0
  110. /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/deps-types.js +0 -0
  111. /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/filesystem.d.ts +0 -0
  112. /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/formatter.d.ts +0 -0
  113. /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/parser.d.ts +0 -0
  114. /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/parser.js +0 -0
  115. /package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/package-json-health}/package-json-health.js +0 -0
  116. /package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/tsconfig-health}/tsconfig-health.js +0 -0
  117. /package/bin/libs/sdk/sdk-impl/{check/check-consts.d.ts → rules/rules-consts.d.ts} +0 -0
  118. /package/bin/libs/sdk/sdk-impl/{check/check-consts.js → rules/rules-consts.js} +0 -0
  119. /package/bin/libs/sdk/sdk-impl/{check/check-mod.d.ts → rules/rules-mod.d.ts} +0 -0
  120. /package/bin/libs/sdk/sdk-impl/{check/check-utils.js → rules/rules-utils.js} +0 -0
package/bin/cli.js CHANGED
@@ -8,11 +8,8 @@ import {
8
8
  runCmd as remptsRunCmd
9
9
  } from "@reliverse/rempts";
10
10
  import { promptAggCommand } from "./app/agg/run.js";
11
- import { getCmdBuild, getCmdPub } from "./app/cmds.js";
12
- import {
13
- showEndPrompt,
14
- showStartPrompt
15
- } from "./libs/sdk/sdk-impl/config/info.js";
11
+ import { getBuildCmd, getPubCmd, getInitCmd, getRenameCmd } from "./app/cmds.js";
12
+ import { showEndPrompt, showStartPrompt } from "./libs/sdk/sdk-impl/cfg/info.js";
16
13
  const INTERACTIVE_CMDS = ["agg", "build", "pub"];
17
14
  async function runCmd(cmdPromise, args) {
18
15
  const cmd = await cmdPromise;
@@ -32,9 +29,16 @@ Available interactive commands: ${INTERACTIVE_CMDS.join(", ")}`
32
29
  dev: {
33
30
  type: "boolean",
34
31
  description: "Runs the CLI in dev mode"
32
+ },
33
+ cwd: {
34
+ type: "string",
35
+ description: "The working directory to run the CLI in",
36
+ default: process.cwd()
35
37
  }
36
38
  }),
37
39
  async run({ args }) {
40
+ const isDev = args.dev;
41
+ relinka("verbose", `Running in ${isDev ? "dev" : "prod"} mode`);
38
42
  const isCI = process.env.CI === "true";
39
43
  const isNonInteractive = !process.stdout.isTTY;
40
44
  if (isCI || isNonInteractive) {
@@ -51,17 +55,34 @@ Available interactive commands: ${INTERACTIVE_CMDS.join(", ")}`
51
55
  options: [
52
56
  { value: "agg", label: "agg" },
53
57
  { value: "build", label: "build" },
54
- { value: "pub", label: "pub" }
58
+ { value: "pub", label: "pub" },
59
+ { value: "copy", label: "copy" },
60
+ {
61
+ value: "init",
62
+ label: "Initialize files"
63
+ },
64
+ {
65
+ value: "rename-prepare",
66
+ label: "My project is a bootstrapper CLI (apply rename optimizations)"
67
+ },
68
+ {
69
+ value: "rename-prepare-revert",
70
+ label: "Revert rename CLI files optimizations"
71
+ }
55
72
  ]
56
73
  });
57
74
  if (cmdToRun === "agg") {
58
75
  await promptAggCommand();
59
- }
60
- if (cmdToRun === "build") {
61
- await runCmd(getCmdBuild(), [`--dev=${args.dev}`]);
62
- }
63
- if (cmdToRun === "pub") {
64
- await runCmd(getCmdPub(), [`--dev=${args.dev}`]);
76
+ } else if (cmdToRun === "build") {
77
+ await runCmd(getBuildCmd(), [`--dev=${args.dev}`]);
78
+ } else if (cmdToRun === "pub") {
79
+ await runCmd(getPubCmd(), [`--dev=${args.dev}`]);
80
+ } else if (cmdToRun === "init") {
81
+ await runCmd(getInitCmd(), []);
82
+ } else if (cmdToRun === "rename-prepare") {
83
+ await runCmd(getRenameCmd(), ["--prepareMyCLI"]);
84
+ } else if (cmdToRun === "rename-prepare-revert") {
85
+ await runCmd(getRenameCmd(), ["--prepareMyCLI", "--revert"]);
65
86
  }
66
87
  relinka("log", " ");
67
88
  await showEndPrompt();
@@ -1,5 +1,5 @@
1
1
  import { endPrompt, startPrompt } from "@reliverse/rempts";
2
- const version = "1.7.1";
2
+ const version = "1.7.3";
3
3
  export async function showStartPrompt(isDev) {
4
4
  await startPrompt({
5
5
  titleColor: "inverse",
@@ -1,2 +1,2 @@
1
- import type { CheckResult } from "../../../sdk-types.js";
1
+ import type { CheckResult } from "../../../../sdk-types.js";
2
2
  export declare function checkDlerConfigHealth(): Promise<CheckResult>;
@@ -1,4 +1,4 @@
1
- import { loadConfig } from "../../config/load.js";
1
+ import { loadConfig } from "../../../cfg/load.js";
2
2
  export async function checkDlerConfigHealth() {
3
3
  const startTime = Date.now();
4
4
  const issues = [];
@@ -0,0 +1,2 @@
1
+ import type { CheckResult, RulesCheckOptions } from "../../../../sdk-types.js";
2
+ export declare function checkFileExtensions(options: RulesCheckOptions): Promise<CheckResult>;
@@ -2,8 +2,8 @@ import { extname } from "@reliverse/pathkit";
2
2
  import {
3
3
  ALLOWED_FILE_EXTENSIONS,
4
4
  STRICT_FILE_EXTENSIONS
5
- } from "../check-consts.js";
6
- import { getAllFiles } from "../check-utils.js";
5
+ } from "../../rules-consts.js";
6
+ import { getAllFiles } from "../../rules-utils.js";
7
7
  function getAllowedFileExtensions(directory, strict, moduleResolution) {
8
8
  if (!strict) {
9
9
  return ALLOWED_FILE_EXTENSIONS[directory];
@@ -13,11 +13,23 @@ export const analyzeDependencies = async (options) => {
13
13
  );
14
14
  const builtinModules = getBuiltinModules();
15
15
  const allDependencies = /* @__PURE__ */ new Set();
16
+ const devOnlyDependencies = /* @__PURE__ */ new Set();
17
+ const duplicateDependencies = /* @__PURE__ */ new Set();
18
+ if (packageJson.dependencies && packageJson.devDependencies) {
19
+ for (const dep of Object.keys(packageJson.dependencies)) {
20
+ if (packageJson.devDependencies[dep]) {
21
+ duplicateDependencies.add(dep);
22
+ }
23
+ }
24
+ }
16
25
  for (const filePath of sourceFiles) {
17
26
  const fileContent = await readFile(filePath);
18
27
  const packageNames = extractPackageNames(fileContent);
19
28
  for (const packageName of packageNames) {
20
29
  allDependencies.add(packageName);
30
+ if (packageJson.devDependencies?.[packageName] && !packageJson.dependencies?.[packageName] && !packageJson.peerDependencies?.[packageName] && !packageJson.optionalDependencies?.[packageName] && !builtinModules.has(packageName)) {
31
+ devOnlyDependencies.add(packageName);
32
+ }
21
33
  }
22
34
  }
23
35
  const missingDependencies = /* @__PURE__ */ new Set();
@@ -37,6 +49,8 @@ export const analyzeDependencies = async (options) => {
37
49
  missingDependencies: Array.from(missingDependencies).sort(),
38
50
  allDependencies: Array.from(allDependencies).sort(),
39
51
  listedDependencies: Array.from(listedDependencies).sort(),
40
- builtinModules: builtinModulesList.sort()
52
+ builtinModules: builtinModulesList.sort(),
53
+ devOnlyDependencies: Array.from(devOnlyDependencies).sort(),
54
+ duplicateDependencies: Array.from(duplicateDependencies).sort()
41
55
  };
42
56
  };
@@ -0,0 +1,2 @@
1
+ import type { CheckResult, RulesCheckOptions } from "../../../../sdk-types.js";
2
+ export declare function checkMissingDependencies(options: RulesCheckOptions): Promise<CheckResult>;
@@ -1,5 +1,5 @@
1
- import { analyzeDependencies } from "./deps/analyzer.js";
2
- import { IGNORE_PATTERNS } from "../../constants.js";
1
+ import { IGNORE_PATTERNS } from "../../../constants.js";
2
+ import { analyzeDependencies } from "./analyzer.js";
3
3
  export async function checkMissingDependencies(options) {
4
4
  const startTime = Date.now();
5
5
  const issues = [];
@@ -23,4 +23,6 @@ export type DependencyResult = {
23
23
  allDependencies: string[];
24
24
  listedDependencies: string[];
25
25
  builtinModules: string[];
26
+ devOnlyDependencies: string[];
27
+ duplicateDependencies: string[];
26
28
  };
@@ -1,6 +1,6 @@
1
1
  import fs from "@reliverse/relifso";
2
- import { glob } from "glob";
3
2
  import path from "node:path";
3
+ import { glob } from "tinyglobby";
4
4
  export const findSourceFiles = async (directory, ignorePatterns) => {
5
5
  const pattern = `${directory}/**/*.{js,jsx,ts,tsx}`;
6
6
  const defaultIgnores = [
@@ -16,8 +16,7 @@ export const findSourceFiles = async (directory, ignorePatterns) => {
16
16
  const allIgnores = [...defaultIgnores, ...ignorePatterns];
17
17
  return await glob(pattern, {
18
18
  ignore: allIgnores,
19
- absolute: true,
20
- nodir: true
19
+ absolute: true
21
20
  });
22
21
  };
23
22
  export const readFile = async (filePath) => {
@@ -0,0 +1,113 @@
1
+ import { re } from "@reliverse/relico";
2
+ export const formatOutput = (result, options) => {
3
+ if (options.json) {
4
+ return JSON.stringify(result, null, 2);
5
+ }
6
+ let output = "";
7
+ output += re.bluePastel("\nMissing Dependencies Finder Results\n");
8
+ output += re.gray("---------------------------------------\n\n");
9
+ output += re.bold("Statistics:\n");
10
+ output += `${re.gray("\u2022 ")}Total dependencies found: ${result.allDependencies.length}
11
+ `;
12
+ output += `${re.gray("\u2022 ")}Listed in package.json: ${result.listedDependencies.length}
13
+ `;
14
+ output += `${re.gray("\u2022 ")}Missing from package.json: ${result.missingDependencies.length}
15
+ `;
16
+ if (options.builtins) {
17
+ output += `${re.gray("\u2022 ")}Node.js built-in modules: ${result.builtinModules.length}
18
+ `;
19
+ }
20
+ output += `${re.gray("\u2022 ")}Dev-only dependencies used in production: ${result.devOnlyDependencies.length}
21
+ `;
22
+ output += `${re.gray("\u2022 ")}Duplicate dependencies: ${result.duplicateDependencies.length}
23
+ `;
24
+ output += "\n";
25
+ if (result.duplicateDependencies.length > 0) {
26
+ output += re.yellowPastel("\u26A0\uFE0F Duplicate Dependencies Found:\n");
27
+ output += re.yellow(
28
+ "These packages are listed in both dependencies and devDependencies.\n"
29
+ );
30
+ output += re.yellow(
31
+ "This can cause confusion and potential issues. Consider keeping them in only one section.\n\n"
32
+ );
33
+ for (const dep of result.duplicateDependencies) {
34
+ output += `${re.gray("\u2022 ")}${re.yellow(dep)}
35
+ `;
36
+ }
37
+ output += "\n";
38
+ }
39
+ if (result.devOnlyDependencies.length > 0) {
40
+ output += re.yellowPastel(
41
+ "\u26A0\uFE0F Dev-only Dependencies Used in Production Code:\n"
42
+ );
43
+ output += re.yellow(
44
+ "These packages are only in devDependencies but are imported in your code.\n"
45
+ );
46
+ output += re.yellow(
47
+ "They will cause errors in production after bundling!\n\n"
48
+ );
49
+ for (const dep of result.devOnlyDependencies) {
50
+ output += `${re.gray("\u2022 ")}${re.yellow(dep)}
51
+ `;
52
+ }
53
+ output += "\n";
54
+ output += re.gray("To fix, move these to dependencies:\n");
55
+ output += re.cyan(
56
+ `npm install ${result.devOnlyDependencies.join(" ")} --save
57
+ `
58
+ );
59
+ }
60
+ if (result.missingDependencies.length > 0) {
61
+ output += re.redPastel("Missing Dependencies:\n");
62
+ for (const dep of result.missingDependencies) {
63
+ output += `${re.gray("\u2022 ")}${re.yellow(dep)}
64
+ `;
65
+ }
66
+ output += "\n";
67
+ output += re.gray("To install, run:\n");
68
+ output += re.cyan(
69
+ `npm install ${result.missingDependencies.join(" ")}
70
+ `
71
+ );
72
+ } else {
73
+ output += re.greenPastel("No missing dependencies found! \u{1F389}\n\n");
74
+ }
75
+ if (options.builtins && result.builtinModules.length > 0) {
76
+ output += re.bluePastel("Node.js Built-in Modules Used:\n");
77
+ for (const dep of result.builtinModules) {
78
+ output += `${re.gray("\u2022 ")}${re.blue(dep)}
79
+ `;
80
+ }
81
+ output += "\n";
82
+ }
83
+ if (options.showAll) {
84
+ output += re.bold("All Dependencies:\n");
85
+ output += re.gray(
86
+ "(\u2713 = listed in package.json, \u2717 = missing, \u26A0\uFE0F = dev-only, \u{1F504} = duplicate)\n"
87
+ );
88
+ for (const dep of result.allDependencies) {
89
+ const isListed = result.listedDependencies.includes(dep);
90
+ const isBuiltin = result.builtinModules.includes(dep);
91
+ const isDevOnly = result.devOnlyDependencies.includes(dep);
92
+ const isDuplicate = result.duplicateDependencies.includes(dep);
93
+ if (isDuplicate) {
94
+ output += `${re.gray("\u2022 ")}${re.yellow("\u{1F504} ")}${re.yellow(dep)}${re.gray(" (duplicate)")}
95
+ `;
96
+ } else if (isListed && !isDevOnly) {
97
+ output += `${re.gray("\u2022 ") + re.green("\u2713 ") + dep}
98
+ `;
99
+ } else if (isBuiltin) {
100
+ output += `${re.gray("\u2022 ")}${re.blue("\u26A1 ")}${dep}${re.gray(" (built-in)")}
101
+ `;
102
+ } else if (isDevOnly) {
103
+ output += `${re.gray("\u2022 ")}${re.yellow("\u26A0\uFE0F ")}${re.yellow(dep)}${re.gray(" (dev-only)")}
104
+ `;
105
+ } else {
106
+ output += `${re.gray("\u2022 ")}${re.red("\u2717 ")}${re.yellow(dep)}
107
+ `;
108
+ }
109
+ }
110
+ output += "\n";
111
+ }
112
+ return output;
113
+ };
@@ -0,0 +1,2 @@
1
+ import type { CheckResult, RulesCheckOptions } from "../../../../sdk-types.js";
2
+ export declare function checkNoIndexFiles(options: RulesCheckOptions): Promise<CheckResult>;
@@ -0,0 +1,31 @@
1
+ import path from "node:path";
2
+ import { glob } from "tinyglobby";
3
+ export async function checkNoIndexFiles(options) {
4
+ const { directory } = options;
5
+ const startTime = Date.now();
6
+ const indexFiles = await glob("**/index.{ts,js}", {
7
+ cwd: directory,
8
+ ignore: ["node_modules/**", "dist/**", ".git/**"]
9
+ });
10
+ const issues = [];
11
+ const stats = {
12
+ filesChecked: indexFiles.length,
13
+ importsChecked: 0,
14
+ timeElapsed: Date.now() - startTime
15
+ };
16
+ for (const file of indexFiles) {
17
+ const fullPath = path.join(directory, file);
18
+ const dirName = path.basename(path.dirname(file));
19
+ issues.push({
20
+ type: "no-index-files",
21
+ file: fullPath,
22
+ line: 1,
23
+ message: `Avoid using index.{ts,js} file names. Use descriptive names like mod.{ts,js} or ${dirName}-mod.{ts,js} instead. This reduces confusion, especially since TypeScript can resolve index files implicitly depending on the module resolution strategy.`
24
+ });
25
+ }
26
+ return {
27
+ success: issues.length === 0,
28
+ issues,
29
+ stats
30
+ };
31
+ }
@@ -1,2 +1,2 @@
1
- import type { CheckResult } from "../../../sdk-types.js";
1
+ import type { CheckResult } from "../../../../sdk-types.js";
2
2
  export declare function checkPackageJsonHealth(): Promise<CheckResult>;
@@ -0,0 +1,2 @@
1
+ import type { CheckResult, RulesCheckOptions } from "../../../../sdk-types.js";
2
+ export declare function checkPathExtensions(options: RulesCheckOptions): Promise<CheckResult>;
@@ -4,11 +4,11 @@ import { relinka } from "@reliverse/relinka";
4
4
  import {
5
5
  ALLOWED_IMPORT_EXTENSIONS,
6
6
  STRICT_IMPORT_EXTENSIONS
7
- } from "../check-consts.js";
7
+ } from "../../rules-consts.js";
8
8
  import {
9
9
  getAllFiles,
10
10
  getLineNumber
11
- } from "../check-utils.js";
11
+ } from "../../rules-utils.js";
12
12
  function getAllowedImportExtensions(directory, strict) {
13
13
  if (strict) {
14
14
  return STRICT_IMPORT_EXTENSIONS[directory];
@@ -0,0 +1,2 @@
1
+ import type { CheckResult, RulesCheckOptions } from "../../../../sdk-types.js";
2
+ export declare function checkSelfInclude(options: RulesCheckOptions): Promise<CheckResult>;
@@ -1,11 +1,11 @@
1
1
  import { getFileImportsExports, extname } from "@reliverse/pathkit";
2
2
  import fs from "@reliverse/relifso";
3
3
  import { relinka } from "@reliverse/relinka";
4
+ import { loadConfig } from "../../../cfg/load.js";
4
5
  import {
5
6
  getAllFiles,
6
7
  getLineNumber
7
- } from "../check-utils.js";
8
- import { loadConfig } from "../../config/load.js";
8
+ } from "../../rules-utils.js";
9
9
  export async function checkSelfInclude(options) {
10
10
  const startTime = Date.now();
11
11
  const issues = [];
@@ -1,2 +1,2 @@
1
- import type { CheckResult } from "../../../sdk-types.js";
1
+ import type { CheckResult } from "../../../../sdk-types.js";
2
2
  export declare function checkTsConfigHealth(): Promise<CheckResult>;
@@ -22,6 +22,7 @@ export function displayCheckResults(checkType, directory, result) {
22
22
  (i) => i.type === "dler-config-health"
23
23
  );
24
24
  const selfIncludeIssues = issues.filter((i) => i.type === "self-include");
25
+ const noIndexIssues = issues.filter((i) => i.type === "no-index-files");
25
26
  if (fileIssues.length > 0) {
26
27
  relinka("error", ` file extension issues (${fileIssues.length}):`);
27
28
  for (const issue of fileIssues.slice(0, 10)) {
@@ -79,6 +80,15 @@ export function displayCheckResults(checkType, directory, result) {
79
80
  relinka("error", ` ... and ${selfIncludeIssues.length - 10} more`);
80
81
  }
81
82
  }
83
+ if (noIndexIssues.length > 0) {
84
+ relinka("error", ` index file issues (${noIndexIssues.length}):`);
85
+ for (const issue of noIndexIssues.slice(0, 10)) {
86
+ relinka("error", ` ${issue.file}: ${issue.message}`);
87
+ }
88
+ if (noIndexIssues.length > 10) {
89
+ relinka("error", ` ... and ${noIndexIssues.length - 10} more`);
90
+ }
91
+ }
82
92
  relinka(
83
93
  "info",
84
94
  ` stats: ${stats.filesChecked} files, ${stats.importsChecked} imports, ${stats.timeElapsed}ms`
@@ -1,4 +1,4 @@
1
- import type { AllowedFileExtensionsType } from "./check-consts";
1
+ import type { AllowedFileExtensionsType } from "./rules-consts";
2
2
  export declare function validateDirectory(dir: string): Promise<boolean>;
3
3
  export declare function shouldIgnoreFile(filePath: string): boolean;
4
4
  export declare function getAllFiles(dir: AllowedFileExtensionsType, onProgress?: (current: number, total: number, file: string) => void): Promise<string[]>;
@@ -276,7 +276,9 @@ async function library_writeJsrPackageJSON(libName, outDirBin, pkgJsonDir, origi
276
276
  "package.json",
277
277
  "README.md",
278
278
  "LICENSE"
279
- ]
279
+ ],
280
+ main: `./bin/${path.basename(libsList[libName].libMainFile)}`,
281
+ module: `./bin/${path.basename(libsList[libName].libMainFile)}`
280
282
  });
281
283
  const pkgPath = path.join(pkgJsonDir, "package.json");
282
284
  await fs.ensureDir(path.dirname(pkgPath));
@@ -319,7 +321,7 @@ async function library_writeNpmLibPackageJSON(libName, outDirBin, pkgJsonDir, or
319
321
  libName
320
322
  ),
321
323
  exports: {
322
- ".": `./bin/${libsList[libName].libMainFile.replace(/\.ts$/, `.${unifiedBundlerOutExt}`)}`
324
+ ".": `./bin/${path.basename(libsList[libName].libMainFile).replace(/\.ts$/, `.${unifiedBundlerOutExt}`)}`
323
325
  },
324
326
  files: config.publishArtifacts?.global || [
325
327
  "bin",
@@ -327,8 +329,8 @@ async function library_writeNpmLibPackageJSON(libName, outDirBin, pkgJsonDir, or
327
329
  "README.md",
328
330
  "LICENSE"
329
331
  ],
330
- main: `./bin/${libsList[libName].libMainFile.replace(/\.ts$/, `.${unifiedBundlerOutExt}`)}`,
331
- module: `./bin/${libsList[libName].libMainFile.replace(/\.ts$/, `.${unifiedBundlerOutExt}`)}`,
332
+ main: `./bin/${path.basename(libsList[libName].libMainFile).replace(/\.ts$/, `.${unifiedBundlerOutExt}`)}`,
333
+ module: `./bin/${path.basename(libsList[libName].libMainFile).replace(/\.ts$/, `.${unifiedBundlerOutExt}`)}`,
332
334
  publishConfig: { access: "public" }
333
335
  });
334
336
  const pkgPath = path.join(pkgJsonDir, "package.json");
@@ -851,7 +851,7 @@ export type PerfTimer = {
851
851
  /** Options common to both NPM and JSR build targets */
852
852
  /** Options specific to the transpilation/bundling process */
853
853
  type DirectoryType = "src" | "dist-npm" | "dist-jsr" | "dist-libs/npm" | "dist-libs/jsr";
854
- export type FileCheckOptions = {
854
+ export type RulesCheckOptions = {
855
855
  directory: DirectoryType;
856
856
  strict: boolean;
857
857
  moduleResolution: "bundler" | "nodenext";
@@ -865,7 +865,7 @@ export type FileCheckOptions = {
865
865
  depth?: number;
866
866
  };
867
867
  export type CheckIssue = {
868
- type: "file-extension" | "path-extension" | "missing-dependency" | "builtin-module" | "dler-config-health" | "self-include" | "tsconfig-health";
868
+ type: "file-extension" | "path-extension" | "missing-dependency" | "builtin-module" | "dler-config-health" | "self-include" | "tsconfig-health" | "no-index-files";
869
869
  message: string;
870
870
  file: string;
871
871
  line?: number;
package/bin/mod.d.ts CHANGED
@@ -1 +1 @@
1
- export { defineConfig } from "./libs/sdk/sdk-impl/config/define";
1
+ export { defineConfig } from "./libs/sdk/sdk-impl/cfg/define";
package/bin/mod.js CHANGED
@@ -1 +1 @@
1
- export { defineConfig } from "./libs/sdk/sdk-impl/config/define.js";
1
+ export { defineConfig } from "./libs/sdk/sdk-impl/cfg/define.js";
package/package.json CHANGED
@@ -6,19 +6,17 @@
6
6
  "@reliverse/relico": "^1.1.2",
7
7
  "@reliverse/relifso": "^1.3.1",
8
8
  "@reliverse/relinka": "^1.4.7",
9
- "@reliverse/rempts": "^1.7.12",
9
+ "@reliverse/rempts": "^1.7.17",
10
10
  "@rollup/plugin-alias": "^5.1.1",
11
11
  "@rollup/plugin-commonjs": "^28.0.3",
12
12
  "@rollup/plugin-json": "^6.1.0",
13
13
  "@rollup/plugin-node-resolve": "^16.0.1",
14
14
  "@rollup/plugin-replace": "^6.0.2",
15
15
  "@rollup/pluginutils": "^5.1.4",
16
- "chalk": "^5.4.1",
17
16
  "defu": "^6.1.4",
18
17
  "esbuild": "^0.25.5",
19
18
  "execa": "^9.6.0",
20
19
  "fix-dts-default-cjs-exports": "^1.0.1",
21
- "glob": "^11.0.2",
22
20
  "hookable": "^5.5.3",
23
21
  "jiti": "^2.4.2",
24
22
  "magic-string": "^0.30.17",
@@ -41,7 +39,7 @@
41
39
  "license": "MIT",
42
40
  "name": "@reliverse/dler",
43
41
  "type": "module",
44
- "version": "1.7.1",
42
+ "version": "1.7.3",
45
43
  "keywords": [
46
44
  "reliverse",
47
45
  "cli",
@@ -1,84 +0,0 @@
1
- import path from "@reliverse/pathkit";
2
- import { re } from "@reliverse/relico";
3
- import { defineArgs, defineCommand } from "@reliverse/rempts";
4
- import { analyzeDependencies } from "../../libs/sdk/sdk-impl/check/rules/deps/analyzer.js";
5
- import { formatOutput } from "../../libs/sdk/sdk-impl/check/rules/deps/formatter.js";
6
- export default defineCommand({
7
- meta: {
8
- name: "deps",
9
- version: "1.0.0",
10
- description: "Find dependencies used but not listed in package.json"
11
- },
12
- args: defineArgs({
13
- directory: {
14
- type: "string",
15
- description: "directory to scan (defaults to current directory)",
16
- default: "."
17
- },
18
- all: {
19
- type: "boolean",
20
- description: "show all dependencies (both listed and not listed)"
21
- },
22
- ignore: {
23
- type: "string",
24
- description: "comma-separated patterns to ignore"
25
- },
26
- json: {
27
- type: "boolean",
28
- description: "output in JSON format"
29
- },
30
- builtins: {
31
- type: "boolean",
32
- description: "include Node.js built-in modules in the output"
33
- },
34
- dev: {
35
- type: "boolean",
36
- description: "check devDependencies instead of dependencies"
37
- },
38
- peer: {
39
- type: "boolean",
40
- description: "check peerDependencies instead of dependencies"
41
- },
42
- optional: {
43
- type: "boolean",
44
- description: "check optionalDependencies instead of dependencies"
45
- },
46
- fix: {
47
- type: "boolean",
48
- description: "automatically add missing dependencies to package.json"
49
- },
50
- depth: {
51
- type: "number",
52
- description: "maximum directory depth to scan (0 for unlimited)",
53
- default: 0
54
- }
55
- }),
56
- async run({ args }) {
57
- try {
58
- const directory = path.resolve(args.directory);
59
- const ignorePatterns = args.ignore ? args.ignore.split(",") : [];
60
- const options = {
61
- directory,
62
- showAll: args.all,
63
- ignorePatterns,
64
- json: args.json,
65
- builtins: args.builtins,
66
- dev: args.dev,
67
- peer: args.peer,
68
- optional: args.optional,
69
- fix: args.fix,
70
- depth: args.depth
71
- };
72
- console.log(re.gray(`Scanning directory: ${directory}`));
73
- const result = await analyzeDependencies(options);
74
- const output = formatOutput(result, options);
75
- console.log(output);
76
- if (result.missingDependencies.length > 0) {
77
- process.exit(1);
78
- }
79
- } catch (error) {
80
- console.error("Error:", error);
81
- process.exit(1);
82
- }
83
- }
84
- });