Skip to content

[AI] Enable TypeScript composite project references across monorepo#7062

Merged
MatissJanis merged 15 commits intomasterfrom
matiss/ts-composite-references
Mar 4, 2026
Merged

[AI] Enable TypeScript composite project references across monorepo#7062
MatissJanis merged 15 commits intomasterfrom
matiss/ts-composite-references

Conversation

@MatissJanis
Copy link
Copy Markdown
Member

@MatissJanis MatissJanis commented Feb 23, 2026

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

  • Release notes added (see link above)
  • No obvious regressions in affected areas
  • Self-review has been performed - I understand what each change in the code does and why it is needed

Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 27 14.89 MB 0%
loot-core 1 5.82 MB 0%
api 1 4.43 MB 0%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
27 14.89 MB 0%
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

Asset File Size % Changed
static/js/index.js 9.54 MB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 12.94 kB 0%
static/js/workbox-window.prod.es5.js 5.64 kB 0%
static/js/ca.js 188.11 kB 0%
static/js/da.js 106.35 kB 0%
static/js/de.js 180.07 kB 0%
static/js/en-GB.js 7.18 kB 0%
static/js/en.js 170.33 kB 0%
static/js/es.js 174.55 kB 0%
static/js/fr.js 179.6 kB 0%
static/js/it.js 171.16 kB 0%
static/js/nb-NO.js 156.96 kB 0%
static/js/nl.js 113.21 kB 0%
static/js/pl.js 88.37 kB 0%
static/js/pt-BR.js 183.19 kB 0%
static/js/th.js 181.87 kB 0%
static/js/uk.js 214.88 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 120.54 kB 0%
static/js/ReportRouter.js 1.16 MB 0%
static/js/narrow.js 637.77 kB 0%
static/js/TransactionList.js 106.22 kB 0%
static/js/wide.js 164.15 kB 0%
static/js/AppliedFilters.js 9.71 kB 0%
static/js/usePayeeRuleCounts.js 10.04 kB 0%
static/js/useTransactionBatchActions.js 13.23 kB 0%
static/js/FormulaEditor.js 1.04 MB 0%

loot-core

Total

Files count Total bundle size % Changed
1 5.82 MB 0%
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

Asset File Size % Changed
kcab.worker.MNtpiHkH.js 5.82 MB 0%

api

Total

Files count Total bundle size % Changed
1 4.43 MB 0%
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

Asset File Size % Changed
bundle.api.js 4.43 MB 0%

- 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>
@netlify
Copy link
Copy Markdown

netlify bot commented Feb 23, 2026

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 1813fe8
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/69a88803786c080008e0aba7
😎 Deploy Preview https://deploy-preview-7062.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 23, 2026

Deploy Preview for actualbudget-storybook ready!

Name Link
🔨 Latest commit eb1dc1a
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget-storybook/deploys/69a0bfeb82519f0008349821
😎 Deploy Preview https://deploy-preview-7062--actualbudget-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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.
Comment thread package.json
"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",
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.

Kinda meh.. but the follow-up work in #6809 will make this better.

@MatissJanis
Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 4, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai bot added the API Issues with the @actual-app/api package label Mar 4, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bd35d96d-8cde-4376-9487-4a80739f5ca3

📥 Commits

Reviewing files that changed from the base of the PR and between a57c21d and 1813fe8.

