[AI] Enable TypeScript composite project references across monorepo#7062
[AI] Enable TypeScript composite project references across monorepo#7062MatissJanis merged 15 commits intomasterfrom
Conversation
- Add composite and declaration emit to all package tsconfigs - Wire root and per-package project references in dependency order - Replace cross-package include-based typing with referenced outputs - Fix api TS5055 by emitting declarations to decl-output - Add desktop-client alias for tests; fix oxlint import order in vite.config - Add UsersState.data null type and openDatabase return type for strict emit Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for actualbudget-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…ipt to emit declarations directly to the output directory. This streamlines the build process and ensures compatibility with the new project structure.
…ecl-output directory and update build scripts. The changes streamline the build process by directing declaration outputs to the @types directory, ensuring better organization and compatibility with the new project structure.
… references and streamline build scripts. Update include and exclude patterns for improved file management, ensuring better organization of declaration outputs and migration SQL files.
…kages to streamline path management and remove obsolete dependencies. Update paths in tsconfig.json files for better organization and compatibility, and adjust yarn.lock to reflect changes in workspace dependencies.
…ependency. Adjust TypeScript import paths and tsconfig references for improved organization and compatibility across packages.
…cific conditions and update loot-core package.json to include Electron as a platform for client connection. This improves compatibility for Electron builds.
…ine path management. Update tsconfig.json files in root, api, and loot-core packages to improve import paths and maintain compatibility with internal typings.
…ibrary and desktop-client. Add vite-tsconfig-paths to component-library and remove it from desktop-client. Refactor Storybook preview file to include a TODO for future refactoring.
…ection, streamlining platform configuration for Electron.
| "rebuild-node": "yarn workspace loot-core rebuild", | ||
| "lint": "oxfmt --check . && oxlint --type-aware", | ||
| "lint:fix": "oxfmt . && oxlint --fix --type-aware", | ||
| "lint": "yarn workspace @actual-app/api clean && oxfmt --check . && oxlint --type-aware", |
There was a problem hiding this comment.
Kinda meh.. but the follow-up work in #6809 will make this better.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR enables TypeScript composite projects and incremental builds across the monorepo, updates multiple tsconfig files to emit declarations/tsbuildinfo and add project references, adjusts build/package scripts (adding tsc steps and workspace clean), updates path/alias usage in Vite configs, and modifies a few package.json exports and devDependencies. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/component-library/.storybook/preview.tsx (1)
6-6: Track this TODO with an issue link.Please attach a ticket/issue reference so this cleanup doesn’t get lost.
If you want, I can draft a small follow-up issue template for this refactor.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/component-library/.storybook/preview.tsx` at line 6, Replace the bare TODO comment in .storybook/preview.tsx with a tracked issue link so the refactor isn’t lost: create a ticket in your issue tracker describing the planned refactor, then update the comment (the existing "// TODO: this needs refactoring") to include the issue key/URL and a short scope note (e.g., "// TODO: refactor X — see ISSUE-123: <url>") so reviewers can follow up; ensure the comment text references the new issue ID/URL and, if desired, add a short owner or ETA token to the same line for clarity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/api/tsconfig.json`:
- Around line 18-20: The tsconfig path alias "loot-core/*":
["../loot-core/src/*"] breaks project-reference boundaries by pointing at
source; revert this to reference the declaration output instead and update the
API distribution paths accordingly—replace the source-based mapping in
packages/api/tsconfig.json with a mapping that targets the emitted d.ts layout
(adjust packages/api/tsconfig.dist.json from "./types/loot-core/src/*" to the
actual emitted declaration path, e.g. "./types/loot-core/loot-core/src/*", or
whatever matches the declaration output structure) so imports like "loot-core/*"
resolve to declaration files rather than ../loot-core/src/*.
In `@packages/sync-server/tsconfig.json`:
- Line 13: Remove the unused "../desktop-client" project reference from
sync-server's tsconfig.json by editing the "references" array in that file
(remove the object with "path": "../desktop-client"); ensure only the needed
references (e.g., { "path": "../crdt" }) remain, save the file, and run a full
build (tsc -b) to confirm no missing imports or build errors.
---
Nitpick comments:
In `@packages/component-library/.storybook/preview.tsx`:
- Line 6: Replace the bare TODO comment in .storybook/preview.tsx with a tracked
issue link so the refactor isn’t lost: create a ticket in your issue tracker
describing the planned refactor, then update the comment (the existing "// TODO:
this needs refactoring") to include the issue key/URL and a short scope note
(e.g., "// TODO: refactor X — see ISSUE-123: <url>") so reviewers can follow up;
ensure the comment text references the new issue ID/URL and, if desired, add a
short owner or ETA token to the same line for clarity.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f1a23ec0-1c99-446a-a2a1-c015683cb214
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (23)
.gitignorebin/package-electronpackage.jsonpackages/api/tsconfig.jsonpackages/component-library/.storybook/preview.tsxpackages/component-library/package.jsonpackages/component-library/tsconfig.jsonpackages/crdt/tsconfig.jsonpackages/desktop-client/package.jsonpackages/desktop-client/tsconfig.jsonpackages/desktop-client/tsconfig.service-worker.jsonpackages/desktop-client/vite.config.mtspackages/desktop-electron/preload.tspackages/desktop-electron/tsconfig.jsonpackages/loot-core/bin/build-apipackages/loot-core/package.jsonpackages/loot-core/src/platform/client/undo/index.tspackages/loot-core/tsconfig.api.jsonpackages/loot-core/tsconfig.jsonpackages/plugins-service/tsconfig.jsonpackages/sync-server/tsconfig.jsontsconfig.jsonupcoming-release-notes/7062.md
💤 Files with no reviewable changes (2)
- packages/desktop-client/package.json
- packages/loot-core/tsconfig.api.json
|
Out for review. First significant PR to improve how our typechecker is configured. Should only affect build system; no-op from user POV. |
…lbudget#7062) * [AI] Enable TypeScript composite project references across monorepo - Add composite and declaration emit to all package tsconfigs - Wire root and per-package project references in dependency order - Replace cross-package include-based typing with referenced outputs - Fix api TS5055 by emitting declarations to decl-output - Add desktop-client alias for tests; fix oxlint import order in vite.config - Add UsersState.data null type and openDatabase return type for strict emit Co-authored-by: Cursor <cursoragent@cursor.com> * Remove obsolete TypeScript configuration for API and update build script to emit declarations directly to the output directory. This streamlines the build process and ensures compatibility with the new project structure. * Refactor TypeScript configuration in API package to remove obsolete decl-output directory and update build scripts. The changes streamline the build process by directing declaration outputs to the @types directory, ensuring better organization and compatibility with the new project structure. * Add TypeScript declaration emission for loot-core in desktop-electron build process * Refactor TypeScript configuration in API package to utilize composite references and streamline build scripts. Update include and exclude patterns for improved file management, ensuring better organization of declaration outputs and migration SQL files. * Refactor TypeScript configuration in loot-core and desktop-client packages to streamline path management and remove obsolete dependencies. Update paths in tsconfig.json files for better organization and compatibility, and adjust yarn.lock to reflect changes in workspace dependencies. * Update desktop-electron package to utilize loot-core as a workspace dependency. Adjust TypeScript import paths and tsconfig references for improved organization and compatibility across packages. * Enhance Vite configuration for desktop-client to support Electron-specific conditions and update loot-core package.json to include Electron as a platform for client connection. This improves compatibility for Electron builds. * Refactor TypeScript configuration across multiple packages to streamline path management. Update tsconfig.json files in root, api, and loot-core packages to improve import paths and maintain compatibility with internal typings. * Update package dependencies and Vite configuration across component-library and desktop-client. Add vite-tsconfig-paths to component-library and remove it from desktop-client. Refactor Storybook preview file to include a TODO for future refactoring. * Remove Node-specific path from loot-core package.json for client connection, streamlining platform configuration for Electron. * Remove loot-core as a workspace dependency from desktop-electron package.json * Update tsconfig.json to remove reference to desktop-client --------- Co-authored-by: Cursor <cursoragent@cursor.com>
…ctualbudget#7062) * [AI] Enable TypeScript composite project references across monorepo - Add composite and declaration emit to all package tsconfigs - Wire root and per-package project references in dependency order - Replace cross-package include-based typing with referenced outputs - Fix api TS5055 by emitting declarations to decl-output - Add desktop-client alias for tests; fix oxlint import order in vite.config - Add UsersState.data null type and openDatabase return type for strict emit Co-authored-by: Cursor <cursoragent@cursor.com> * Remove obsolete TypeScript configuration for API and update build script to emit declarations directly to the output directory. This streamlines the build process and ensures compatibility with the new project structure. * Refactor TypeScript configuration in API package to remove obsolete decl-output directory and update build scripts. The changes streamline the build process by directing declaration outputs to the @types directory, ensuring better organization and compatibility with the new project structure. * Add TypeScript declaration emission for loot-core in desktop-electron build process * Refactor TypeScript configuration in API package to utilize composite references and streamline build scripts. Update include and exclude patterns for improved file management, ensuring better organization of declaration outputs and migration SQL files. * Refactor TypeScript configuration in loot-core and desktop-client packages to streamline path management and remove obsolete dependencies. Update paths in tsconfig.json files for better organization and compatibility, and adjust yarn.lock to reflect changes in workspace dependencies. * Update desktop-electron package to utilize loot-core as a workspace dependency. Adjust TypeScript import paths and tsconfig references for improved organization and compatibility across packages. * Enhance Vite configuration for desktop-client to support Electron-specific conditions and update loot-core package.json to include Electron as a platform for client connection. This improves compatibility for Electron builds. * Refactor TypeScript configuration across multiple packages to streamline path management. Update tsconfig.json files in root, api, and loot-core packages to improve import paths and maintain compatibility with internal typings. * Update package dependencies and Vite configuration across component-library and desktop-client. Add vite-tsconfig-paths to component-library and remove it from desktop-client. Refactor Storybook preview file to include a TODO for future refactoring. * Remove Node-specific path from loot-core package.json for client connection, streamlining platform configuration for Electron. * Remove loot-core as a workspace dependency from desktop-electron package.json * Update tsconfig.json to remove reference to desktop-client --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Description
Enable composite references across the monorepo. This allows each "package" to be built independently. And thus brings us one step closer to un-tangling all the invalid cross-package dependencies. Plus should make TypeScript upgrade and strict migration to v7 easier as we can do it per-package.
There are a few TODO comments. I am planing to address these with follow-up cleanups.
Related issue(s)
N/A
Testing
Mostly manual.. verifying things still build.
Checklist
Bundle Stats
View detailed bundle stats
desktop-client
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
loot-core
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
api
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged