Skip to content

Commit

Permalink
fix(dev-cli): Call mkdir before attempting to write the config file (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
BRKalow authored Jul 24, 2024
1 parent d65a94c commit 87bb639
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-pillows-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/dev-cli": patch
---

Fix a bug where `clerk-dev init` would error if the config directory did not already exist.
6 changes: 4 additions & 2 deletions packages/dev-cli/src/commands/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { spawn } from 'node:child_process';
import { writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import { mkdir, writeFile } from 'node:fs/promises';
import { dirname, join } from 'node:path';

import { CONFIG_FILE } from '../utils/getConfiguration.js';
import { getCLIRoot } from '../utils/getMonorepoRoot.js';
Expand All @@ -26,6 +26,8 @@ export async function init() {
},
};

await mkdir(dirname(CONFIG_FILE), { recursive: true });

await writeFile(CONFIG_FILE, JSON.stringify(configuration, null, 2), 'utf-8');

if (process.env.VISUAL) {
Expand Down

0 comments on commit 87bb639

Please sign in to comment.