@reliverse/dler 1.7.1 → 1.7.2
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/README.md +62 -37
- package/bin/app/build/cmd.js +1 -1
- package/bin/app/build/impl.js +1 -1
- package/bin/app/check/cmd.js +29 -9
- package/bin/app/copy/cmd.d.ts +26 -0
- package/bin/app/copy/cmd.js +143 -0
- package/bin/app/deps/cmd.js +2 -2
- package/bin/app/migrate/cmd.d.ts +12 -0
- package/bin/app/migrate/cmd.js +51 -16
- package/bin/app/migrate/codemods/{anything-to-bun.js → anything-bun.js} +9 -6
- package/bin/app/migrate/codemods/console-relinka.d.ts +3 -0
- package/bin/app/migrate/codemods/console-relinka.js +157 -0
- package/bin/app/migrate/codemods/readdir-glob.d.ts +8 -0
- package/bin/app/migrate/codemods/readdir-glob.js +144 -0
- package/bin/app/pub/cmd.js +1 -1
- package/bin/app/rempts/migrate/impl/commander.js +2 -8
- package/bin/cli.js +35 -9
- package/bin/libs/sdk/sdk-impl/{config → cfg}/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/dler-config-health}/dler-config-health.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/dler-config-health}/dler-config-health.js +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/file-extensions/file-extensions.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/file-extensions}/file-extensions.js +2 -2
- package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/analyzer.js +15 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-mod.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules/missing-deps.js → rules/reliverse/missing-deps/deps-mod.js} +2 -2
- package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/deps-types.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/filesystem.js +2 -3
- package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/formatter.js +113 -0
- package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js +31 -0
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/package-json-health}/package-json-health.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/path-extensions/path-extensions.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/path-extensions}/path-extensions.js +2 -2
- package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/self-include}/self-include.js +2 -2
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/tsconfig-health}/tsconfig-health.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/{check/check-mod.js → rules/rules-mod.js} +10 -0
- package/bin/libs/sdk/sdk-impl/{check/check-utils.d.ts → rules/rules-utils.d.ts} +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +6 -4
- package/bin/libs/sdk/sdk-types.d.ts +2 -2
- package/bin/mod.d.ts +1 -1
- package/bin/mod.js +1 -1
- package/package.json +1 -3
- package/bin/app/relifso/cmd.d.ts +0 -11
- package/bin/app/relifso/cmd.js +0 -47
- package/bin/app/relinka/cmd.d.ts +0 -18
- package/bin/app/relinka/cmd.js +0 -149
- package/bin/libs/sdk/sdk-impl/check/rules/deps/formatter.js +0 -64
- package/bin/libs/sdk/sdk-impl/check/rules/file-extensions.d.ts +0 -2
- package/bin/libs/sdk/sdk-impl/check/rules/missing-deps.d.ts +0 -2
- package/bin/libs/sdk/sdk-impl/check/rules/path-extensions.d.ts +0 -2
- package/bin/libs/sdk/sdk-impl/check/rules/self-include.d.ts +0 -2
- /package/bin/app/{relifso/init → init}/cmd.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/cmd.js +0 -0
- /package/bin/app/{relifso/init → init}/init-const.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/init-const.js +0 -0
- /package/bin/app/{relifso/init → init}/init-impl.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/init-impl.js +0 -0
- /package/bin/app/{relifso/init → init}/init-types.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/init-types.js +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-gitignore.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-gitignore.js +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-license.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-license.js +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-readme.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-readme.js +0 -0
- /package/bin/app/migrate/codemods/{anything-to-bun.d.ts → anything-bun.d.ts} +0 -0
- /package/bin/app/migrate/codemods/{fs-to-relifso.d.ts → fs-relifso.d.ts} +0 -0
- /package/bin/app/migrate/codemods/{fs-to-relifso.js → fs-relifso.js} +0 -0
- /package/bin/app/migrate/codemods/{module-resolution.d.ts → nodenext-bundler.d.ts} +0 -0
- /package/bin/app/migrate/codemods/{module-resolution.js → nodenext-bundler.js} +0 -0
- /package/bin/app/migrate/codemods/{path-to-pathkit.d.ts → path-pathkit.d.ts} +0 -0
- /package/bin/app/migrate/codemods/{path-to-pathkit.js → path-pathkit.js} +0 -0
- /package/bin/app/{relifso/rename → rename}/cmd.d.ts +0 -0
- /package/bin/app/{relifso/rename → rename}/cmd.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/default.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/default.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/define.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/define.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/info.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/init.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/init.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/load.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/load.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/analyzer.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/deps-types.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/filesystem.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/formatter.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/parser.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/parser.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/package-json-health}/package-json-health.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/tsconfig-health}/tsconfig-health.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/check-consts.d.ts → rules/rules-consts.d.ts} +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/check-consts.js → rules/rules-consts.js} +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/check-mod.d.ts → rules/rules-mod.d.ts} +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/check-utils.js → rules/rules-utils.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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 = [];
|
package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/filesystem.js
RENAMED
|
@@ -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,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 "
|
|
1
|
+
import type { CheckResult } from "../../../../sdk-types.js";
|
|
2
2
|
export declare function checkPackageJsonHealth(): Promise<CheckResult>;
|
package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/path-extensions}/path-extensions.js
RENAMED
|
@@ -4,11 +4,11 @@ import { relinka } from "@reliverse/relinka";
|
|
|
4
4
|
import {
|
|
5
5
|
ALLOWED_IMPORT_EXTENSIONS,
|
|
6
6
|
STRICT_IMPORT_EXTENSIONS
|
|
7
|
-
} from "
|
|
7
|
+
} from "../../rules-consts.js";
|
|
8
8
|
import {
|
|
9
9
|
getAllFiles,
|
|
10
10
|
getLineNumber
|
|
11
|
-
} from "
|
|
11
|
+
} from "../../rules-utils.js";
|
|
12
12
|
function getAllowedImportExtensions(directory, strict) {
|
|
13
13
|
if (strict) {
|
|
14
14
|
return STRICT_IMPORT_EXTENSIONS[directory];
|
|
@@ -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 "
|
|
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 = [];
|
package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/tsconfig-health}/tsconfig-health.d.ts
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CheckResult } from "
|
|
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 "./
|
|
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
|
|
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/
|
|
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/
|
|
1
|
+
export { defineConfig } from "./libs/sdk/sdk-impl/cfg/define.js";
|
package/package.json
CHANGED
|
@@ -13,12 +13,10 @@
|
|
|
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.
|
|
42
|
+
"version": "1.7.2",
|
|
45
43
|
"keywords": [
|
|
46
44
|
"reliverse",
|
|
47
45
|
"cli",
|
package/bin/app/relifso/cmd.d.ts
DELETED
package/bin/app/relifso/cmd.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { relinka } from "@reliverse/relinka";
|
|
2
|
-
import { defineCommand, runCmd, selectPrompt } from "@reliverse/rempts";
|
|
3
|
-
import { getCmdRelifsoInit, getCmdRelifsoRename } from "../cmds.js";
|
|
4
|
-
export default defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "relifso",
|
|
7
|
-
description: "Runs the Relifso helper interactive menu (displays list of available commands)"
|
|
8
|
-
},
|
|
9
|
-
args: {
|
|
10
|
-
dev: {
|
|
11
|
-
type: "boolean",
|
|
12
|
-
description: "Runs the CLI in dev mode"
|
|
13
|
-
},
|
|
14
|
-
cwd: {
|
|
15
|
-
type: "string",
|
|
16
|
-
description: "The working directory to run the CLI in"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
run: async ({ args }) => {
|
|
20
|
-
const isDev = args.dev;
|
|
21
|
-
relinka("verbose", `Running in ${isDev ? "dev" : "prod"} mode`);
|
|
22
|
-
const cmd = await selectPrompt({
|
|
23
|
-
title: "Select a command",
|
|
24
|
-
options: [
|
|
25
|
-
{
|
|
26
|
-
value: "init",
|
|
27
|
-
label: "Initialize files"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
value: "rename-prepare",
|
|
31
|
-
label: "My project is a bootstrapper CLI (apply rename optimizations)"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
value: "rename-prepare-revert",
|
|
35
|
-
label: "Revert rename CLI files optimizations"
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
if (cmd === "init") {
|
|
40
|
-
await runCmd(await getCmdRelifsoInit(), []);
|
|
41
|
-
} else if (cmd === "rename-prepare") {
|
|
42
|
-
await runCmd(await getCmdRelifsoRename(), ["--prepareMyCLI"]);
|
|
43
|
-
} else if (cmd === "rename-prepare-revert") {
|
|
44
|
-
await runCmd(await getCmdRelifsoRename(), ["--prepareMyCLI", "--revert"]);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
package/bin/app/relinka/cmd.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
-
input: {
|
|
3
|
-
type: "string";
|
|
4
|
-
required: true;
|
|
5
|
-
description: string;
|
|
6
|
-
};
|
|
7
|
-
from: {
|
|
8
|
-
type: "string";
|
|
9
|
-
required: true;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
to: {
|
|
13
|
-
type: "string";
|
|
14
|
-
required: true;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
}>;
|
|
18
|
-
export default _default;
|
package/bin/app/relinka/cmd.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import fs from "@reliverse/relifso";
|
|
2
|
-
import { relinka } from "@reliverse/relinka";
|
|
3
|
-
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
4
|
-
export default defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "relinka",
|
|
7
|
-
version: "1.0.0",
|
|
8
|
-
description: "Convert between different logging formats (console, consola method/object, relinka function/method/object)."
|
|
9
|
-
},
|
|
10
|
-
args: defineArgs({
|
|
11
|
-
input: {
|
|
12
|
-
type: "string",
|
|
13
|
-
required: true,
|
|
14
|
-
description: "Input file or directory path"
|
|
15
|
-
},
|
|
16
|
-
from: {
|
|
17
|
-
type: "string",
|
|
18
|
-
required: true,
|
|
19
|
-
description: "Source format (console, consolaMethod, consolaObject, relinkaFunction, relinkaMethod, relinkaObject)"
|
|
20
|
-
},
|
|
21
|
-
to: {
|
|
22
|
-
type: "string",
|
|
23
|
-
required: true,
|
|
24
|
-
description: "Target format (console, consolaMethod, consolaObject, relinkaFunction, relinkaMethod, relinkaObject)"
|
|
25
|
-
}
|
|
26
|
-
}),
|
|
27
|
-
async run({ args }) {
|
|
28
|
-
const { input, from, to } = args;
|
|
29
|
-
if (!await fs.pathExists(input)) {
|
|
30
|
-
relinka("error", `\u274C Input path does not exist: ${input}`);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
let content = await fs.readFile(input, "utf-8");
|
|
34
|
-
let changes = false;
|
|
35
|
-
const levels = [
|
|
36
|
-
"log",
|
|
37
|
-
"info",
|
|
38
|
-
"warn",
|
|
39
|
-
"error",
|
|
40
|
-
"debug",
|
|
41
|
-
"verbose",
|
|
42
|
-
"success",
|
|
43
|
-
"ready",
|
|
44
|
-
"start",
|
|
45
|
-
"box",
|
|
46
|
-
"trace"
|
|
47
|
-
];
|
|
48
|
-
const getSourcePattern = (level, format) => {
|
|
49
|
-
switch (format) {
|
|
50
|
-
case "console":
|
|
51
|
-
return new RegExp(`console\\.${level}\\((.*?)(?:,\\s*(.*))?\\)`, "g");
|
|
52
|
-
case "consolaMethod":
|
|
53
|
-
if (level === "box") {
|
|
54
|
-
return /consola\.box\(\s*{\s*title:\s*"([^"]*)",\s*message:\s*"([^"]*)"\s*\}\s*\)/g;
|
|
55
|
-
}
|
|
56
|
-
return new RegExp(`consola\\.${level}\\((.*?)(?:,\\s*(.*))?\\)`, "g");
|
|
57
|
-
case "consolaObject":
|
|
58
|
-
return new RegExp(
|
|
59
|
-
`consola\\({level:\\s*"${level}",\\s*message:\\s*(.*?)(?:,\\s*title:\\s*"([^"]*)")?\\s*\\}\\)`,
|
|
60
|
-
"g"
|
|
61
|
-
);
|
|
62
|
-
case "relinkaFunction":
|
|
63
|
-
return new RegExp(
|
|
64
|
-
`relinka\\("${level}",\\s*(.*?)(?:,\\s*(.*))?\\)`,
|
|
65
|
-
"g"
|
|
66
|
-
);
|
|
67
|
-
case "relinkaMethod":
|
|
68
|
-
return new RegExp(`relinka\\.${level}\\((.*?)(?:,\\s*(.*))?\\)`, "g");
|
|
69
|
-
case "relinkaObject":
|
|
70
|
-
return new RegExp(
|
|
71
|
-
`relinka\\({level:\\s*"${level}",\\s*message:\\s*(.*?)(?:,\\s*title:\\s*"([^"]*)")?\\s*\\}\\)`,
|
|
72
|
-
"g"
|
|
73
|
-
);
|
|
74
|
-
default:
|
|
75
|
-
throw new Error(`Invalid source format: ${format}`);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const createReplacement = (level, message, title, args2) => {
|
|
79
|
-
switch (to) {
|
|
80
|
-
case "console":
|
|
81
|
-
return `console.${level}(${message}${args2 ? `, ${args2}` : ""})`;
|
|
82
|
-
case "consolaMethod":
|
|
83
|
-
if (level === "box" && title) {
|
|
84
|
-
return `consola.box({ title: "${title}", message: "${message}" })`;
|
|
85
|
-
}
|
|
86
|
-
return `consola.${level}(${message}${args2 ? `, ${args2}` : ""})`;
|
|
87
|
-
case "consolaObject": {
|
|
88
|
-
const obj = {
|
|
89
|
-
level: `"${level}"`,
|
|
90
|
-
message,
|
|
91
|
-
...title && { title: `"${title}"` },
|
|
92
|
-
...args2 && { args: `[${args2}]` }
|
|
93
|
-
};
|
|
94
|
-
return `consola(${JSON.stringify(obj).replace(/"([^"]+)":/g, "$1:")})`;
|
|
95
|
-
}
|
|
96
|
-
case "relinkaFunction":
|
|
97
|
-
if (level === "box" && title) {
|
|
98
|
-
return `relinka("${level}", "${title}\\n${message}"${args2 ? `, ${args2}` : ""})`;
|
|
99
|
-
}
|
|
100
|
-
return `relinka("${level}", ${message}${args2 ? `, ${args2}` : ""})`;
|
|
101
|
-
case "relinkaMethod":
|
|
102
|
-
if (level === "box" && title) {
|
|
103
|
-
return `relinka.${level}("${title}\\n${message}"${args2 ? `, ${args2}` : ""})`;
|
|
104
|
-
}
|
|
105
|
-
return `relinka.${level}(${message}${args2 ? `, ${args2}` : ""})`;
|
|
106
|
-
case "relinkaObject": {
|
|
107
|
-
const obj = {
|
|
108
|
-
level: `"${level}"`,
|
|
109
|
-
message,
|
|
110
|
-
...title && { title: `"${title}"` },
|
|
111
|
-
...args2 && { args: `[${args2}]` }
|
|
112
|
-
};
|
|
113
|
-
return `relinka(${JSON.stringify(obj).replace(/"([^"]+)":/g, "$1:")})`;
|
|
114
|
-
}
|
|
115
|
-
default:
|
|
116
|
-
throw new Error(`Invalid target format: ${to}`);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
for (const level of levels) {
|
|
120
|
-
const pattern = getSourcePattern(level, from);
|
|
121
|
-
const newContent = content.replace(
|
|
122
|
-
pattern,
|
|
123
|
-
(_, message, titleOrArgs, args2) => {
|
|
124
|
-
changes = true;
|
|
125
|
-
if ((from === "consolaMethod" || from === "relinkaMethod") && level === "box") {
|
|
126
|
-
return createReplacement(level, message, titleOrArgs, args2);
|
|
127
|
-
}
|
|
128
|
-
return createReplacement(level, message, void 0, titleOrArgs);
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
if (newContent !== content) {
|
|
132
|
-
content = newContent;
|
|
133
|
-
relinka(
|
|
134
|
-
"log",
|
|
135
|
-
`\u2705 Converted ${level} calls from ${from} to ${to} format`
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (!changes) {
|
|
140
|
-
relinka("warn", "\u26A0\uFE0F No matching calls found to convert");
|
|
141
|
-
} else {
|
|
142
|
-
await fs.writeFile(input, content, "utf-8");
|
|
143
|
-
relinka(
|
|
144
|
-
"success",
|
|
145
|
-
"\u2728 Successfully converted all logging calls to the target format"
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
export const formatOutput = (result, options) => {
|
|
3
|
-
if (options.json) {
|
|
4
|
-
return JSON.stringify(result, null, 2);
|
|
5
|
-
}
|
|
6
|
-
let output = "";
|
|
7
|
-
output += chalk.bold.blue("\nMissing Dependencies Finder Results\n");
|
|
8
|
-
output += chalk.gray("---------------------------------------\n\n");
|
|
9
|
-
output += chalk.bold("Statistics:\n");
|
|
10
|
-
output += `${chalk.gray("\u2022 ")}Total dependencies found: ${result.allDependencies.length}
|
|
11
|
-
`;
|
|
12
|
-
output += `${chalk.gray("\u2022 ")}Listed in package.json: ${result.listedDependencies.length}
|
|
13
|
-
`;
|
|
14
|
-
output += `${chalk.gray("\u2022 ")}Missing from package.json: ${result.missingDependencies.length}
|
|
15
|
-
`;
|
|
16
|
-
if (options.builtins) {
|
|
17
|
-
output += `${chalk.gray("\u2022 ")}Node.js built-in modules: ${result.builtinModules.length}
|
|
18
|
-
`;
|
|
19
|
-
}
|
|
20
|
-
output += "\n";
|
|
21
|
-
if (result.missingDependencies.length > 0) {
|
|
22
|
-
output += chalk.bold.red("Missing Dependencies:\n");
|
|
23
|
-
for (const dep of result.missingDependencies) {
|
|
24
|
-
output += `${chalk.gray("\u2022 ")}${chalk.yellow(dep)}
|
|
25
|
-
`;
|
|
26
|
-
}
|
|
27
|
-
output += "\n";
|
|
28
|
-
output += chalk.gray("To install, run:\n");
|
|
29
|
-
output += chalk.cyan(
|
|
30
|
-
`npm install ${result.missingDependencies.join(" ")}
|
|
31
|
-
`
|
|
32
|
-
);
|
|
33
|
-
} else {
|
|
34
|
-
output += chalk.bold.green("No missing dependencies found! \u{1F389}\n\n");
|
|
35
|
-
}
|
|
36
|
-
if (options.builtins && result.builtinModules.length > 0) {
|
|
37
|
-
output += chalk.bold.blue("Node.js Built-in Modules Used:\n");
|
|
38
|
-
for (const dep of result.builtinModules) {
|
|
39
|
-
output += `${chalk.gray("\u2022 ")}${chalk.blue(dep)}
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
42
|
-
output += "\n";
|
|
43
|
-
}
|
|
44
|
-
if (options.showAll) {
|
|
45
|
-
output += chalk.bold("All Dependencies:\n");
|
|
46
|
-
output += chalk.gray("(\u2713 = listed in package.json, \u2717 = missing)\n");
|
|
47
|
-
for (const dep of result.allDependencies) {
|
|
48
|
-
const isListed = result.listedDependencies.includes(dep);
|
|
49
|
-
const isBuiltin = result.builtinModules.includes(dep);
|
|
50
|
-
if (isListed) {
|
|
51
|
-
output += `${chalk.gray("\u2022 ") + chalk.green("\u2713 ") + dep}
|
|
52
|
-
`;
|
|
53
|
-
} else if (isBuiltin) {
|
|
54
|
-
output += `${chalk.gray("\u2022 ")}${chalk.blue("\u26A1 ")}${dep}${chalk.gray(" (built-in)")}
|
|
55
|
-
`;
|
|
56
|
-
} else {
|
|
57
|
-
output += `${chalk.gray("\u2022 ")}${chalk.red("\u2717 ")}${chalk.yellow(dep)}
|
|
58
|
-
`;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
output += "\n";
|
|
62
|
-
}
|
|
63
|
-
return output;
|
|
64
|
-
};
|
|
File without changes
|
|
File without changes
|