Skip to content

Commit 6d87da3

Browse files
committed
🤖 refactor: rename CMUX_TEST_ROOT to CMUX_ROOT, remove mandatory -dev suffix
Instead of automatically appending '-dev' suffix based on NODE_ENV, let developers explicitly control the data directory via CMUX_ROOT environment variable. This restores the old behavior where devs decide when to switch roots. Changes: - Renamed CMUX_TEST_ROOT to CMUX_ROOT in all files - Removed NODE_ENV=development from 'make start' target - Removed automatic -dev suffix logic from getCmuxHome() - Simplified paths.ts back to simple env var override _Generated with `cmux`_
1 parent 43bce08 commit 6d87da3

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ dev-server: node_modules/.installed build-main ## Start server mode with hot rel
115115

116116

117117
start: node_modules/.installed build-main build-preload build-static ## Build and start Electron app
118-
@NODE_ENV=development bun x electron --remote-debugging-port=9222 .
118+
@bun x electron --remote-debugging-port=9222 .
119119

120120
## Build targets (can run in parallel)
121121
build: node_modules/.installed src/version.ts build-renderer build-main build-preload build-icons build-static ## Build all targets

‎src/constants/paths.ts‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { join } from "path";
33

44
/**
55
* Get the root directory for all cmux configuration and data.
6-
* Can be overridden with CMUX_TEST_ROOT environment variable.
7-
* Appends '-dev' suffix when NODE_ENV=development (explicit dev mode).
6+
* Can be overridden with CMUX_ROOT environment variable.
87
*
98
* This is a getter function to support test mocking of os.homedir().
109
*
@@ -13,16 +12,7 @@ import { join } from "path";
1312
*/
1413
export function getCmuxHome(): string {
1514
// eslint-disable-next-line no-restricted-syntax, no-restricted-globals
16-
if (process.env.CMUX_TEST_ROOT) {
17-
// eslint-disable-next-line no-restricted-syntax, no-restricted-globals
18-
return process.env.CMUX_TEST_ROOT;
19-
}
20-
21-
const baseName = ".cmux";
22-
// Use -dev suffix only when explicitly in development mode
23-
// eslint-disable-next-line no-restricted-syntax, no-restricted-globals
24-
const suffix = process.env.NODE_ENV === "development" ? "-dev" : "";
25-
return join(homedir(), baseName + suffix);
15+
return process.env.CMUX_ROOT ?? join(homedir(), ".cmux");
2616
}
2717

2818
/**

‎src/main-desktop.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const forceDistLoad = process.env.CMUX_E2E_LOAD_DIST === "1";
7575

7676
if (isE2ETest) {
7777
// For e2e tests, use a test-specific userData directory
78-
// Note: getCmuxHome() already respects CMUX_TEST_ROOT for test isolation
78+
// Note: getCmuxHome() already respects CMUX_ROOT for test isolation
7979
const e2eUserData = path.join(getCmuxHome(), "user-data");
8080
try {
8181
fs.mkdirSync(e2eUserData, { recursive: true });

‎tests/e2e/electronTest.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function buildTarget(target: string): void {
8888

8989
export const electronTest = base.extend<ElectronFixtures>({
9090
workspace: async ({}, use, testInfo) => {
91-
const envRoot = process.env.CMUX_TEST_ROOT ?? "";
91+
const envRoot = process.env.CMUX_ROOT ?? "";
9292
const baseRoot = envRoot || defaultTestRoot;
9393
const uniqueTestId = testInfo.testId || testInfo.title || `test-${Date.now()}`;
9494
const testRoot = envRoot ? baseRoot : path.join(baseRoot, sanitizeForPath(uniqueTestId));
@@ -195,7 +195,7 @@ export const electronTest = base.extend<ElectronFixtures>({
195195
}
196196
electronEnv.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
197197
electronEnv.CMUX_MOCK_AI = electronEnv.CMUX_MOCK_AI ?? "1";
198-
electronEnv.CMUX_TEST_ROOT = configRoot;
198+
electronEnv.CMUX_ROOT = configRoot;
199199
electronEnv.CMUX_E2E = "1";
200200
electronEnv.CMUX_E2E_LOAD_DIST = shouldLoadDist ? "1" : "0";
201201
electronEnv.VITE_DISABLE_MERMAID = "1";

0 commit comments

Comments
 (0)