@teardown/cli 2.0.75 → 2.0.76

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teardown/cli",
3
- "version": "2.0.75",
3
+ "version": "2.0.76",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@biomejs/biome": "2.3.11",
79
- "@teardown/tsconfig": "2.0.75",
79
+ "@teardown/tsconfig": "2.0.76",
80
80
  "@types/bun": "1.3.5",
81
81
  "@types/ejs": "^3.1.5",
82
82
  "typescript": "5.9.3"
@@ -6,7 +6,7 @@ import { existsSync } from "node:fs";
6
6
  import { join, resolve } from "node:path";
7
7
  import chalk from "chalk";
8
8
  import { Command } from "commander";
9
- import { attachBundlerToForeground, startBundlerBackground } from "../../utils/bundler";
9
+ import { startBundlerBackground } from "../../utils/bundler";
10
10
  import { getNavigationConfig } from "../../utils/metro-config";
11
11
 
12
12
  /**
@@ -86,23 +86,18 @@ export function createDevCommand(): Command {
86
86
 
87
87
  console.log(chalk.blue("Starting Metro bundler...\n"));
88
88
 
89
- const metroProcess = startBundlerBackground({
89
+ // Start Metro with interactive mode enabled - inherits stdio directly
90
+ // so Metro receives the TTY and keyboard shortcuts (r, j, d) work
91
+ startBundlerBackground({
90
92
  port: options.port,
91
93
  resetCache: options.resetCache,
92
94
  verbose: options.verbose,
93
95
  cwd: projectRoot,
96
+ interactive: true,
94
97
  });
95
98
 
96
- // Handle cleanup on SIGINT/SIGTERM
97
- const cleanup = () => {
98
- metroProcess.kill("SIGTERM");
99
- process.exit(0);
100
- };
101
- process.on("SIGINT", cleanup);
102
- process.on("SIGTERM", cleanup);
103
-
104
- // Attach to foreground with interactive input (r, j, d, etc.)
105
- attachBundlerToForeground(metroProcess);
99
+ // With inherited stdio, the process handles its own signals
100
+ // We just need to keep the parent process alive
106
101
  });
107
102
 
108
103
  return dev;
@@ -409,10 +409,13 @@ async function startMetroAndWait(port: string, _platform: "ios" | "android"): Pr
409
409
 
410
410
  console.log(chalk.blue(`\nStarting Metro bundler on port ${port}...`));
411
411
 
412
+ // Start bundler in non-interactive mode (CI=true suppresses warning)
413
+ // We'll attach to foreground later after build completes
412
414
  const metroProcess = startBundlerBackground({
413
415
  port,
414
416
  resetCache: true,
415
417
  cwd: process.cwd(),
418
+ interactive: false,
416
419
  });
417
420
 
418
421
  // Wait for bundler to be ready with progress updates
@@ -47,6 +47,8 @@ export interface StartBundlerOptions {
47
47
  cwd?: string;
48
48
  /** Whether to enable verbose logging */
49
49
  verbose?: boolean;
50
+ /** Whether to run in interactive mode (inherit TTY for keyboard shortcuts) */
51
+ interactive?: boolean;
50
52
  }
51
53
 
52
54
  /**
@@ -70,7 +72,13 @@ export interface StartBundlerOptions {
70
72
  * ```
71
73
  */
72
74
  export function startBundlerBackground(options: StartBundlerOptions = {}): ChildProcess {
73
- const { port = DEFAULT_BUNDLER_PORT, resetCache = false, cwd = process.cwd(), verbose = false } = options;
75
+ const {
76
+ port = DEFAULT_BUNDLER_PORT,
77
+ resetCache = false,
78
+ cwd = process.cwd(),
79
+ verbose = false,
80
+ interactive = false,
81
+ } = options;
74
82
 
75
83
  const args = ["react-native", "start", "--port", String(port)];
76
84
 
@@ -82,17 +90,27 @@ export function startBundlerBackground(options: StartBundlerOptions = {}): Child
82
90
  args.push("--verbose");
83
91
  }
84
92
 
93
+ // Build environment variables
94
+ const env: NodeJS.ProcessEnv = {
95
+ ...process.env,
96
+ LANG: "en_US.UTF-8",
97
+ // Force colors in Metro output
98
+ FORCE_COLOR: "1",
99
+ };
100
+
101
+ // When not interactive, set CI=true to suppress "Interactive mode is not supported" warning
102
+ if (!interactive) {
103
+ env.CI = "true";
104
+ }
105
+
85
106
  const proc = spawn("npx", args, {
86
107
  cwd,
87
108
  shell: true,
88
- stdio: ["pipe", "pipe", "pipe"],
109
+ // When interactive, inherit stdio to pass TTY directly to Metro for keyboard shortcuts
110
+ // When not interactive, use pipes so we can capture output and attach later
111
+ stdio: interactive ? "inherit" : ["pipe", "pipe", "pipe"],
89
112
  detached: false,
90
- env: {
91
- ...process.env,
92
- LANG: "en_US.UTF-8",
93
- // Force colors in Metro output
94
- FORCE_COLOR: "1",
95
- },
113
+ env,
96
114
  });
97
115
 
98
116
  // Handle process errors
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  import { createTeardownRouter } from "@teardown/navigation";
9
+ import { defaultPrefixes, generatedLinkingConfig } from "../../.teardown/linking.generated";
9
10
  import { routeTree } from "../../.teardown/routeTree.generated";
10
- import { generatedLinkingConfig, defaultPrefixes } from "../../.teardown/linking.generated";
11
11
 
12
12
  /**
13
13
  * Theme colors for navigation styling