@reliverse/dler 1.5.3 → 1.5.5

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.
@@ -41,6 +41,7 @@ async function getAllFilesAsync(dir, baseDir = dir, recursive = true) {
41
41
  return fileList;
42
42
  }
43
43
  async function prepareCLIFiles(revert = false, recursive = true, useDtsTxtForPrepareMyCLI = false) {
44
+ relinka("log", "Starting CLI file preparation...");
44
45
  const configPath = ".config/dler.ts";
45
46
  let srcDir = "src";
46
47
  if (existsSync(configPath)) {
@@ -54,36 +55,65 @@ async function prepareCLIFiles(revert = false, recursive = true, useDtsTxtForPre
54
55
  throw new Error(`Source directory not found: ${srcDir}`);
55
56
  }
56
57
  const files = await getAllFilesAsync(srcDir, srcDir, recursive);
58
+ relinka("log", `Found ${files.length} files to process.`);
59
+ let renamedCount = 0;
57
60
  for (const file of files) {
58
61
  const fullPath = join(srcDir, file);
59
62
  if (!await fileExists(fullPath)) continue;
60
63
  const ext = extname(file);
64
+ const fileName = basename(file);
61
65
  const baseName = basename(file, ext);
62
66
  const dir = dirname(fullPath);
67
+ relinka("log", `Processing file: ${fullPath}`);
63
68
  if (revert) {
64
69
  if (file.endsWith(".json.json")) {
65
- await safeRename(fullPath, join(dir, baseName));
70
+ const originalName = join(dir, fileName.replace(".json.json", ".json"));
71
+ relinka("log", `Reverting ${fullPath} to ${originalName}`);
72
+ await safeRename(fullPath, originalName);
73
+ renamedCount++;
66
74
  } else if (file.endsWith(".d.ts.txt") && useDtsTxtForPrepareMyCLI) {
67
- await safeRename(fullPath, join(dir, `${baseName}.d.ts`));
75
+ const originalName = join(dir, fileName.replace(".d.ts.txt", ".d.ts"));
76
+ relinka("log", `Reverting ${fullPath} to ${originalName}`);
77
+ await safeRename(fullPath, originalName);
78
+ renamedCount++;
68
79
  } else if (file.endsWith(".cjs")) {
69
- await safeRename(fullPath, join(dir, `${baseName}.js`));
80
+ const originalName = join(dir, `${baseName}.js`);
81
+ relinka("log", `Reverting ${fullPath} to ${originalName}`);
82
+ await safeRename(fullPath, originalName);
83
+ renamedCount++;
70
84
  }
71
85
  } else {
72
- if (file === "tsconfig.json" && !file.endsWith(".json.json")) {
73
- await safeRename(fullPath, join(dir, "tsconfig.json.json"));
74
- } else if (file === "package.json" && !file.endsWith(".json.json")) {
75
- await safeRename(fullPath, join(dir, "package.json.json"));
76
- } else if (file.endsWith(".d.ts") && !file.endsWith(".d.ts.txt") && useDtsTxtForPrepareMyCLI) {
86
+ if (fileName === "tsconfig.json" && !fileName.endsWith(".json.json")) {
87
+ const newName = join(dir, "tsconfig.json.json");
88
+ relinka("log", `Renaming ${fullPath} to ${newName}`);
89
+ await safeRename(fullPath, newName);
90
+ renamedCount++;
91
+ } else if (fileName === "package.json" && !fileName.endsWith(".json.json")) {
92
+ const newName = join(dir, "package.json.json");
93
+ relinka("log", `Renaming ${fullPath} to ${newName}`);
94
+ await safeRename(fullPath, newName);
95
+ renamedCount++;
96
+ } else if (fileName.endsWith(".d.ts") && !fileName.endsWith(".d.ts.txt") && useDtsTxtForPrepareMyCLI) {
77
97
  const baseWithoutD = baseName.slice(0, -2);
78
- await safeRename(fullPath, join(dir, `${baseWithoutD}.d.ts.txt`));
79
- } else if (file.endsWith(".js") && !file.endsWith(".cjs")) {
98
+ const newName = join(dir, `${baseWithoutD}.d.ts.txt`);
99
+ relinka("log", `Renaming ${fullPath} to ${newName}`);
100
+ await safeRename(fullPath, newName);
101
+ renamedCount++;
102
+ } else if (fileName.endsWith(".js") && !fileName.endsWith(".cjs")) {
80
103
  const content = readFileSync(fullPath, "utf-8");
81
104
  if (isCommonJSFile(content)) {
82
- await safeRename(fullPath, join(dir, `${baseName}.cjs`));
105
+ const newName = join(dir, `${baseName}.cjs`);
106
+ relinka("log", `Renaming ${fullPath} to ${newName}`);
107
+ await safeRename(fullPath, newName);
108
+ renamedCount++;
83
109
  }
84
110
  }
85
111
  }
86
112
  }
113
+ relinka(
114
+ "log",
115
+ `CLI file preparation completed. Renamed ${renamedCount} files.`
116
+ );
87
117
  }
88
118
  export default defineCommand({
89
119
  meta: {
package/bin/init/info.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { endPrompt, startPrompt } from "@reliverse/rempts";
2
- const version = "1.5.3";
2
+ const version = "1.5.5";
3
3
  export async function showStartPrompt(isDev) {
4
4
  await startPrompt({
5
5
  titleColor: "inverse",
package/package.json CHANGED
@@ -41,7 +41,7 @@
41
41
  "license": "MIT",
42
42
  "name": "@reliverse/dler",
43
43
  "type": "module",
44
- "version": "1.5.3",
44
+ "version": "1.5.5",
45
45
  "keywords": [
46
46
  "reliverse",
47
47
  "cli",