@reliverse/rempts 1.7.45 → 1.7.46
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/dist-npm/bin/mod.mjs +79 -5
- package/package.json +7 -9
package/dist-npm/bin/mod.mjs
CHANGED
|
@@ -3119,17 +3119,77 @@ const jiti = createJiti(import.meta.url, {
|
|
|
3119
3119
|
});
|
|
3120
3120
|
const COMMAND_EXTENSIONS = [".ts", ".js"];
|
|
3121
3121
|
const COMMAND_FILENAMES = ["cmd.ts", "cmd.js"];
|
|
3122
|
-
const getCallerDirectory = () => {
|
|
3122
|
+
const getCallerDirectory = async () => {
|
|
3123
3123
|
const stack = new Error().stack?.split("\n") ?? [];
|
|
3124
|
+
const cwd = process$1.cwd();
|
|
3125
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
3126
|
+
relinka("verbose", "Stack trace for getCallerDirectory:");
|
|
3127
|
+
stack.forEach((line, index) => {
|
|
3128
|
+
relinka("verbose", ` [${index}]: ${line.trim()}`);
|
|
3129
|
+
});
|
|
3130
|
+
}
|
|
3124
3131
|
for (const line of stack) {
|
|
3125
3132
|
const match = /\((.*):(\d+):(\d+)\)/.exec(line) || /at (.*):(\d+):(\d+)/.exec(line);
|
|
3126
3133
|
if (match?.[1]) {
|
|
3127
3134
|
const filePath = match[1];
|
|
3128
|
-
if (
|
|
3129
|
-
|
|
3135
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
3136
|
+
relinka("verbose", `Checking file path: ${filePath}`);
|
|
3137
|
+
}
|
|
3138
|
+
if (!filePath.includes("node_modules") && !filePath.includes("command-runner") && !filePath.includes("command-typed") && !filePath.includes("launcher-mod") && !filePath.includes("launcher-types") && !filePath.includes("mod.mjs") && // Skip compiled output
|
|
3139
|
+
!filePath.includes("mod.js") && // Skip compiled output
|
|
3140
|
+
!filePath.includes("mod.ts")) {
|
|
3141
|
+
try {
|
|
3142
|
+
const fileDir = dirname(filePath);
|
|
3143
|
+
const resolvedFileDir = resolve(fileDir);
|
|
3144
|
+
const resolvedCwd = resolve(cwd);
|
|
3145
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
3146
|
+
relinka(
|
|
3147
|
+
"verbose",
|
|
3148
|
+
`File dir: ${fileDir}, resolved: ${resolvedFileDir}, cwd: ${resolvedCwd}`
|
|
3149
|
+
);
|
|
3150
|
+
}
|
|
3151
|
+
if (resolvedFileDir !== resolvedCwd && !resolvedFileDir.startsWith(resolvedCwd)) {
|
|
3152
|
+
relinka("verbose", `Using caller directory: ${fileDir}`);
|
|
3153
|
+
return fileDir;
|
|
3154
|
+
}
|
|
3155
|
+
} catch {
|
|
3156
|
+
continue;
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
let currentDir = cwd;
|
|
3162
|
+
while (currentDir !== dirname(currentDir)) {
|
|
3163
|
+
try {
|
|
3164
|
+
const packageJsonPath = resolve(currentDir, "package.json");
|
|
3165
|
+
if (await fs.pathExists(packageJsonPath)) {
|
|
3166
|
+
relinka("verbose", `Found package.json at: ${currentDir}`);
|
|
3167
|
+
return currentDir;
|
|
3168
|
+
}
|
|
3169
|
+
} catch {
|
|
3170
|
+
}
|
|
3171
|
+
currentDir = dirname(currentDir);
|
|
3172
|
+
}
|
|
3173
|
+
try {
|
|
3174
|
+
const possibleCommandPaths = [
|
|
3175
|
+
resolve(cwd, "src", "build", "cmd.ts"),
|
|
3176
|
+
resolve(cwd, "src", "build", "cmd.js"),
|
|
3177
|
+
resolve(cwd, "src-ts", "build", "cmd.ts"),
|
|
3178
|
+
resolve(cwd, "src-ts", "build", "cmd.js"),
|
|
3179
|
+
resolve(cwd, "build", "cmd.ts"),
|
|
3180
|
+
resolve(cwd, "build", "cmd.js"),
|
|
3181
|
+
resolve(cwd, "app", "build", "cmd.ts"),
|
|
3182
|
+
resolve(cwd, "app", "build", "cmd.js")
|
|
3183
|
+
];
|
|
3184
|
+
for (const path of possibleCommandPaths) {
|
|
3185
|
+
if (await fs.pathExists(path)) {
|
|
3186
|
+
relinka("verbose", `Found command file at: ${path}, using cwd: ${cwd}`);
|
|
3187
|
+
return cwd;
|
|
3130
3188
|
}
|
|
3131
3189
|
}
|
|
3190
|
+
} catch {
|
|
3132
3191
|
}
|
|
3192
|
+
relinka("verbose", `No suitable caller found, using cwd: ${cwd}`);
|
|
3133
3193
|
return process$1.cwd();
|
|
3134
3194
|
};
|
|
3135
3195
|
const tryLoadCommand = async (path) => {
|
|
@@ -3172,13 +3232,27 @@ Original error: ${originalError instanceof Error ? originalError.message : Strin
|
|
|
3172
3232
|
);
|
|
3173
3233
|
async function loadCommand(cmdPath) {
|
|
3174
3234
|
try {
|
|
3175
|
-
const callerDir = getCallerDirectory();
|
|
3235
|
+
const callerDir = await getCallerDirectory();
|
|
3176
3236
|
const normalizedPath = cmdPath.replace(/^\.\//, "");
|
|
3177
3237
|
const resolvedPath = resolve(callerDir, normalizedPath);
|
|
3238
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
3239
|
+
relinka("verbose", `Loading command: ${cmdPath}`);
|
|
3240
|
+
relinka("verbose", `Caller directory: ${callerDir}`);
|
|
3241
|
+
relinka("verbose", `Normalized path: ${normalizedPath}`);
|
|
3242
|
+
relinka("verbose", `Resolved path: ${resolvedPath}`);
|
|
3243
|
+
}
|
|
3178
3244
|
const candidatePaths = await generateCandidatePaths(resolvedPath);
|
|
3245
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
3246
|
+
relinka("verbose", `Candidate paths: ${candidatePaths.join(", ")}`);
|
|
3247
|
+
}
|
|
3179
3248
|
for (const path of candidatePaths) {
|
|
3180
3249
|
const command = await tryLoadCommand(path);
|
|
3181
|
-
if (command)
|
|
3250
|
+
if (command) {
|
|
3251
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
3252
|
+
relinka("verbose", `Successfully loaded command from: ${path}`);
|
|
3253
|
+
}
|
|
3254
|
+
return command;
|
|
3255
|
+
}
|
|
3182
3256
|
}
|
|
3183
3257
|
throw createCommandNotFoundError(cmdPath, candidatePaths);
|
|
3184
3258
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reliverse/rempts",
|
|
3
3
|
"author": "reliverse",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.46",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "./dist-npm/bin/mod.mjs",
|
|
@@ -36,16 +36,14 @@
|
|
|
36
36
|
],
|
|
37
37
|
"description": "@reliverse/rempts is a modern, type-safe toolkit for building delightful cli experiences. it's fast, flexible, and made for developer happiness. file-based commands keep things simple.",
|
|
38
38
|
"scripts": {
|
|
39
|
-
"
|
|
40
|
-
"prepack": "unbuild",
|
|
41
|
-
"pub": "bun run build && bun publish",
|
|
39
|
+
"pub": "bun unbuild && bun publish",
|
|
42
40
|
"dev": "node -e 'console.log(`👉 bun dev:[prompts,modern,classic]`)'",
|
|
43
41
|
"dev:prompts": "bun example/prompts/mod.ts",
|
|
44
42
|
"dev:modern": "bun example/launcher/modern.ts",
|
|
45
43
|
"dev:classic": "bun example/launcher/classic.ts",
|
|
46
44
|
"dev:trpc": "bun example/trpc-orpc/commander/main.ts",
|
|
47
45
|
"latest": "bun update --latest && bun check",
|
|
48
|
-
"check": "tsc --noEmit && biome check --fix --unsafe
|
|
46
|
+
"check": "tsc --noEmit && biome check --fix --unsafe",
|
|
49
47
|
"agg": "rse tools --tool agg --input src/libs/core/core-impl --out src/libs/core/core-main.ts --recursive --named --strip src/libs/core",
|
|
50
48
|
"tests": "bun test ./.tests"
|
|
51
49
|
},
|
|
@@ -56,7 +54,7 @@
|
|
|
56
54
|
"@orpc/server": "^1.8.3",
|
|
57
55
|
"@reliverse/pathkit": "^1.3.4",
|
|
58
56
|
"@reliverse/reliarg": "^1.0.3",
|
|
59
|
-
"@reliverse/relico": "^1.3.
|
|
57
|
+
"@reliverse/relico": "^1.3.5",
|
|
60
58
|
"@reliverse/relifso": "^1.4.5",
|
|
61
59
|
"@reliverse/relinka": "^1.5.5",
|
|
62
60
|
"@reliverse/runtime": "^1.0.3",
|
|
@@ -67,7 +65,7 @@
|
|
|
67
65
|
"cli-spinners": "^3.2.0",
|
|
68
66
|
"commander": "^14.0.0",
|
|
69
67
|
"detect-package-manager": "^3.0.2",
|
|
70
|
-
"effect": "^3.17.
|
|
68
|
+
"effect": "^3.17.9",
|
|
71
69
|
"enquirer": "^2.4.1",
|
|
72
70
|
"figlet": "^1.8.2",
|
|
73
71
|
"gradient-string": "^3.0.0",
|
|
@@ -91,9 +89,9 @@
|
|
|
91
89
|
"zod-to-json-schema": "^3.24.6"
|
|
92
90
|
},
|
|
93
91
|
"devDependencies": {
|
|
94
|
-
"@biomejs/biome": "2.2.0",
|
|
92
|
+
"@biomejs/biome": "^2.2.0",
|
|
95
93
|
"@orpc/contract": "^1.8.3",
|
|
96
|
-
"@reliverse/dler": "1.7.
|
|
94
|
+
"@reliverse/dler": "1.7.96",
|
|
97
95
|
"@reliverse/rse": "^1.7.12",
|
|
98
96
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
99
97
|
"@types/bun": "^1.2.20",
|