@corsair-dev/cli 0.1.21 → 0.1.23
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/index.js +47 -17
- package/dist/src/commands/http.command.d.ts.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/utils/format-cli-error.d.ts +2 -0
- package/dist/src/utils/format-cli-error.d.ts.map +1 -0
- package/dist/src/utils/run-cli.d.ts +6 -0
- package/dist/src/utils/run-cli.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2486,7 +2486,7 @@ import { fileURLToPath } from "url";
|
|
|
2486
2486
|
import { Command } from "commander";
|
|
2487
2487
|
|
|
2488
2488
|
// package.json
|
|
2489
|
-
var version = "0.1.
|
|
2489
|
+
var version = "0.1.23";
|
|
2490
2490
|
|
|
2491
2491
|
// src/utils/subscription.ts
|
|
2492
2492
|
async function runWebhookSubscription(cwd, pluginId) {
|
|
@@ -2711,21 +2711,27 @@ var HttpCommand = class extends BaseCommand {
|
|
|
2711
2711
|
}
|
|
2712
2712
|
console.log(`[corsair]: Opening dev tunnel \u2192 localhost:${port} ...`);
|
|
2713
2713
|
let stop;
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2714
|
+
for (let attempt = 1; ; attempt++) {
|
|
2715
|
+
try {
|
|
2716
|
+
const result = await runTunnel({
|
|
2717
|
+
port,
|
|
2718
|
+
apiUrl: hub.apiUrl,
|
|
2719
|
+
apiKey: hub.projectApiKey,
|
|
2720
|
+
shareHost: process.env.CORSAIR_FRP_HOST
|
|
2721
|
+
});
|
|
2722
|
+
stop = result.stop;
|
|
2723
|
+
console.log(corsairBanner(`${result.url}${CORSAIR_TUNNEL_PATH}`));
|
|
2724
|
+
console.log(" Press Ctrl+C to stop.\n");
|
|
2725
|
+
break;
|
|
2726
|
+
} catch (err) {
|
|
2727
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2728
|
+
if (/already exists|still held/i.test(message) && attempt < 3) {
|
|
2729
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
2730
|
+
continue;
|
|
2731
|
+
}
|
|
2732
|
+
console.error(`[corsair]: Tunnel failed \u2014 ${message}`);
|
|
2733
|
+
process.exit(1);
|
|
2734
|
+
}
|
|
2729
2735
|
}
|
|
2730
2736
|
await new Promise((resolve) => {
|
|
2731
2737
|
const shutdown = () => {
|
|
@@ -3266,6 +3272,27 @@ var WatchRenewCommand = class extends BaseCommand {
|
|
|
3266
3272
|
|
|
3267
3273
|
// src/index.ts
|
|
3268
3274
|
init_corsair_instance();
|
|
3275
|
+
|
|
3276
|
+
// src/utils/format-cli-error.ts
|
|
3277
|
+
var CLI_ERROR_PREFIX = "[#corsair]:";
|
|
3278
|
+
function formatCliError(err) {
|
|
3279
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
3280
|
+
const collapsed = raw.replace(/\s*[\r\n]+\s*/g, " ").trim();
|
|
3281
|
+
const body = collapsed.replace(/^\[#corsair\]:\s*/i, "").trim();
|
|
3282
|
+
return `${CLI_ERROR_PREFIX} ${body}`;
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
// src/utils/run-cli.ts
|
|
3286
|
+
async function runCli(input) {
|
|
3287
|
+
try {
|
|
3288
|
+
await input.program.parseAsync(input.argv);
|
|
3289
|
+
} catch (err) {
|
|
3290
|
+
console.error(formatCliError(err));
|
|
3291
|
+
process.exit(1);
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
// src/index.ts
|
|
3269
3296
|
function createProgram() {
|
|
3270
3297
|
const program = new Command();
|
|
3271
3298
|
program.name("corsair");
|
|
@@ -3309,7 +3336,10 @@ function detectIsMainModule() {
|
|
|
3309
3336
|
}
|
|
3310
3337
|
}
|
|
3311
3338
|
if (detectIsMainModule()) {
|
|
3312
|
-
|
|
3339
|
+
void runCli({
|
|
3340
|
+
program: createProgram(),
|
|
3341
|
+
argv: normalizeLegacyArgs(process.argv)
|
|
3342
|
+
});
|
|
3313
3343
|
}
|
|
3314
3344
|
export {
|
|
3315
3345
|
createProgram,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.command.d.ts","sourceRoot":"","sources":["../../../src/commands/http.command.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGzE,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW;IACnD,OAAO,IAAI,MAAM;IAIjB,cAAc,IAAI,MAAM;IAIxB,YAAY,IAAI,eAAe,EAAE;IAS3B,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"http.command.d.ts","sourceRoot":"","sources":["../../../src/commands/http.command.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGzE,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW;IACnD,OAAO,IAAI,MAAM;IAIjB,cAAc,IAAI,MAAM;IAIxB,YAAY,IAAI,eAAe,EAAE;IAS3B,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAoExD"}
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,OAAO,EACN,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,OAAO,EACN,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,0BAA0B,CAAC;AAGlC,iBAAS,aAAa,IAAI,OAAO,CA0BhC;AA8BD,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-cli-error.d.ts","sourceRoot":"","sources":["../../../src/utils/format-cli-error.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAKnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-cli.d.ts","sourceRoot":"","sources":["../../../src/utils/run-cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAsB,MAAM,CAAC,KAAK,EAAE;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;CACf,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corsair-dev/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "Command-line tool for Corsair, the open-source integration layer. Scaffold a project, add integrations, and run your app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"c12": "^3.3.3",
|
|
25
25
|
"commander": "^14.0.3",
|
|
26
26
|
"zod": "^4.1.13",
|
|
27
|
-
"corsair": "0.1.
|
|
27
|
+
"corsair": "0.1.133"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/jest": "^29.5.14",
|