buncargo 3.0.0 → 3.2.0

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.
Files changed (43) hide show
  1. package/dist/cli/bin.js +10 -8
  2. package/dist/cli/index.js +2 -2
  3. package/dist/cli/run-cli.d.ts +10 -2
  4. package/dist/core/quick-tunnel/cloudflared-process.d.ts +10 -0
  5. package/dist/core/quick-tunnel/constants.d.ts +9 -0
  6. package/dist/core/quick-tunnel/index.d.ts +17 -0
  7. package/dist/core/quick-tunnel/install.d.ts +1 -0
  8. package/dist/core/tunnel.d.ts +3 -2
  9. package/dist/environment/index.js +2 -2
  10. package/dist/environment/logging.d.ts +6 -6
  11. package/dist/environment/only-apps.d.ts +10 -0
  12. package/dist/index-3eyrdxw9.js +577 -0
  13. package/dist/index-5aq985p4.js +250 -0
  14. package/dist/index-6cmex7m5.js +72 -0
  15. package/dist/index-6d6x175r.js +572 -0
  16. package/dist/index-7v19es2e.js +666 -0
  17. package/dist/index-9wyhzw0h.js +574 -0
  18. package/dist/index-ag90ry8t.js +576 -0
  19. package/dist/index-byeqyjrz.js +72 -0
  20. package/dist/index-enj4zdma.js +574 -0
  21. package/dist/index-k370bech.js +72 -0
  22. package/dist/index-qa8akv6y.js +666 -0
  23. package/dist/index-vg55rq0y.js +250 -0
  24. package/dist/index-vs81yaks.js +244 -0
  25. package/dist/index-x54nbgs7.js +355 -0
  26. package/dist/index-yz4jfz7z.js +338 -0
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +9 -8
  29. package/dist/loader/index.js +3 -3
  30. package/dist/types/all-types.d.ts +46 -3
  31. package/package.json +147 -145
  32. package/readme.md +16 -0
  33. package/src/cli/run-cli.ts +27 -12
  34. package/src/core/quick-tunnel/cloudflared-process.ts +83 -0
  35. package/src/core/quick-tunnel/constants.ts +31 -0
  36. package/src/core/quick-tunnel/index.ts +96 -0
  37. package/src/core/quick-tunnel/install.ts +160 -0
  38. package/src/core/tunnel.ts +22 -8
  39. package/src/environment/create-dev-environment.ts +123 -13
  40. package/src/environment/logging.ts +34 -20
  41. package/src/environment/only-apps.ts +34 -0
  42. package/src/index.ts +3 -0
  43. package/src/types/all-types.ts +56 -3
@@ -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,
@@ -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
- /** Build environment variables for shell commands */
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