diff --git a/.changeset/fresh-baboons-spend.md b/.changeset/fresh-baboons-spend.md new file mode 100644 index 00000000000..36e18dded30 --- /dev/null +++ b/.changeset/fresh-baboons-spend.md @@ -0,0 +1,5 @@ +--- +'@clerk/dev-cli': patch +--- + +Improve reliability by cleaning the turborepo daemon before starting watch task. diff --git a/.gitignore b/.gitignore index dd5f9738fb7..e9d7d2a7636 100644 --- a/.gitignore +++ b/.gitignore @@ -99,3 +99,4 @@ scripts/.env # typedoc .typedoc/docs .typedoc/docs.json +tsup.config.bundled_* diff --git a/packages/dev-cli/src/commands/watch.js b/packages/dev-cli/src/commands/watch.js index 0770f9ae081..60f30f8713d 100644 --- a/packages/dev-cli/src/commands/watch.js +++ b/packages/dev-cli/src/commands/watch.js @@ -29,12 +29,18 @@ export async function watch({ js }) { throw new Error(NULL_ROOT_ERROR); } + // Sometimes, the turbo daemon can get stuck in a weird state, so we clean it up before starting the watchers. + await concurrently([{ name: 'turbo-daemon-clean', command: 'turbo daemon clean', cwd, env: { ...process.env } }]) + .result; + /** @type {import('concurrently').ConcurrentlyCommandInput} */ const clerkJsCommand = { name: 'clerk-js', command: 'turbo run dev --filter=@clerk/clerk-js -- --env devOrigin=http://localhost:4000', cwd, - env: { TURBO_UI: '0', ...process.env }, + // Turborepo is supposed to use the daemon by default in `watch` mode, but only when attached to a PTY. Since we're + // redirecting stdout, we have to force it to use the daemon. + env: { TURBO_UI: '0', TURBO_DAEMON: 'true', ...process.env }, }; /** @type {import('concurrently').ConcurrentlyCommandInput} */