@reliverse/dler 1.7.2 → 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.
- package/README.md +93 -71
- package/bin/app/agg/run.js +2 -2
- package/bin/app/check/cmd.d.ts +37 -0
- package/bin/app/check/cmd.js +74 -4
- package/bin/app/cmds.d.ts +15 -20
- package/bin/app/cmds.js +16 -76
- package/bin/app/copy/cmd.d.ts +10 -5
- package/bin/app/copy/cmd.js +77 -47
- package/bin/app/inject/cmd.d.ts +13 -0
- package/bin/app/inject/cmd.js +33 -21
- package/bin/app/merge/cmd.d.ts +63 -5
- package/bin/app/merge/cmd.js +220 -25
- package/bin/app/migrate/cmd.d.ts +5 -0
- package/bin/app/migrate/cmd.js +17 -1
- package/bin/app/rempts/{cmdsTs/cmd.d.ts → cmd.d.ts} +13 -4
- package/bin/app/rempts/cmd.js +304 -0
- package/bin/cli.js +6 -11
- package/bin/libs/sdk/sdk-impl/cfg/info.js +1 -1
- package/package.json +2 -2
- package/bin/app/deps/cmd.d.ts +0 -45
- package/bin/app/deps/cmd.js +0 -84
- package/bin/app/inject/README.md +0 -139
- package/bin/app/inject/expect/cmd.d.ts +0 -20
- package/bin/app/inject/expect/cmd.js +0 -43
- package/bin/app/rempts/README.md +0 -121
- package/bin/app/rempts/cmd/cmd.d.ts +0 -16
- package/bin/app/rempts/cmd/cmd.js +0 -157
- package/bin/app/rempts/cmd/templates.d.ts +0 -2
- package/bin/app/rempts/cmd/templates.js +0 -30
- package/bin/app/rempts/cmdsTs/cmd.js +0 -96
- package/bin/app/rempts/migrate/cmd.d.ts +0 -14
- package/bin/app/rempts/migrate/cmd.js +0 -38
- /package/bin/app/inject/{expect/impl.d.ts → impl.d.ts} +0 -0
- /package/bin/app/inject/{expect/impl.js → impl.js} +0 -0
- /package/bin/app/{rempts/migrate/impl/commander.d.ts → migrate/codemods/commander-rempts.d.ts} +0 -0
- /package/bin/app/{rempts/migrate/impl/commander.js → migrate/codemods/commander-rempts.js} +0 -0
package/bin/app/migrate/cmd.d.ts
CHANGED
package/bin/app/migrate/cmd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
|
-
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
+
import { confirmPrompt, defineArgs, defineCommand } from "@reliverse/rempts";
|
|
3
3
|
import { migrateAnythingToBun } from "./codemods/anything-bun.js";
|
|
4
4
|
import { consoleToRelinka } from "./codemods/console-relinka.js";
|
|
5
5
|
import { migrateFsToRelifso } from "./codemods/fs-relifso.js";
|
|
@@ -13,6 +13,11 @@ export default defineCommand({
|
|
|
13
13
|
description: "Migrate between different libraries and usages"
|
|
14
14
|
},
|
|
15
15
|
args: defineArgs({
|
|
16
|
+
interactive: {
|
|
17
|
+
type: "boolean",
|
|
18
|
+
description: "Interactive mode",
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
16
21
|
codemod: {
|
|
17
22
|
type: "string",
|
|
18
23
|
description: "The migration to perform (anything-bun | path-pathkit | fs-relifso | nodenext-bundler | readdir-glob | console-relinka)"
|
|
@@ -50,6 +55,17 @@ export default defineCommand({
|
|
|
50
55
|
}
|
|
51
56
|
}),
|
|
52
57
|
async run({ args }) {
|
|
58
|
+
if (args.interactive) {
|
|
59
|
+
const confidence = await confirmPrompt({
|
|
60
|
+
title: `This is an experimental feature and probably may broke some things.
|
|
61
|
+
It will be improved in the future.
|
|
62
|
+
Are you sure you want to migrate files in ${args.project}?`,
|
|
63
|
+
defaultValue: false
|
|
64
|
+
});
|
|
65
|
+
if (!confidence) {
|
|
66
|
+
throw new Error("Migration cancelled");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
53
69
|
if (args.codemod === "anything-bun") {
|
|
54
70
|
relinka("log", "Migrating to Bun...");
|
|
55
71
|
await migrateAnythingToBun({
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
init: {
|
|
3
|
+
type: "string";
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
overwrite: {
|
|
7
|
+
type: "boolean";
|
|
8
|
+
description: string;
|
|
9
|
+
default: true;
|
|
10
|
+
};
|
|
11
|
+
customCmdsRoot: {
|
|
12
|
+
type: "string";
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
2
15
|
outFile: {
|
|
3
16
|
type: "string";
|
|
4
17
|
description: string;
|
|
@@ -8,9 +21,5 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
8
21
|
type: "array";
|
|
9
22
|
description: string;
|
|
10
23
|
};
|
|
11
|
-
overwrite: {
|
|
12
|
-
type: "boolean";
|
|
13
|
-
description: string;
|
|
14
|
-
};
|
|
15
24
|
}>;
|
|
16
25
|
export default _default;
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
3
|
+
import { relinka } from "@reliverse/relinka";
|
|
4
|
+
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
5
|
+
import { createJiti } from "jiti";
|
|
6
|
+
export default defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "rempts",
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
description: "Scaffold new CLI commands and generate a command exports file (this file allows you to run your commands programmatically)."
|
|
11
|
+
},
|
|
12
|
+
args: defineArgs({
|
|
13
|
+
init: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Names of commands to initialize (space-separated or quoted)"
|
|
16
|
+
},
|
|
17
|
+
overwrite: {
|
|
18
|
+
type: "boolean",
|
|
19
|
+
description: "Overwrite existing commands and exports file",
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
customCmdsRoot: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "Root directory for custom commands"
|
|
25
|
+
},
|
|
26
|
+
outFile: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: "Output file path for exports (relative to workspace root)",
|
|
29
|
+
default: "src/app/cmds.ts"
|
|
30
|
+
},
|
|
31
|
+
cmdDirs: {
|
|
32
|
+
type: "array",
|
|
33
|
+
description: "Command directories to scan (relative to src/app)"
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
async run({ args }) {
|
|
37
|
+
let cmdsRoot = args.customCmdsRoot;
|
|
38
|
+
let cliFilePath = "";
|
|
39
|
+
let didInit = false;
|
|
40
|
+
if (args.init) {
|
|
41
|
+
let cmdNames = [];
|
|
42
|
+
if (Array.isArray(args.init)) {
|
|
43
|
+
cmdNames = args.init;
|
|
44
|
+
} else if (typeof args.init === "string") {
|
|
45
|
+
cmdNames = args.init.split(/\s+/).filter(Boolean);
|
|
46
|
+
}
|
|
47
|
+
if (cmdNames.length === 1) {
|
|
48
|
+
const argv = process.argv;
|
|
49
|
+
const initIndex = argv.findIndex((arg) => arg === "--init");
|
|
50
|
+
if (initIndex !== -1 && initIndex + 1 < argv.length) {
|
|
51
|
+
const additionalArgs = [];
|
|
52
|
+
for (let i = initIndex + 2; i < argv.length; i++) {
|
|
53
|
+
const arg = argv[i];
|
|
54
|
+
if (arg?.startsWith("--")) break;
|
|
55
|
+
if (arg && !arg.startsWith("-")) {
|
|
56
|
+
additionalArgs.push(arg);
|
|
57
|
+
} else {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (additionalArgs.length > 0 && cmdNames[0]) {
|
|
62
|
+
cmdNames = [cmdNames[0], ...additionalArgs];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (cmdNames.length === 0) {
|
|
67
|
+
relinka("error", "No command names provided");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (!cmdsRoot) {
|
|
71
|
+
const defaultCmdsRoot = path.resolve("src/app");
|
|
72
|
+
if (await fs.pathExists(defaultCmdsRoot)) {
|
|
73
|
+
cmdsRoot = defaultCmdsRoot;
|
|
74
|
+
} else {
|
|
75
|
+
const { cmdsRoot: configCmdsRoot, cliFile } = await handleDlerConfig();
|
|
76
|
+
cmdsRoot = configCmdsRoot;
|
|
77
|
+
cliFilePath = cliFile;
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
cmdsRoot = path.resolve(cmdsRoot);
|
|
81
|
+
}
|
|
82
|
+
relinka(
|
|
83
|
+
"info",
|
|
84
|
+
`\u{1F680} Creating ${cmdNames.length} command(s): ${cmdNames.join(", ")}`
|
|
85
|
+
);
|
|
86
|
+
for (const cmdName of cmdNames) {
|
|
87
|
+
const dirPath = path.join(cmdsRoot, cmdName);
|
|
88
|
+
const filePath = path.join(dirPath, "cmd.ts");
|
|
89
|
+
if (await fs.pathExists(filePath) && !args.overwrite) {
|
|
90
|
+
relinka(
|
|
91
|
+
"warn",
|
|
92
|
+
`Command "${cmdName}" already exists. Use --overwrite to overwrite.`
|
|
93
|
+
);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
await fs.ensureDir(dirPath);
|
|
97
|
+
const content = generateCommandTemplate(cmdName);
|
|
98
|
+
await fs.writeFile(filePath, content, "utf-8");
|
|
99
|
+
relinka("log", `\u2705 Created new command: ${filePath}`);
|
|
100
|
+
}
|
|
101
|
+
if (cliFilePath) {
|
|
102
|
+
relinka(
|
|
103
|
+
"info",
|
|
104
|
+
"\u{1F4E6} Make sure you have @reliverse/rempts installed: bun add @reliverse/rempts"
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
didInit = true;
|
|
108
|
+
}
|
|
109
|
+
if (!args.init) {
|
|
110
|
+
const root2 = path.resolve("src/app");
|
|
111
|
+
const outPath2 = path.resolve(args.outFile ?? "src/app/cmds.ts");
|
|
112
|
+
const cmdDirs2 = (args.cmdDirs ?? []).length > 0 ? args.cmdDirs ?? [] : await findCommandDirs(root2);
|
|
113
|
+
if (cmdDirs2.length === 0) {
|
|
114
|
+
relinka(
|
|
115
|
+
"warn",
|
|
116
|
+
"No command directories found with cmd.ts or cmd.js files. Nothing to generate."
|
|
117
|
+
);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (await fs.pathExists(outPath2) && !args.overwrite) {
|
|
121
|
+
relinka(
|
|
122
|
+
"warn",
|
|
123
|
+
`\u274C File "${outPath2}" already exists. Use --overwrite to overwrite.`
|
|
124
|
+
);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const exports2 = generateExports(cmdDirs2);
|
|
128
|
+
await fs.ensureDir(path.dirname(outPath2));
|
|
129
|
+
await fs.writeFile(outPath2, exports2, "utf-8");
|
|
130
|
+
relinka("success", `\u2705 Generated command exports at: ${outPath2}`);
|
|
131
|
+
relinka(
|
|
132
|
+
"log",
|
|
133
|
+
`Found ${cmdDirs2.length} command(s): ${cmdDirs2.join(", ")}`
|
|
134
|
+
);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const root = path.resolve("src/app");
|
|
138
|
+
const outPath = path.resolve(args.outFile ?? "src/app/cmds.ts");
|
|
139
|
+
if (await fs.pathExists(outPath) && !args.overwrite) {
|
|
140
|
+
relinka(
|
|
141
|
+
"warn",
|
|
142
|
+
`\u274C File "${outPath}" already exists. Use --overwrite to overwrite.`
|
|
143
|
+
);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const cmdDirs = (args.cmdDirs ?? []).length > 0 ? args.cmdDirs ?? [] : await findCommandDirs(root);
|
|
147
|
+
if (cmdDirs.length === 0) {
|
|
148
|
+
relinka(
|
|
149
|
+
"warn",
|
|
150
|
+
"No command directories found with cmd.ts or cmd.js files."
|
|
151
|
+
);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const exports = generateExports(cmdDirs);
|
|
155
|
+
await fs.ensureDir(path.dirname(outPath));
|
|
156
|
+
await fs.writeFile(outPath, exports, "utf-8");
|
|
157
|
+
relinka("success", `\u2705 Generated command exports at: ${outPath}`);
|
|
158
|
+
relinka("log", `Found ${cmdDirs.length} command(s): ${cmdDirs.join(", ")}`);
|
|
159
|
+
if (didInit) {
|
|
160
|
+
relinka(
|
|
161
|
+
"log",
|
|
162
|
+
`Usage example:
|
|
163
|
+
import { getCmdName } from "../cmds.js";
|
|
164
|
+
const cmd = await getCmdName();
|
|
165
|
+
await runCmd(cmd, [
|
|
166
|
+
// String arguments
|
|
167
|
+
"--name=my-project",
|
|
168
|
+
"--path=./src",
|
|
169
|
+
// Boolean flags
|
|
170
|
+
"--force",
|
|
171
|
+
"--no-cache",
|
|
172
|
+
// Number values
|
|
173
|
+
"--port=3000",
|
|
174
|
+
// Array values
|
|
175
|
+
"--files=file1.ts,file2.ts",
|
|
176
|
+
// Positional arguments (must come last)
|
|
177
|
+
"--build=src/1.ts src/2.ts",
|
|
178
|
+
]);`
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
async function handleDlerConfig() {
|
|
184
|
+
const dlerConfigPath = path.resolve(".config/dler.ts");
|
|
185
|
+
let cmdsRoot = "src/app";
|
|
186
|
+
let cliFilePath = "";
|
|
187
|
+
try {
|
|
188
|
+
const jiti = createJiti(import.meta.url);
|
|
189
|
+
const dlerConfig = await jiti.import(dlerConfigPath, {
|
|
190
|
+
default: true
|
|
191
|
+
});
|
|
192
|
+
const coreIsCLI = dlerConfig?.coreIsCLI;
|
|
193
|
+
if (!coreIsCLI?.enabled || !coreIsCLI?.scripts) {
|
|
194
|
+
cliFilePath = await ensureCliFile("src/cli.ts");
|
|
195
|
+
cmdsRoot = "src/app";
|
|
196
|
+
} else {
|
|
197
|
+
const firstScript = Object.values(coreIsCLI.scripts)[0];
|
|
198
|
+
const scriptPath = path.resolve(firstScript);
|
|
199
|
+
if (await fs.pathExists(scriptPath)) {
|
|
200
|
+
const content = await fs.readFile(scriptPath, "utf-8");
|
|
201
|
+
if (content.includes("@reliverse/rempts")) {
|
|
202
|
+
if (content.includes("runMain")) {
|
|
203
|
+
const cmdsRootMatch = content.match(
|
|
204
|
+
/cmdsRootPath:\s*["']([^"']+)["']/
|
|
205
|
+
);
|
|
206
|
+
if (cmdsRootMatch?.[1]) {
|
|
207
|
+
cmdsRoot = path.resolve(cmdsRootMatch[1]);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
relinka("warn", `${scriptPath} doesn't use @reliverse/rempts`);
|
|
212
|
+
cmdsRoot = "src/app";
|
|
213
|
+
}
|
|
214
|
+
} else {
|
|
215
|
+
cliFilePath = await ensureCliFile(scriptPath);
|
|
216
|
+
cmdsRoot = "src/app";
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
} catch {
|
|
220
|
+
cliFilePath = await ensureCliFile("src/cli.ts");
|
|
221
|
+
cmdsRoot = "src/app";
|
|
222
|
+
}
|
|
223
|
+
return { cmdsRoot: path.resolve(cmdsRoot), cliFile: cliFilePath };
|
|
224
|
+
}
|
|
225
|
+
async function ensureCliFile(filePath) {
|
|
226
|
+
const resolvedPath = path.resolve(filePath);
|
|
227
|
+
if (!await fs.pathExists(resolvedPath)) {
|
|
228
|
+
await fs.ensureDir(path.dirname(resolvedPath));
|
|
229
|
+
await fs.writeFile(resolvedPath, cliTemplate, "utf-8");
|
|
230
|
+
relinka("log", `\u2705 Created CLI entry file: ${resolvedPath}`);
|
|
231
|
+
return resolvedPath;
|
|
232
|
+
}
|
|
233
|
+
return "";
|
|
234
|
+
}
|
|
235
|
+
async function findCommandDirs(root) {
|
|
236
|
+
const cmdDirs = [];
|
|
237
|
+
async function scan(dir) {
|
|
238
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
239
|
+
for (const entry of entries) {
|
|
240
|
+
const fullPath = path.join(dir, entry.name);
|
|
241
|
+
if (entry.isDirectory()) {
|
|
242
|
+
const hasCmdTs = await fs.pathExists(path.join(fullPath, "cmd.ts"));
|
|
243
|
+
const hasCmdJs = await fs.pathExists(path.join(fullPath, "cmd.js"));
|
|
244
|
+
if (hasCmdTs || hasCmdJs) {
|
|
245
|
+
const relPath = path.relative(root, fullPath);
|
|
246
|
+
cmdDirs.push(relPath);
|
|
247
|
+
}
|
|
248
|
+
await scan(fullPath);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
await scan(root);
|
|
253
|
+
return cmdDirs;
|
|
254
|
+
}
|
|
255
|
+
function generateExports(cmdDirs) {
|
|
256
|
+
const lines = [
|
|
257
|
+
"// this file is auto-(re)generated by `dler rempts`",
|
|
258
|
+
"",
|
|
259
|
+
'import type { Command } from "@reliverse/rempts";',
|
|
260
|
+
"",
|
|
261
|
+
'import { loadCommand } from "@reliverse/rempts";',
|
|
262
|
+
""
|
|
263
|
+
];
|
|
264
|
+
for (const dir of cmdDirs) {
|
|
265
|
+
const funcName = "get" + dir.split(/[/\\]/).map(
|
|
266
|
+
(part) => part.charAt(0).toUpperCase() + part.slice(1).replace(/[^a-zA-Z0-9]/g, "")
|
|
267
|
+
).join("") + "Cmd";
|
|
268
|
+
lines.push(
|
|
269
|
+
`export const ${funcName} = async (): Promise<Command> => loadCommand("${dir}");`,
|
|
270
|
+
""
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
return lines.join("\n");
|
|
274
|
+
}
|
|
275
|
+
function generateCommandTemplate(cmdName) {
|
|
276
|
+
return `import { defineCommand, defineArgs } from "@reliverse/rempts";
|
|
277
|
+
export default defineCommand({
|
|
278
|
+
meta: {
|
|
279
|
+
name: "${cmdName}",
|
|
280
|
+
version: "1.0.0",
|
|
281
|
+
description: "Describe what ${cmdName} command does.",
|
|
282
|
+
},
|
|
283
|
+
args: defineArgs({
|
|
284
|
+
exampleArg: {
|
|
285
|
+
type: "string",
|
|
286
|
+
default: "defaultValue",
|
|
287
|
+
description: "An example argument",
|
|
288
|
+
},
|
|
289
|
+
}),
|
|
290
|
+
async run({ args }) {
|
|
291
|
+
console.log("Command '${cmdName}' executed.");
|
|
292
|
+
console.log("Received args:", args);
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
`;
|
|
296
|
+
}
|
|
297
|
+
const cliTemplate = `import { defineCommand, runMain } from "@reliverse/rempts";
|
|
298
|
+
await runMain(
|
|
299
|
+
defineCommand({
|
|
300
|
+
// empty object activates file-based
|
|
301
|
+
// commands in the src/app directory
|
|
302
|
+
}),
|
|
303
|
+
);
|
|
304
|
+
`;
|
package/bin/cli.js
CHANGED
|
@@ -8,12 +8,7 @@ import {
|
|
|
8
8
|
runCmd as remptsRunCmd
|
|
9
9
|
} from "@reliverse/rempts";
|
|
10
10
|
import { promptAggCommand } from "./app/agg/run.js";
|
|
11
|
-
import {
|
|
12
|
-
getCmdBuild,
|
|
13
|
-
getCmdPub,
|
|
14
|
-
getCmdRelifsoInit,
|
|
15
|
-
getCmdRelifsoRename
|
|
16
|
-
} from "./app/cmds.js";
|
|
11
|
+
import { getBuildCmd, getPubCmd, getInitCmd, getRenameCmd } from "./app/cmds.js";
|
|
17
12
|
import { showEndPrompt, showStartPrompt } from "./libs/sdk/sdk-impl/cfg/info.js";
|
|
18
13
|
const INTERACTIVE_CMDS = ["agg", "build", "pub"];
|
|
19
14
|
async function runCmd(cmdPromise, args) {
|
|
@@ -79,15 +74,15 @@ Available interactive commands: ${INTERACTIVE_CMDS.join(", ")}`
|
|
|
79
74
|
if (cmdToRun === "agg") {
|
|
80
75
|
await promptAggCommand();
|
|
81
76
|
} else if (cmdToRun === "build") {
|
|
82
|
-
await runCmd(
|
|
77
|
+
await runCmd(getBuildCmd(), [`--dev=${args.dev}`]);
|
|
83
78
|
} else if (cmdToRun === "pub") {
|
|
84
|
-
await runCmd(
|
|
79
|
+
await runCmd(getPubCmd(), [`--dev=${args.dev}`]);
|
|
85
80
|
} else if (cmdToRun === "init") {
|
|
86
|
-
await runCmd(
|
|
81
|
+
await runCmd(getInitCmd(), []);
|
|
87
82
|
} else if (cmdToRun === "rename-prepare") {
|
|
88
|
-
await runCmd(
|
|
83
|
+
await runCmd(getRenameCmd(), ["--prepareMyCLI"]);
|
|
89
84
|
} else if (cmdToRun === "rename-prepare-revert") {
|
|
90
|
-
await runCmd(
|
|
85
|
+
await runCmd(getRenameCmd(), ["--prepareMyCLI", "--revert"]);
|
|
91
86
|
}
|
|
92
87
|
relinka("log", " ");
|
|
93
88
|
await showEndPrompt();
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
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.
|
|
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",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"name": "@reliverse/dler",
|
|
41
41
|
"type": "module",
|
|
42
|
-
"version": "1.7.
|
|
42
|
+
"version": "1.7.3",
|
|
43
43
|
"keywords": [
|
|
44
44
|
"reliverse",
|
|
45
45
|
"cli",
|
package/bin/app/deps/cmd.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
-
directory: {
|
|
3
|
-
type: "string";
|
|
4
|
-
description: string;
|
|
5
|
-
default: string;
|
|
6
|
-
};
|
|
7
|
-
all: {
|
|
8
|
-
type: "boolean";
|
|
9
|
-
description: string;
|
|
10
|
-
};
|
|
11
|
-
ignore: {
|
|
12
|
-
type: "string";
|
|
13
|
-
description: string;
|
|
14
|
-
};
|
|
15
|
-
json: {
|
|
16
|
-
type: "boolean";
|
|
17
|
-
description: string;
|
|
18
|
-
};
|
|
19
|
-
builtins: {
|
|
20
|
-
type: "boolean";
|
|
21
|
-
description: string;
|
|
22
|
-
};
|
|
23
|
-
dev: {
|
|
24
|
-
type: "boolean";
|
|
25
|
-
description: string;
|
|
26
|
-
};
|
|
27
|
-
peer: {
|
|
28
|
-
type: "boolean";
|
|
29
|
-
description: string;
|
|
30
|
-
};
|
|
31
|
-
optional: {
|
|
32
|
-
type: "boolean";
|
|
33
|
-
description: string;
|
|
34
|
-
};
|
|
35
|
-
fix: {
|
|
36
|
-
type: "boolean";
|
|
37
|
-
description: string;
|
|
38
|
-
};
|
|
39
|
-
depth: {
|
|
40
|
-
type: "number";
|
|
41
|
-
description: string;
|
|
42
|
-
default: number;
|
|
43
|
-
};
|
|
44
|
-
}>;
|
|
45
|
-
export default _default;
|
package/bin/app/deps/cmd.js
DELETED
|
@@ -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/rules/reliverse/missing-deps/analyzer.js";
|
|
5
|
-
import { formatOutput } from "../../libs/sdk/sdk-impl/rules/reliverse/missing-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
|
-
});
|