Skip to content

Commit c6f8096

Browse files
CarlosZieglerclaude
andcommitted
fix(cli): use path.join for remaining cross-platform path issues
Replace string-concatenated paths with path.join in state.ts and theme-apply.ts for Windows compatibility. Fix exec cwd test to resolve symlinks (macOS /var -> /private/var). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ec4af1d commit c6f8096

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

packages/cli/src/lib/__tests__/helpers.exec.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mkdtempSync, rmSync } from "node:fs";
1+
import { mkdtempSync, realpathSync, rmSync } from "node:fs";
22
import { tmpdir } from "node:os";
33
import { join } from "node:path";
44
import { afterEach, describe, expect, it } from "bun:test";
@@ -22,7 +22,9 @@ describe("exec", () => {
2222
});
2323

2424
it("respects cwd", async () => {
25-
const cwd = mkdtempSync(join(tmpdir(), "create-start-kit-dev-"));
25+
const cwd = realpathSync(
26+
mkdtempSync(join(tmpdir(), "create-start-kit-dev-"))
27+
);
2628
tempDirs.push(cwd);
2729

2830
const result = await exec(

packages/cli/src/lib/state.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { existsSync, readFileSync } from "node:fs";
2+
import { join } from "node:path";
23

34
const STATE_FILE = ".setup-state.json";
45

@@ -39,7 +40,7 @@ const DEFAULT_STATE: SetupState = {
3940
};
4041

4142
function getStatePath(): string {
42-
return `${process.cwd()}/${STATE_FILE}`;
43+
return join(process.cwd(), STATE_FILE);
4344
}
4445

4546
export function loadState(): SetupState {

packages/cli/src/theme/theme-apply.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { writeFileSync } from "node:fs";
2+
import { join } from "node:path";
23
import { log, spinner } from "@clack/prompts";
34
import type {
45
BaseColorName,
@@ -82,7 +83,7 @@ export function applyTheme(targetDir: string, config: ThemeConfig): void {
8283
s.start("Applying theme...");
8384

8485
const css = generateFullAppCss(config);
85-
writeFileSync(`${targetDir}/src/app.css`, css, "utf-8");
86+
writeFileSync(join(targetDir, "src", "app.css"), css, "utf-8");
8687

8788
s.stop(
8889
`Theme applied: ${config.theme} (base: ${config.baseColor}, radius: ${config.radius}, font: ${config.font})`

0 commit comments

Comments
 (0)