📒 Files selected for processing (1)
  • packages/sync-server/tsconfig.json

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Workspace TypeScript configs
tsconfig.json, packages/api/tsconfig.json, packages/component-library/tsconfig.json, packages/crdt/tsconfig.json, packages/desktop-client/tsconfig.json, packages/desktop-client/tsconfig.service-worker.json, packages/desktop-electron/tsconfig.json, packages/loot-core/tsconfig.json, packages/plugins-service/tsconfig.json, packages/sync-server/tsconfig.json
Enable composite, emit declarations and declaration maps, add tsBuildInfoFile entries, and wire project references to enable incremental, coordinated builds across packages.
Build scripts & packaging
bin/package-electron, packages/loot-core/bin/build-api, package.json
Add TypeScript declaration emission step for loot-core in electron packaging/build flows and prepend workspace cleanup to lint, lint:fix, and typecheck scripts; simplify loot-core declaration emission pipeline.
Module resolution & Vite config
packages/desktop-client/vite.config.mts, packages/desktop-client/package.json, packages/component-library/package.json
Replace vite-tsconfig-paths usage with explicit path alias for @desktop-client, remove the plugin from desktop-client, add vite-tsconfig-paths to component-library devDependencies.
Package exports & package.json edits
packages/loot-core/package.json, packages/desktop-client/package.json
Change some loot-core export entries to point to TypeScript sources (types mapping) and switch the platform/client/connection environment key from node to electron; remove vite-tsconfig-paths from desktop-client devDependencies.
Source tweaks & small directives
packages/desktop-electron/preload.ts, packages/loot-core/src/platform/client/undo/index.ts, packages/component-library/.storybook/preview.tsx
Add // @ts-strict-ignore`` directive in preload, replace an imported Modal type with a local any alias, and add a TODO comment in Storybook preview.
Removed/relocated configs & ignores
packages/loot-core/tsconfig.api.json (deleted), .gitignore, upcoming-release-notes/7062.md
Delete deprecated tsconfig.api.json, add packages/component-library/dist and **/.tsbuildinfo to .gitignore, and add release-note entry documenting TypeScript composite references work.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • matt-fidd
  • MikesGlitch
  • joel-jeremy

Poem

🐰 I hopped through configs, tidy and bright,
Declarations sprouted, references alight.
Builds now chatter in ordered queues,
Incremental saves for human crews —
A carrot-coded monorepo delight! 🥕

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective of the changeset: enabling TypeScript composite project references across the monorepo. It is clear, specific, and directly reflects the primary purpose of the PR.
Description check ✅ Passed The description clearly explains what the PR does, why it is needed, and provides context about enabling composite references for independent package builds and easier per-package TypeScript upgrades. It is directly related to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch matiss/ts-composite-references

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between e1f8343 and a57c21d.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (23)
  • .gitignore
  • bin/package-electron
  • package.json
  • packages/api/tsconfig.json
  • packages/component-library/.storybook/preview.tsx
  • packages/component-library/package.json
  • packages/component-library/tsconfig.json
  • packages/crdt/tsconfig.json
  • packages/desktop-client/package.json
  • packages/desktop-client/tsconfig.json
  • packages/desktop-client/tsconfig.service-worker.json
  • packages/desktop-client/vite.config.mts
  • packages/desktop-electron/preload.ts
  • packages/desktop-electron/tsconfig.json
  • packages/loot-core/bin/build-api
  • packages/loot-core/package.json
  • packages/loot-core/src/platform/client/undo/index.ts
  • packages/loot-core/tsconfig.api.json
  • packages/loot-core/tsconfig.json
  • packages/plugins-service/tsconfig.json
  • packages/sync-server/tsconfig.json
  • tsconfig.json
  • upcoming-release-notes/7062.md
💤 Files with no reviewable changes (2)
  • packages/desktop-client/package.json
  • packages/loot-core/tsconfig.api.json

Comment thread packages/api/tsconfig.json
Comment thread packages/sync-server/tsconfig.json Outdated
@MatissJanis MatissJanis marked this pull request as ready for review March 4, 2026 19:49
@MatissJanis
Copy link
Copy Markdown
Member Author

Out for review. First significant PR to improve how our typechecker is configured. Should only affect build system; no-op from user POV.

@coderabbitai coderabbitai bot removed the API Issues with the @actual-app/api package label Mar 4, 2026
@MatissJanis MatissJanis added this pull request to the merge queue Mar 4, 2026
Merged via the queue into master with commit 387c8fc Mar 4, 2026
38 checks passed
@MatissJanis MatissJanis deleted the matiss/ts-composite-references branch March 4, 2026 21:02
diepala pushed a commit to diepala/actual that referenced this pull request Mar 6, 2026
…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>
@MikesGlitch MikesGlitch mentioned this pull request Mar 6, 2026
3 tasks
matt-fidd pushed a commit to matt-fidd/actual that referenced this pull request Mar 25, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants