buncargo 3.0.0 → 3.2.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/dist/cli/bin.js +10 -8
- package/dist/cli/index.js +2 -2
- package/dist/cli/run-cli.d.ts +10 -2
- package/dist/core/quick-tunnel/cloudflared-process.d.ts +10 -0
- package/dist/core/quick-tunnel/constants.d.ts +9 -0
- package/dist/core/quick-tunnel/index.d.ts +17 -0
- package/dist/core/quick-tunnel/install.d.ts +1 -0
- package/dist/core/tunnel.d.ts +3 -2
- package/dist/environment/index.js +2 -2
- package/dist/environment/logging.d.ts +6 -6
- package/dist/environment/only-apps.d.ts +10 -0
- package/dist/index-3eyrdxw9.js +577 -0
- package/dist/index-5aq985p4.js +250 -0
- package/dist/index-6cmex7m5.js +72 -0
- package/dist/index-6d6x175r.js +572 -0
- package/dist/index-7v19es2e.js +666 -0
- package/dist/index-9wyhzw0h.js +574 -0
- package/dist/index-ag90ry8t.js +576 -0
- package/dist/index-bycj26kj.js +72 -0
- package/dist/index-byeqyjrz.js +72 -0
- package/dist/index-enj4zdma.js +574 -0
- package/dist/index-k370bech.js +72 -0
- package/dist/index-mf4vjhm3.js +362 -0
- package/dist/index-n5g93an7.js +250 -0
- package/dist/index-n6z0qw70.js +666 -0
- package/dist/index-qa8akv6y.js +666 -0
- package/dist/index-vg55rq0y.js +250 -0
- package/dist/index-vs81yaks.js +244 -0
- package/dist/index-x54nbgs7.js +355 -0
- package/dist/index-yz4jfz7z.js +338 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -8
- package/dist/loader/index.js +3 -3
- package/dist/types/all-types.d.ts +46 -3
- package/package.json +147 -145
- package/readme.md +16 -0
- package/src/cli/run-cli.ts +27 -12
- package/src/core/quick-tunnel/cloudflared-process.ts +83 -0
- package/src/core/quick-tunnel/constants.ts +31 -0
- package/src/core/quick-tunnel/index.ts +96 -0
- package/src/core/quick-tunnel/install.ts +160 -0
- package/src/core/tunnel.ts +42 -16
- package/src/environment/create-dev-environment.ts +123 -13
- package/src/environment/logging.ts +34 -20
- package/src/environment/only-apps.ts +34 -0
- package/src/index.ts +3 -0
- package/src/types/all-types.ts +56 -3
|
@@ -14,6 +14,21 @@ function formatDimLabel(label: string, value: string): string {
|
|
|
14
14
|
return ` ${pc.dim("•")} ${pc.dim(label.padEnd(10))} ${pc.dim(value)}`;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
function tunnelFor(
|
|
18
|
+
tunnels:
|
|
19
|
+
| Array<{
|
|
20
|
+
kind: "service" | "app";
|
|
21
|
+
name: string;
|
|
22
|
+
publicUrl: string;
|
|
23
|
+
localUrl: string;
|
|
24
|
+
}>
|
|
25
|
+
| undefined,
|
|
26
|
+
name: string,
|
|
27
|
+
kind: "service" | "app",
|
|
28
|
+
) {
|
|
29
|
+
return tunnels?.find((t) => t.name === name && t.kind === kind);
|
|
30
|
+
}
|
|
31
|
+
|
|
17
32
|
export function logEnvironmentInfo(input: {
|
|
18
33
|
label: string;
|
|
19
34
|
projectName: string;
|
|
@@ -24,6 +39,12 @@ export function logEnvironmentInfo(input: {
|
|
|
24
39
|
worktree: boolean;
|
|
25
40
|
portOffset: number;
|
|
26
41
|
projectSuffix?: string;
|
|
42
|
+
tunnels?: Array<{
|
|
43
|
+
kind: "service" | "app";
|
|
44
|
+
name: string;
|
|
45
|
+
publicUrl: string;
|
|
46
|
+
localUrl: string;
|
|
47
|
+
}>;
|
|
27
48
|
}): void {
|
|
28
49
|
const {
|
|
29
50
|
label,
|
|
@@ -35,6 +56,7 @@ export function logEnvironmentInfo(input: {
|
|
|
35
56
|
worktree,
|
|
36
57
|
portOffset,
|
|
37
58
|
projectSuffix,
|
|
59
|
+
tunnels,
|
|
38
60
|
} = input;
|
|
39
61
|
const serviceNames = Object.keys(services);
|
|
40
62
|
const appNames = Object.keys(apps);
|
|
@@ -50,6 +72,12 @@ export function logEnvironmentInfo(input: {
|
|
|
50
72
|
const port = ports[name];
|
|
51
73
|
const url = `localhost:${port}`;
|
|
52
74
|
console.log(formatLabel(`${name}:`, formatUrl(`http://${url}`)));
|
|
75
|
+
const t = tunnelFor(tunnels, name, "service");
|
|
76
|
+
if (t) {
|
|
77
|
+
console.log(
|
|
78
|
+
` ${pc.dim("Public:")} ${formatUrl(t.publicUrl)} ${pc.dim("(tunnel)")}`,
|
|
79
|
+
);
|
|
80
|
+
}
|
|
53
81
|
}
|
|
54
82
|
}
|
|
55
83
|
|
|
@@ -64,6 +92,12 @@ export function logEnvironmentInfo(input: {
|
|
|
64
92
|
console.log(` ${pc.green("➜")} ${pc.bold(pc.cyan(name))}`);
|
|
65
93
|
console.log(` ${pc.dim("Local:")} ${formatUrl(localUrl)}`);
|
|
66
94
|
console.log(` ${pc.dim("Network:")} ${formatUrl(networkUrl)}`);
|
|
95
|
+
const t = tunnelFor(tunnels, name, "app");
|
|
96
|
+
if (t) {
|
|
97
|
+
console.log(
|
|
98
|
+
` ${pc.dim("Public:")} ${formatUrl(t.publicUrl)} ${pc.dim("(tunnel)")}`,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
67
101
|
}
|
|
68
102
|
}
|
|
69
103
|
|
|
@@ -79,23 +113,3 @@ export function logEnvironmentInfo(input: {
|
|
|
79
113
|
console.log(formatDimLabel("Local IP:", localIp));
|
|
80
114
|
console.log("");
|
|
81
115
|
}
|
|
82
|
-
|
|
83
|
-
export function logPublicUrls(
|
|
84
|
-
tunnels: Array<{
|
|
85
|
-
kind: "service" | "app";
|
|
86
|
-
name: string;
|
|
87
|
-
publicUrl: string;
|
|
88
|
-
localUrl: string;
|
|
89
|
-
}>,
|
|
90
|
-
): void {
|
|
91
|
-
if (tunnels.length === 0) return;
|
|
92
|
-
|
|
93
|
-
console.log("");
|
|
94
|
-
console.log(` ${pc.dim("─── Public URLs (Quick Tunnel) ───")}`);
|
|
95
|
-
for (const tunnel of tunnels) {
|
|
96
|
-
const label = `${tunnel.name} (${tunnel.kind})`;
|
|
97
|
-
console.log(formatLabel(`${label}:`, formatUrl(tunnel.publicUrl), "🌐"));
|
|
98
|
-
console.log(formatDimLabel("Local target:", tunnel.localUrl));
|
|
99
|
-
}
|
|
100
|
-
console.log("");
|
|
101
|
-
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AppConfig } from "../types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Ensures every name in `onlyApps` exists as a key in `apps`.
|
|
5
|
+
*/
|
|
6
|
+
export function assertOnlyAppNames(
|
|
7
|
+
appKeys: string[],
|
|
8
|
+
onlyApps: string[] | undefined,
|
|
9
|
+
): void {
|
|
10
|
+
if (onlyApps === undefined) return;
|
|
11
|
+
const unknown = onlyApps.filter((n) => !appKeys.includes(n));
|
|
12
|
+
if (unknown.length > 0) {
|
|
13
|
+
throw new Error(`Unknown app name(s) in onlyApps: ${unknown.join(", ")}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns a subset of `apps` when `onlyApps` is set; otherwise the full map.
|
|
19
|
+
* When `onlyApps` is `[]`, returns `{}`.
|
|
20
|
+
*/
|
|
21
|
+
export function pickApps<TApps extends Record<string, AppConfig>>(
|
|
22
|
+
apps: TApps,
|
|
23
|
+
onlyApps: string[] | undefined,
|
|
24
|
+
): Record<string, AppConfig> {
|
|
25
|
+
if (onlyApps === undefined) return apps;
|
|
26
|
+
const out: Record<string, AppConfig> = {};
|
|
27
|
+
for (const name of onlyApps) {
|
|
28
|
+
const config = apps[name];
|
|
29
|
+
if (config !== undefined) {
|
|
30
|
+
out[name] = config;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -65,9 +65,12 @@ export type {
|
|
|
65
65
|
HookContext,
|
|
66
66
|
// Migrations & Seed
|
|
67
67
|
MigrationConfig,
|
|
68
|
+
OpenPublicTunnelsOptions,
|
|
69
|
+
OpenPublicTunnelsResult,
|
|
68
70
|
// Prisma
|
|
69
71
|
PrismaConfig,
|
|
70
72
|
PrismaRunner,
|
|
73
|
+
PublicTunnelHandle,
|
|
71
74
|
SeedCheckContext,
|
|
72
75
|
SeedCheckHelpers,
|
|
73
76
|
SeedConfig,
|
package/src/types/all-types.ts
CHANGED
|
@@ -499,6 +499,10 @@ export interface StartOptions {
|
|
|
499
499
|
suffix?: string;
|
|
500
500
|
/** Skip automatic seeding (useful when CLI handles seeding separately). Default: false */
|
|
501
501
|
skipSeed?: boolean;
|
|
502
|
+
/** Skip the initial `logInfo` banner (CLI uses this with `--expose`, then logs once with tunnel URLs). Default: false */
|
|
503
|
+
skipEnvironmentLog?: boolean;
|
|
504
|
+
/** If set, start and wait for only these app names (must exist in `apps`). */
|
|
505
|
+
onlyApps?: string[];
|
|
502
506
|
}
|
|
503
507
|
|
|
504
508
|
/**
|
|
@@ -522,6 +526,40 @@ export interface DevServerPids {
|
|
|
522
526
|
[appName: string]: number;
|
|
523
527
|
}
|
|
524
528
|
|
|
529
|
+
/** Tunnel rows passed to `logInfo` for public URL lines (matches `PublicTunnel` without `close`) */
|
|
530
|
+
export interface DevEnvironmentTunnelLog {
|
|
531
|
+
kind: "service" | "app";
|
|
532
|
+
name: string;
|
|
533
|
+
localUrl: string;
|
|
534
|
+
publicUrl: string;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/** Active tunnel with teardown — same shape as core `PublicTunnel`. */
|
|
538
|
+
export type PublicTunnelHandle = DevEnvironmentTunnelLog & {
|
|
539
|
+
close: () => Promise<void>;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
/** Options for {@link DevEnvironment.openPublicTunnels}. */
|
|
543
|
+
export interface OpenPublicTunnelsOptions {
|
|
544
|
+
/** Subset of expose targets by name; omit for all `expose: true` services/apps. */
|
|
545
|
+
names?: string[];
|
|
546
|
+
/**
|
|
547
|
+
* Wait for these apps' HTTP health endpoints before opening tunnels.
|
|
548
|
+
* Servers must already be listening on their ports.
|
|
549
|
+
*/
|
|
550
|
+
waitForHealthy?: string[];
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** Result of {@link DevEnvironment.openPublicTunnels}. */
|
|
554
|
+
export interface OpenPublicTunnelsResult<
|
|
555
|
+
TServices extends Record<string, ServiceConfig>,
|
|
556
|
+
TApps extends Record<string, AppConfig>,
|
|
557
|
+
> {
|
|
558
|
+
publicUrls: ComputedPublicUrls<TServices, TApps>;
|
|
559
|
+
tunnels: PublicTunnelHandle[];
|
|
560
|
+
close: () => Promise<void>;
|
|
561
|
+
}
|
|
562
|
+
|
|
525
563
|
/**
|
|
526
564
|
* The main dev environment interface returned by createDevEnvironment().
|
|
527
565
|
*/
|
|
@@ -577,6 +615,8 @@ export interface DevEnvironment<
|
|
|
577
615
|
startServers(options?: {
|
|
578
616
|
productionBuild?: boolean;
|
|
579
617
|
verbose?: boolean;
|
|
618
|
+
/** If set, start and wait for only these app names (must exist in `apps`). */
|
|
619
|
+
onlyApps?: string[];
|
|
580
620
|
}): Promise<DevServerPids>;
|
|
581
621
|
/** Stop a process by PID */
|
|
582
622
|
stopProcess(pid: number): void;
|
|
@@ -584,13 +624,18 @@ export interface DevEnvironment<
|
|
|
584
624
|
waitForServers(options?: {
|
|
585
625
|
timeout?: number;
|
|
586
626
|
productionBuild?: boolean;
|
|
627
|
+
/** If set, wait only for these app names (must exist in `apps`). */
|
|
628
|
+
onlyApps?: string[];
|
|
587
629
|
}): Promise<void>;
|
|
588
630
|
|
|
589
631
|
// ─────────────────────────────────────────────────────────────────────────
|
|
590
632
|
// Utilities
|
|
591
633
|
// ─────────────────────────────────────────────────────────────────────────
|
|
592
634
|
|
|
593
|
-
/**
|
|
635
|
+
/**
|
|
636
|
+
* Build environment variables for shell commands.
|
|
637
|
+
* Call **after** {@link setPublicUrls} or {@link openPublicTunnels} so `envVars` and `*_PUBLIC_URL` reflect tunnel URLs.
|
|
638
|
+
*/
|
|
594
639
|
buildEnvVars(production?: boolean): Record<string, string>;
|
|
595
640
|
/** Set public tunnel URLs used by envVars and *_PUBLIC_URL injection */
|
|
596
641
|
setPublicUrls(urls: ComputedPublicUrls<TServices, TApps>): void;
|
|
@@ -605,8 +650,16 @@ export interface DevEnvironment<
|
|
|
605
650
|
): Promise<{ exitCode: number; stdout: string; stderr: string }>;
|
|
606
651
|
/** Wait for an HTTP server to respond */
|
|
607
652
|
waitForServer(url: string, timeout?: number): Promise<void>;
|
|
608
|
-
/** Log environment info to console */
|
|
609
|
-
logInfo(label?: string): void;
|
|
653
|
+
/** Log environment info to console; pass `tunnels` to show public URLs next to services/apps */
|
|
654
|
+
logInfo(label?: string, tunnels?: DevEnvironmentTunnelLog[]): void;
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Resolve expose targets, start public quick tunnels, and apply {@link setPublicUrls}.
|
|
658
|
+
* Call {@link buildEnvVars} after this resolves when spawning processes that need `EXPO_PUBLIC_*` / `*_PUBLIC_URL`.
|
|
659
|
+
*/
|
|
660
|
+
openPublicTunnels(
|
|
661
|
+
options?: OpenPublicTunnelsOptions,
|
|
662
|
+
): Promise<OpenPublicTunnelsResult<TServices, TApps>>;
|
|
610
663
|
|
|
611
664
|
// ─────────────────────────────────────────────────────────────────────────
|
|
612
665
|
// Vibe Kanban Integration
|