Skip to content

fix(dev-cli): Improve reliability by cleaning turbo daemon #5550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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/fresh-baboons-spend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/dev-cli': patch
---

Improve reliability by cleaning the turborepo daemon before starting watch task.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ scripts/.env
# typedoc
.typedoc/docs
.typedoc/docs.json
tsup.config.bundled_*
8 changes: 7 additions & 1 deletion packages/dev-cli/src/commands/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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} */
Expand Down