Skip to content

Commit

Permalink
fix: create d1 dir on wrangler d1 execute command with --yes/-y option (
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz authored Jan 26, 2023
1 parent 9778b33 commit 04d8a31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-suns-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix d1 directory not being created when running the `wrangler d1 execute` command with the `--yes`/`-y` flag
8 changes: 4 additions & 4 deletions packages/wrangler/src/d1/execute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ async function executeLocally(
logger.log
);

if (!existsSync(dbDir) && shouldPrompt) {
const ok = await confirm(
`About to create ${readableRelative(dbPath)}, ok?`
);
if (!existsSync(dbDir)) {
const ok =
!shouldPrompt ||
(await confirm(`About to create ${readableRelative(dbPath)}, ok?`));
if (!ok) return null;
await mkdir(dbDir, { recursive: true });
}
Expand Down

0 comments on commit 04d8a31

Please sign in to comment.