Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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/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 });

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should resolve successfully if it already exists for some reason:

Calling fsPromises.mkdir() when path is a directory that exists results in a rejection only when recursive is false.


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

if (process.env.VISUAL) {
Expand Down