Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/c3-mkdir-drive-root.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-cloudflare": patch
---

Skip `mkdir` when the project parent directory already exists, so `create-cloudflare` works at a Windows drive root (`E:\`) instead of throwing `EPERM`.
8 changes: 5 additions & 3 deletions packages/create-cloudflare/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
import { mkdirSync } from "node:fs";
import { existsSync, mkdirSync } from "node:fs";
import { dirname } from "node:path";
import { chdir } from "node:process";
import {
Expand Down Expand Up @@ -125,8 +125,10 @@ export const setupProjectDirectory = (ctx: C3Context) => {

const directory = dirname(path);

// If the target is a nested directory, create the parent
mkdirSync(directory, { recursive: true });
// Creating a Windows drive root (`E:\`) throws EPERM. Skip if it already exists.
if (!existsSync(directory)) {
mkdirSync(directory, { recursive: true });
}

// Change to the parent directory
chdir(directory);
Expand Down
Loading