@base44-preview/cli 0.0.18-pr.115.067f570 → 0.0.18-pr.87.0e26e0f
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/bin/dev.js +20 -2
- package/bin/run.js +20 -2
- package/dist/index.js +8775 -8580
- package/package.json +1 -1
package/bin/dev.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
|
-
import {
|
|
2
|
+
import { CommanderError } from "commander";
|
|
3
|
+
import { program, CLIExitError, isJsonMode, outputJsonError } from "../src/cli/index.ts";
|
|
3
4
|
|
|
4
5
|
try {
|
|
5
6
|
await program.parseAsync();
|
|
@@ -7,6 +8,23 @@ try {
|
|
|
7
8
|
if (error instanceof CLIExitError) {
|
|
8
9
|
process.exit(error.code);
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
if (error instanceof CommanderError) {
|
|
13
|
+
if (isJsonMode()) {
|
|
14
|
+
outputJsonError(error.message, error.code);
|
|
15
|
+
}
|
|
16
|
+
// Non-JSON mode: Commander already output the error via configureOutput
|
|
17
|
+
process.exit(error.exitCode);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Handle all other errors
|
|
21
|
+
if (isJsonMode()) {
|
|
22
|
+
outputJsonError(error instanceof Error ? error : String(error));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Non-JSON mode: show clean error message
|
|
27
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
28
|
+
console.error(`error: ${message}`);
|
|
11
29
|
process.exit(1);
|
|
12
30
|
}
|
package/bin/run.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { CommanderError } from "commander";
|
|
3
|
+
import { program, CLIExitError, isJsonMode, outputJsonError } from "../dist/index.js";
|
|
3
4
|
|
|
4
5
|
try {
|
|
5
6
|
await program.parseAsync();
|
|
@@ -7,6 +8,23 @@ try {
|
|
|
7
8
|
if (error instanceof CLIExitError) {
|
|
8
9
|
process.exit(error.code);
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
if (error instanceof CommanderError) {
|
|
13
|
+
if (isJsonMode()) {
|
|
14
|
+
outputJsonError(error.message, error.code);
|
|
15
|
+
}
|
|
16
|
+
// Non-JSON mode: Commander already output the error via configureOutput
|
|
17
|
+
process.exit(error.exitCode);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Handle all other errors
|
|
21
|
+
if (isJsonMode()) {
|
|
22
|
+
outputJsonError(error instanceof Error ? error : String(error));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Non-JSON mode: show clean error message
|
|
27
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
28
|
+
console.error(`error: ${message}`);
|
|
11
29
|
process.exit(1);
|
|
12
30
|
}
|