Conversation
Replace the old runMain pattern with a shutdown-aware createRunner that injects a shutdown promise into deps and installs global signal and error handlers (SIGINT, SIGTERM, SIGHUP, uncaughtException, unhandledRejection). Move Node.js runner wiring into packages/nodejs/src/Task.ts, resolve shutdown via process signals, and ensure listeners are cleaned up on runner dispose. Rename relay APIs: createNodeJsRelayBetterSqliteDeps -> createRelayDeps and createNodeJsRelay -> startRelay, update examples and the apps/relay entry to use startRelay and createRunner. Simplify task typing in packages/common (introduce AnyTask and use it in InferTask* helpers, add CreateRunner type, remove MainTask), and adjust the local-first Relay implementation to handle sqlite errors by logging and returning ok(stack). Update tests to reflect the new createRunner/shutdown behavior and to verify signal/error handling and listener cleanup. README updated to reflect the API rename.
Introduce a browser-specific Task runner and tests. Implements createRunner in packages/web/src/Task.ts that composes the common runner, creates a console child named "global", registers global "error" and "unhandledrejection" handlers (logging via createUnknownError), and removes those listeners when the runner is disposed. Adds vitest tests in packages/web/test/Task.test.ts to verify custom deps merging, mocked listener registration/removal, real-event logging for ErrorEvent and PromiseRejectionEvent, and that handlers are detached after disposal.
Update packages/nodejs/package.json to change the "files" entry from "dist/**" to "dist/src/**". This restricts what gets packaged/published (avoiding unrelated files under dist), reducing package size and ensuring only the compiled source artifacts and src are included.
Consolidate imports and stop passing a custom time provider to createConsoleEntryFormatter in apps/relay/src/index.ts. The createTime import and its usage were removed so the formatter uses its default time handling, and the import statement was simplified.
Update pnpm-lock.yaml to refresh multiple dependency versions and integrity hashes. Notable bumps: @algolia/autocomplete-core/plugin/shared 1.19.4 -> 1.19.5, framer-motion & motion 12.30.1 -> 12.31.0, enhanced-resolve 5.18.4 -> 5.19.0, and dotenv 16.4.7 -> 16.6.1. Snapshots/resolutions updated accordingly — this is an automated lockfile refresh to keep transitive deps in sync.
Switch example projects to use local workspace packages and a centralized React catalog. Updated @evolu/* dependencies from "latest" to "workspace:*" and replaced direct React/ReactDOM version pins (19.1.0) with "catalog:react19" where applicable across: angular-vite-pwa, react-electron, react-expo, react-nextjs, react-vite-pwa, and vue-vite-pwa. This ensures examples resolve local workspace packages and share a single React version definition.
Introduce a root vitest.config.ts and split package test configs into unit and browser projects (packages/common/vitest.unit.config.ts, packages/common/vitest.browser.config.ts). Remove the old combined common vitest config and migrate per-package coverage/test settings into the central config. Update package.json scripts to run Vitest from the repo root, remove per-package Vitest deps where appropriate, and add browser/playwright-related devDeps at the root. Adjust tsconfigs (add root tsconfig.json and include vitest.*.config.ts in packages/common) and simplify turbo.json task entries. Also add a README link to the Vitest VS Code extension.
Replace the brief Test-driven development note with an expanded TDD section that explains how to run tests, test file locations, and filtering by test name. Add subsections on test structure, type testing (expectTypeOf), and inline snapshot usage with Vitest code examples. Remove the previous Vitest filtering CLI snippets and some commit-message examples to streamline the guidance and surface more actionable testing patterns for contributors.
Rename vitest.config.ts → vitest.config.mts (switch to .mts/ESM), update tsconfig include to reference vitest.config.mts, and add a new "scripts" test project in the Vitest config to include tests matching scripts/**/*.test.mts. Also simplify package.json "verify" script by removing the generic "pnpm test" step.
Introduce a standalone createQueryBuilder(Schema) to build typed Kysely queries without an Evolu instance. The createQuery implementation was moved into packages/common/src/local-first/Schema.ts and exported from index.ts; Evolu.createQuery was removed from the Evolu interface/instance. Updated usages across playgrounds to call createQuery(...) (created via createQueryBuilder) and adjusted types/docs in Query.ts. Added a changeset noting the API migration and guidance to replace evolu.createQuery with createQueryBuilder(Schema).
Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
…rove type safety Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
Remove ESLint from react-vite-pwa example
Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
Signed-off-by: Miccy <support@miccy.dev>
[WIP] Update tooling and documentation for monorepo management
…d update bun.lock and example components.
This reverts commit 8683c03.
…s to EvoluConfig."
📝 WalkthroughWalkthroughThis pull request introduces multiple interconnected changes: a worker abstraction refactoring with new tab messaging (InitTab/InitEvolu), console system overhaul with renamed APIs and new output factories, AppName as a new public type with validation, ConsoleDep dependency injection into Evolu setup, error handling migration to evoluError store, Next.js configuration enhancements, and various utility additions alongside documentation updates. Changes
Sequence Diagram(s)sequenceDiagram
participant App as Application
participant Evolu as Evolu (Main)
participant TabChannel as Tab Channel
participant Worker as Evolu Worker
participant Console as Console Instance
App->>Evolu: createEvoluDeps(deps)
Evolu->>Evolu: Create console instance
Evolu->>Evolu: Create evoluError store
Evolu->>Evolu: Create EvoluTabChannel
Evolu->>Worker: Post InitTab with tab port
Note over Worker: Register tab port<br/>in tabPorts set
Worker-->>TabChannel: ConsoleEntry message
TabChannel->>Evolu: Receive ConsoleEntry
Evolu->>Console: writeConsoleEntry(entry)
Worker-->>TabChannel: EvoluError message
TabChannel->>Evolu: Receive EvoluError
Evolu->>Evolu: Update evoluError store
Evolu-->>App: Error state available
App->>Evolu: createEvolu(deps)
Evolu->>Evolu: Retrieve evoluError from deps
Evolu-->>App: Evolu instance with<br/>error handling
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Note 🎁 Summarized by CodeRabbit FreeThe PR author is not assigned a seat. To perform a comprehensive line-by-line review, please assign a seat to the pull request author through the subscription management page by visiting https://app.coderabbit.ai/login. Comment |
There was a problem hiding this comment.
Pull request overview
This pull request merges the bun-first branch into main, introducing several compatibility and developer experience improvements. The changes focus on enhanced dependency injection for custom console instances, compatibility aliases for upstream common-v8, improved hot-reloading for workspace packages, and minor documentation corrections.
Changes:
- Added support for passing custom
consoleinstances through dependency injection in web/react-web packages - Introduced
AppNameandcreateRuncompatibility aliases for upstreamcommon-v8migration - Enhanced Next.js config to support hot-reloading of workspace TypeScript sources
- Added
safeParseAppOwnererror handling and documentation for Bun hot mode workflow
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/web/src/local-first/Evolu.ts | Added ConsoleDep parameter to createEvoluDeps |
| packages/react-web/src/local-first/Evolu.ts | Added ConsoleDep parameter to createEvoluDeps |
| packages/react-web/src/index.ts | Added ConsoleDep parameter to createEvoluDeps |
| packages/web/src/local-first/DbWorker.ts | Added safeParseAppOwner for error handling |
| packages/nodejs/src/Task.ts | Added createRun as deprecated alias for createRunner |
| packages/nodejs/test/Task.test.ts | Added test for createRun alias compatibility |
| packages/common/src/local-first/Evolu.ts | Added AppName compatibility type, made EvoluConfig.name optional, preserved console in createEvoluDeps |
| packages/common/test/local-first/Evolu.test.ts | Added tests for console preservation and appName compatibility |
| packages/common/src/index.ts | Exported AppName and AppNameError |
| packages/common/package.json | Added "source" export condition |
| packages/web/package.json | Added "source" export condition |
| apps/web/next.config.mjs | Added webpack config for workspace source hot-reload |
| apps/web/package.json | Added @emotion/is-prop-valid dependency |
| apps/web/src/app/(docs)/docs/local-first/page.mdx | Added Bun hot mode documentation |
| package.json | Updated sync:guard scripts to use bun-first reference, updated typedoc |
| bun.lock | Dependency version updates |
| .changeset/*.md | Minor documentation corrections |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Miccy <code@miccy.dev>
…to tab via a single message channel.
Description
This pull request introduces several improvements and compatibility updates across the codebase, focusing on enhanced dependency injection, improved compatibility with upstream packages, and developer experience enhancements. The most significant changes include support for passing a custom console instance to Evolu dependencies, compatibility aliases for upstream
common-v8, and improved hot-reloading for workspace packages. Additionally, there are minor documentation and type improvements.Dependency Injection and Compatibility Improvements:
createEvoluDepsfunction now accepts and preserves a providedconsoleinstance, allowing for custom logging and improved testability. [1] [2] [3]common-v8:AppNametype andappNameconfig option as a deprecated alias fornameinEvoluConfig, ensuring smoother migration and compatibility. [1] [2] [3] [4]createRunas a deprecated alias forcreateRunnerin the Node.js package. [1] [2] [3]Developer Experience and Workspace Enhancements:
@evolu/*packages to TypeScript sources and supports live reload with proper extension aliasing, improving local development workflow.Other Notable Changes:
AppNameandAppNameError. [1] [2]Dependency Updates:
typedocand added@emotion/is-prop-validto the web app. [1] [2]These changes collectively improve the flexibility, compatibility, and developer experience of the Evolu codebase.
Type of Change
Checklist
bun run check)Related Issues
Summary by CodeRabbit
New Features
zipArrayarray utility functionAppNameconfiguration option for app identificationBug Fixes
Documentation
Refactor
getEntriesSnapshot,clearEntries)Chores