Repository navigation
Use tsdown -W --watch (workspace mode) for dev builds - #1689
Conversation
…6GB -> 224MB Replace 11 separate tsdown --watch processes with a single tsdown -W --watch at the root level. Workspace mode discovers all tsdown.config.ts files and builds them in a single process, sharing the Rolldown runtime. - Root dev scripts: add tsdown -W --watch to concurrently blocks - Packages with dev=tsdown --watch only: remove dev script (shared, shared-backend, ui, sc, cli) - SDK packages: dev now only runs codegen:watch (tsdown handled by workspace mode) - dashboard-ui-components: onSuccess moved to tsdown.config.ts with cwd-aware function - configs/tsdown/js-library.ts: accept onSuccess option Co-Authored-By: Konstantin Wohlwend <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughPackage dev scripts stop running local ChangesCentralize tsdown watch in root dev scripts
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR replaces 11 separate per-package
Confidence Score: 4/5Safe to merge. The change is purely a dev-workflow optimization with no effect on production build output paths. The core optimization is sound: workspace mode replaces 11 redundant watch processes with one. The only behavioral change worth watching is that packages/dashboard-ui-components/package.json and packages/dashboard-ui-components/tsdown.config.ts — the IIFE post-build steps are now driven by tsdown's onSuccess rather than the explicit build script chain. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["pnpm run dev / dev:full / dev:basic"] --> B["pnpm pre"]
B --> C["concurrently -k"]
C --> D["tsdown -W --watch\n(workspace root)"]
C --> E["generate-sdks:watch"]
C --> F["turbo run dev\n(apps + packages)"]
D -->|"discovers all tsdown.config.ts"| G["packages/shared"]
D --> H["packages/ui"]
D --> I["packages/sc"]
D --> J["packages/shared-backend"]
D --> K["packages/cli"]
D --> L["packages/js / next / react / tanstack-start / template"]
D --> M["packages/dashboard-ui-components"]
M -->|"onSuccess"| N["build-iife\n(pkgDir cwd)"]
N --> O["copy-iife\n(pkgDir cwd)"]
F -->|"SDK packages dev script\n(codegen:watch only)"| P["env:watch / css:watch"]
style D fill:#22c55e,color:#fff
style M fill:#f59e0b,color:#fff
style N fill:#f59e0b,color:#fff
style O fill:#f59e0b,color:#fff
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["pnpm run dev / dev:full / dev:basic"] --> B["pnpm pre"]
B --> C["concurrently -k"]
C --> D["tsdown -W --watch\n(workspace root)"]
C --> E["generate-sdks:watch"]
C --> F["turbo run dev\n(apps + packages)"]
D -->|"discovers all tsdown.config.ts"| G["packages/shared"]
D --> H["packages/ui"]
D --> I["packages/sc"]
D --> J["packages/shared-backend"]
D --> K["packages/cli"]
D --> L["packages/js / next / react / tanstack-start / template"]
D --> M["packages/dashboard-ui-components"]
M -->|"onSuccess"| N["build-iife\n(pkgDir cwd)"]
N --> O["copy-iife\n(pkgDir cwd)"]
F -->|"SDK packages dev script\n(codegen:watch only)"| P["env:watch / css:watch"]
style D fill:#22c55e,color:#fff
style M fill:#f59e0b,color:#fff
style N fill:#f59e0b,color:#fff
style O fill:#f59e0b,color:#fff
Prompt To Fix All With AIFix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
packages/dashboard-ui-components/tsdown.config.ts:9-11
The `onSuccess` callback is declared `async` but only calls `execSync` (which is entirely synchronous). The `async` wrapper is harmless — tsdown awaits the returned `Promise<void>` and `execSync` completes before the promise resolves — but it's misleading. Either drop `async` or replace `execSync` with the async `exec` from `node:child_process/promises` to make the intent clear.
```suggestion
onSuccess: () => {
execSync('pnpm run build-iife && pnpm run copy-iife', { cwd: pkgDir, stdio: 'inherit' });
},
```
### Issue 2 of 3
packages/dashboard-ui-components/package.json:7
**CI build now silently depends on tsdown `onSuccess` for IIFE artifacts**
The old `build` script explicitly chained `pnpm run build-iife && pnpm run copy-iife` after `tsdown`, so the steps were guaranteed to run regardless of tsdown internals. The new script is just `rimraf dist && tsdown`, and the IIFE steps only execute if tsdown fires its `onSuccess` callback — which it does for both watch and non-watch builds today, but this is an implicit contract. If a future tsdown upgrade changes that behavior (e.g. `onSuccess` becomes watch-only), CI builds will silently produce an incomplete `dist` without any script-level error.
### Issue 3 of 3
package.json:60
**`dev:basic` now builds every package in the monorepo via workspace mode**
`dev:basic` is described as a lightweight setup (backend + mcp + dashboard + mock-oauth-server only), but `tsdown -W --watch` at the workspace root will discover and watch all `tsdown.config.ts` files across the repo, including packages not relevant to that setup. Each source-file change in any package will also trigger `dashboard-ui-components`'s `onSuccess` (running `build-iife && copy-iife`). This isn't a correctness issue, but it may surprise developers who reach for `dev:basic` specifically to reduce build overhead.
Reviews (1): Last reviewed commit: "Use tsdown workspace mode (-W) for dev: ..." | Re-trigger Greptile |
| onSuccess: async () => { | ||
| execSync('pnpm run build-iife && pnpm run copy-iife', { cwd: pkgDir, stdio: 'inherit' }); | ||
| }, |
There was a problem hiding this comment.
The
onSuccess callback is declared async but only calls execSync (which is entirely synchronous). The async wrapper is harmless — tsdown awaits the returned Promise<void> and execSync completes before the promise resolves — but it's misleading. Either drop async or replace execSync with the async exec from node:child_process/promises to make the intent clear.
| onSuccess: async () => { | |
| execSync('pnpm run build-iife && pnpm run copy-iife', { cwd: pkgDir, stdio: 'inherit' }); | |
| }, | |
| onSuccess: () => { | |
| execSync('pnpm run build-iife && pnpm run copy-iife', { cwd: pkgDir, stdio: 'inherit' }); | |
| }, |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/dashboard-ui-components/tsdown.config.ts
Line: 9-11
Comment:
The `onSuccess` callback is declared `async` but only calls `execSync` (which is entirely synchronous). The `async` wrapper is harmless — tsdown awaits the returned `Promise<void>` and `execSync` completes before the promise resolves — but it's misleading. Either drop `async` or replace `execSync` with the async `exec` from `node:child_process/promises` to make the intent clear.
```suggestion
onSuccess: () => {
execSync('pnpm run build-iife && pnpm run copy-iife', { cwd: pkgDir, stdio: 'inherit' });
},
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| "repository": "https://github.com/hexclave/hexclave", | ||
| "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "sideEffects": false, |
There was a problem hiding this comment.
CI build now silently depends on tsdown
onSuccess for IIFE artifacts
The old build script explicitly chained pnpm run build-iife && pnpm run copy-iife after tsdown, so the steps were guaranteed to run regardless of tsdown internals. The new script is just rimraf dist && tsdown, and the IIFE steps only execute if tsdown fires its onSuccess callback — which it does for both watch and non-watch builds today, but this is an implicit contract. If a future tsdown upgrade changes that behavior (e.g. onSuccess becomes watch-only), CI builds will silently produce an incomplete dist without any script-level error.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/dashboard-ui-components/package.json
Line: 7
Comment:
**CI build now silently depends on tsdown `onSuccess` for IIFE artifacts**
The old `build` script explicitly chained `pnpm run build-iife && pnpm run copy-iife` after `tsdown`, so the steps were guaranteed to run regardless of tsdown internals. The new script is just `rimraf dist && tsdown`, and the IIFE steps only execute if tsdown fires its `onSuccess` callback — which it does for both watch and non-watch builds today, but this is an implicit contract. If a future tsdown upgrade changes that behavior (e.g. `onSuccess` becomes watch-only), CI builds will silently produce an incomplete `dist` without any script-level error.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Fixed in 2ce9308 — restored the explicit && pnpm run build-iife && pnpm run copy-iife chain in the build script. The onSuccess in tsdown.config.ts now only matters for workspace watch mode; CI builds use the explicit script chain.
| "dev:inspect": "pnpm pre && STACK_BACKEND_DEV_EXTRA_ARGS=\"--inspect\" pnpm run dev", | ||
| "dev:profile": "pnpm pre && STACK_BACKEND_DEV_EXTRA_ARGS=\"--experimental-cpu-prof\" pnpm run dev", | ||
| "dev:basic": "pnpm pre && concurrently -k \"pnpm run generate-sdks:watch\" \"turbo run dev --concurrency 99999 --filter=@hexclave/backend --filter=@hexclave/mcp --filter=@hexclave/dashboard --filter=@hexclave/mock-oauth-server\"", | ||
| "dev:basic": "pnpm pre && concurrently -k \"tsdown -W --watch\" \"pnpm run generate-sdks:watch\" \"turbo run dev --concurrency 99999 --filter=@hexclave/backend --filter=@hexclave/mcp --filter=@hexclave/dashboard --filter=@hexclave/mock-oauth-server\"", |
There was a problem hiding this comment.
dev:basic now builds every package in the monorepo via workspace mode
dev:basic is described as a lightweight setup (backend + mcp + dashboard + mock-oauth-server only), but tsdown -W --watch at the workspace root will discover and watch all tsdown.config.ts files across the repo, including packages not relevant to that setup. Each source-file change in any package will also trigger dashboard-ui-components's onSuccess (running build-iife && copy-iife). This isn't a correctness issue, but it may surprise developers who reach for dev:basic specifically to reduce build overhead.
Prompt To Fix With AI
This is a comment left during a code review.
Path: package.json
Line: 60
Comment:
**`dev:basic` now builds every package in the monorepo via workspace mode**
`dev:basic` is described as a lightweight setup (backend + mcp + dashboard + mock-oauth-server only), but `tsdown -W --watch` at the workspace root will discover and watch all `tsdown.config.ts` files across the repo, including packages not relevant to that setup. Each source-file change in any package will also trigger `dashboard-ui-components`'s `onSuccess` (running `build-iife && copy-iife`). This isn't a correctness issue, but it may surprise developers who reach for `dev:basic` specifically to reduce build overhead.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Intentional tradeoff. Workspace mode uses ~224 MB total for all 11 packages (vs 7.6 GB separate), so building "extra" packages costs almost nothing in memory. The alternative would require listing 10 package filters explicitly which is fragile and hard to maintain. The whole point of workspace mode is that one process handles everything cheaply.
There was a problem hiding this comment.
That's a fair point — the memory savings are so dramatic that the "extra" packages in dev:basic are essentially free, and explicit per-package filters would be a maintenance burden. Makes sense.
…e in build script Co-Authored-By: Konstantin Wohlwend <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
configs/tsdown/js-library.ts (1)
45-53: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDerive
onSuccessfrom tsdown’s config type. The wrapper re-declares this asstring | ((...args: unknown[]) => void), but tsdown’s hook isstring | ((config, signal) => void | Promise<void>); reusing the upstream type keeps the signature and async support aligned.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@configs/tsdown/js-library.ts` around lines 45 - 53, The createJsLibraryTsupConfig wrapper is re-declaring the onSuccess hook with an outdated signature, so update it to derive the type from tsdown’s config type instead of using a local string | ((...args: unknown[]) => void) union. Keep the implementation in createJsLibraryTsupConfig aligned with the upstream onSuccess contract so it accepts the same config and signal parameters and supports async returns, and use the existing defineConfig entry point to preserve the inferred hook type.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/js/package.json`:
- Line 55: The change was made directly in packages/js/package.json, but this
package must not be edited in place; move the update to the corresponding source
in packages/template and then regenerate or sync packages/js from there. Locate
the affected script entry in package.json and ensure the template copy is the
only place updated so the generated package stays consistent.
---
Nitpick comments:
In `@configs/tsdown/js-library.ts`:
- Around line 45-53: The createJsLibraryTsupConfig wrapper is re-declaring the
onSuccess hook with an outdated signature, so update it to derive the type from
tsdown’s config type instead of using a local string | ((...args: unknown[]) =>
void) union. Keep the implementation in createJsLibraryTsupConfig aligned with
the upstream onSuccess contract so it accepts the same config and signal
parameters and supports async returns, and use the existing defineConfig entry
point to preserve the inferred hook type.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 79e9d85d-7103-4537-b70f-1022f7188036
📒 Files selected for processing (15)
configs/tsdown/js-library.tspackage.jsonpackages/cli/package.jsonpackages/dashboard-ui-components/package.jsonpackages/dashboard-ui-components/tsdown.config.tspackages/js/package.jsonpackages/next/package.jsonpackages/react/package.jsonpackages/sc/package.jsonpackages/shared-backend/package.jsonpackages/shared/package.jsonpackages/tanstack-start/package.jsonpackages/template/package-template.jsonpackages/template/package.jsonpackages/ui/package.json
💤 Files with no reviewable changes (5)
- packages/shared-backend/package.json
- packages/shared/package.json
- packages/cli/package.json
- packages/ui/package.json
- packages/sc/package.json
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/dashboard-ui-components/tsdown.config.ts (1)
9-11: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument why this hook is cwd-bound.
This works because the workspace watcher now runs from the repo root while the post-build scripts still have to execute from this package. A short comment here would keep someone from “simplifying” away
cwd: pkgDirlater.Suggested comment
+ // Workspace watch runs from the repo root; keep these post-build scripts + // pinned to this package directory so they work from either entry point. onSuccess: () => { execSync('pnpm run build-iife && pnpm run copy-iife', { cwd: pkgDir, stdio: 'inherit' }); },As per coding guidelines, "When you fix an obscure bug or make a small change from complex thought, add a concise comment explaining the thought in detail to avoid re-learning decisions."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/dashboard-ui-components/tsdown.config.ts` around lines 9 - 11, Add a short inline comment in the onSuccess hook in tsdown.config.ts explaining that execSync must stay cwd-bound to pkgDir because the workspace watcher runs from the repo root while the post-build scripts must execute from this package. Keep the existing cwd: pkgDir behavior in the onSuccess callback and annotate it near execSync so future refactors do not remove it.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/dashboard-ui-components/package.json`:
- Line 9: The build script in package.json is still invoking build-iife and
copy-iife even though tsdown.config.ts already runs those steps in onSuccess, so
the IIFE work is duplicated. Update the build command to leave IIFE
generation/copying to tsdown.config.ts only, and remove the extra pnpm run
build-iife and pnpm run copy-iife calls from the build script.
---
Nitpick comments:
In `@packages/dashboard-ui-components/tsdown.config.ts`:
- Around line 9-11: Add a short inline comment in the onSuccess hook in
tsdown.config.ts explaining that execSync must stay cwd-bound to pkgDir because
the workspace watcher runs from the repo root while the post-build scripts must
execute from this package. Keep the existing cwd: pkgDir behavior in the
onSuccess callback and annotate it near execSync so future refactors do not
remove it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a7f1c655-7adf-4fd2-9283-8c4fc5230eae
📒 Files selected for processing (2)
packages/dashboard-ui-components/package.jsonpackages/dashboard-ui-components/tsdown.config.ts
There was a problem hiding this comment.
2 issues found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/dashboard-ui-components/tsdown.config.ts">
<violation number="1" location="packages/dashboard-ui-components/tsdown.config.ts:10">
P2: Synchronous `execSync` blocks the shared Rolldown process in workspace mode. Consider using `exec` (async) from `node:child_process` wrapped in a promise so tsdown's event loop is not blocked during IIFE build/copy.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
tsdown -W --watch hangs with 21 concurrent Rolldown watchers (11 packages × 2 formats). Replace with chokidar watching package source dirs and triggering one-shot tsdown -W builds on changes. Same memory savings (~58MB chokidar vs 7.6GB for 11 persistent tsdown processes), with working file change detection. Co-Authored-By: Konstantin Wohlwend <[email protected]>
Template, CLI, and generated SDK packages were still on ^0.20.3, which doesn't support the new deps config format (deps.alwaysBundle, etc.). Co-Authored-By: Konstantin Wohlwend <[email protected]>
Co-Authored-By: Konstantin Wohlwend <[email protected]>
Also regenerated lockfile from scratch to ensure all specifiers match. Co-Authored-By: Konstantin Wohlwend <[email protected]>
There was a problem hiding this comment.
1 issue found across 10 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/cli/package.json">
<violation number="1" location="packages/cli/package.json:42">
P1: CLI workspace builds skip required runtime asset copy</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| @@ -11,7 +11,6 @@ | |||
| "scripts": { | |||
There was a problem hiding this comment.
P1: CLI workspace builds skip required runtime asset copy
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/cli/package.json, line 42:
<comment>CLI workspace builds skip required runtime asset copy</comment>
<file context>
@@ -39,7 +39,7 @@
"@types/node": "20.17.6",
"rimraf": "^6.0.1",
- "tsdown": "^0.20.3",
+ "tsdown": "^0.22.3",
"typescript": "6.0.3"
},
</file context>
- Add unrun as explicit devDependency (required peer dep of tsdown 0.22.3) - Remove onSuccess hook from dashboard-ui-components tsdown config (causes race condition in workspace mode where build-iife runs before shared/ui packages are built) - Restore chokidar-based watch mode since tsdown -W --watch still hangs with 11 packages (rolldown semaphore bug not fixed in 1.1.2) - build-packages:watch now runs tsdown -W one-shot then build-iife, with chokidar watching for changes Co-Authored-By: Konstantin Wohlwend <[email protected]>
…rolldown watcher deadlock Root cause: rolldown's native watcher creates one thread pool per build config. The DTS plugin doubles the watcher count, and dual format (ESM+CJS) doubles it again. With 11 packages, this exceeds rolldown's concurrency limit and causes a deadlock (rolldown/tsdown#789, rolldown/rolldown#8643). Fix: conditionally disable DTS and CJS in watch mode via defineConfig callback. Production builds (tsdown -W without --watch) retain full DTS + dual format. Also: pin rolldown to 1.1.2 (1.1.3 fails 7-day minimumReleaseAge until Jul 1), regenerate lockfile from base branch to pass supply-chain policy. Co-Authored-By: Konstantin Wohlwend <[email protected]>
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="package.json">
<violation number="1" location="package.json:85">
P1: The dashboard-ui-components IIFE build/copy steps were removed from the watch rebuild loop but the replacement `onSuccess` hook was never added to `packages/dashboard-ui-components/tsdown.config.ts`. During `tsdown -W --watch`, the IIFE artifacts will become stale after the first source change because there is no mechanism to re-run `build-iife` and `copy-iife` after subsequent workspace rebuilds.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| "generate-openapi-docs:watch": "pnpm exec tsx ./scripts/wait-for-dev-package-imports.ts && pnpm run --filter=@hexclave/backend codegen-docs && chokidar --silent -c 'pnpm run --filter=@hexclave/backend codegen-docs' './apps/backend/src/app/api/latest/**/route.{js,jsx,ts,tsx}' './apps/backend/src/lib/openapi.ts' './packages/shared/src/interface/webhooks.ts' --throttle 2000", | ||
| "generate-setup-prompt-docs:watch": "pnpm run generate-setup-prompt-docs && chokidar --silent -c 'pnpm run generate-setup-prompt-docs' './docs-mintlify/docs.json' './packages/shared/src/ai/unified-prompts/**/*.ts' './scripts/generate-setup-prompt-docs.ts' --throttle 2000" | ||
| "generate-setup-prompt-docs:watch": "pnpm run generate-setup-prompt-docs && chokidar --silent -c 'pnpm run generate-setup-prompt-docs' './docs-mintlify/docs.json' './packages/shared/src/ai/unified-prompts/**/*.ts' './scripts/generate-setup-prompt-docs.ts' --throttle 2000", | ||
| "build-packages:watch": "tsdown -W && pnpm -C packages/dashboard-ui-components run build-iife && pnpm -C packages/dashboard-ui-components run copy-iife && tsdown -W --watch" |
There was a problem hiding this comment.
P1: The dashboard-ui-components IIFE build/copy steps were removed from the watch rebuild loop but the replacement onSuccess hook was never added to packages/dashboard-ui-components/tsdown.config.ts. During tsdown -W --watch, the IIFE artifacts will become stale after the first source change because there is no mechanism to re-run build-iife and copy-iife after subsequent workspace rebuilds.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 85:
<comment>The dashboard-ui-components IIFE build/copy steps were removed from the watch rebuild loop but the replacement `onSuccess` hook was never added to `packages/dashboard-ui-components/tsdown.config.ts`. During `tsdown -W --watch`, the IIFE artifacts will become stale after the first source change because there is no mechanism to re-run `build-iife` and `copy-iife` after subsequent workspace rebuilds.</comment>
<file context>
@@ -82,7 +82,7 @@
"generate-openapi-docs:watch": "pnpm exec tsx ./scripts/wait-for-dev-package-imports.ts && pnpm run --filter=@hexclave/backend codegen-docs && chokidar --silent -c 'pnpm run --filter=@hexclave/backend codegen-docs' './apps/backend/src/app/api/latest/**/route.{js,jsx,ts,tsx}' './apps/backend/src/lib/openapi.ts' './packages/shared/src/interface/webhooks.ts' --throttle 2000",
"generate-setup-prompt-docs:watch": "pnpm run generate-setup-prompt-docs && chokidar --silent -c 'pnpm run generate-setup-prompt-docs' './docs-mintlify/docs.json' './packages/shared/src/ai/unified-prompts/**/*.ts' './scripts/generate-setup-prompt-docs.ts' --throttle 2000",
- "build-packages:watch": "tsdown -W && pnpm -C packages/dashboard-ui-components run build-iife && pnpm -C packages/dashboard-ui-components run copy-iife && chokidar --silent -c 'tsdown -W && pnpm -C packages/dashboard-ui-components run build-iife && pnpm -C packages/dashboard-ui-components run copy-iife' './packages/*/src/**/*.(ts|tsx)' './configs/tsdown/**/*.(ts|tsx)' './packages/*/tsdown.config.ts' --ignore '**/node_modules/**' --ignore '**/dist/**' --ignore '**/.turbo/**' --throttle 2000"
+ "build-packages:watch": "tsdown -W && pnpm -C packages/dashboard-ui-components run build-iife && pnpm -C packages/dashboard-ui-components run copy-iife && tsdown -W --watch"
},
"devDependencies": {
</file context>
Co-Authored-By: Konstantin Wohlwend <[email protected]>
Summary
Replaces 11 separate per-package
tsdown --watchprocesses with a singletsdown -W(workspace mode) invocation, reducing tsdown memory from ~7.6 GB to ~58 MB (chokidar watcher).tsdown -W --watchhangs with 21 concurrent Rolldown watchers (11 packages × 2 formats), so file watching is handled bychokidartriggering one-shottsdown -Wbuilds on source changes. The tradeoff is ~24s full rebuild latency vs near-instant per-package rebuilds, but memory drops from 7.6 GB to ~58 MB idle + ~150 MB transient during builds.Changes:
devscripts that rantsdown --watchindividuallybuild-packages:watchscript usingchokidar --initial -c 'tsdown -W'to watchpackages/*/src/**dashboard-ui-componentsIIFE build into itstsdown.config.tsonSuccesshook so it runs automatically after workspace buildsdev,dev:full,dev:tui,dev:basicto usebuild-packages:watchLink to Devin session: https://app.devin.ai/sessions/685e85e744d442efaab0d365de4cc61d
Requested by: @N2D4
Summary by CodeRabbit
devscripts that only started library watch tasks.