No bundling
The intention of this PR is to make the build system easier for newcomers.
It contains lots of changes and it should be seen as a starting point for discussions not like a finished PR that should be merged as-is. It's a proposal from me based on my experience trying to get started working on Fireproof.
The most important change is that there's no bundling happening anymore. As Fireproof is bleeding edge, I think it's fair to focus on an ESM-only world. Fireproof is a library, hence always part of a bigger project. So anyone using Fireproof should be open to use any bundler they like. In order to enable that, it's easiest to not bundle things at all. This may reduce the number of duplicated dependencies and also enables tree shaking, so the final bundle should be able to become as small as it can.
The other benefit is, that no vendoring is needed anymore, those modules work as expected.
Another change is that the use-fireproof package is re-introduced. Instead of having a react export as part of @fireproof/core make it completely separate. This has two advantages, one is that if someone uses @fireproof/core only and doesn't need support for React, the bundle size (in case the bundler doesn't do proper dead code elimination) might be smaller. The other one is that it can server as a good example on how to create a framework tailored version Fireproof that only depends on its public API.
As not use-fireproof is a proper package again, it made sense to re-introduce a workspace again, as it was before https://github.com/fireproof-storage/fireproof/pull/132 was merged. That PR contains lots of changes, hence it's hard to tell what exactly the reason was to move away from a workspace. Things seem to work well and more standard. For example a package.json for each package that work with plain npm.
Summary by CodeRabbit
Based on the comprehensive summary of changes, here are the release notes:
Release Notes
-
Project Restructuring
- Simplified project structure with a new monorepo configuration
- Updated TypeScript configuration to use project references
- Consolidated build and testing scripts
-
Dependency Management
- Removed vendor-specific import prefixes
- Streamlined external package imports
- Reduced overall development dependencies
-
Package Updates
- Updated
use-fireproofpackage to version 0.20 - Added support for React 19
- Improved module path and export configurations
- Updated
-
Development Tools
- Updated ESLint and Prettier configurations
- Simplified Vitest testing setup
- Removed legacy build and packaging scripts
-
Performance and Maintenance
- Cleaned up commented code
- Removed unused test and configuration files
- Enhanced type checking and module resolution
Walkthrough
This pull request represents a significant restructuring of the Fireproof project's package configuration, module imports, and development tooling. The changes primarily focus on simplifying import paths, removing vendor-specific prefixes, consolidating configuration files, and streamlining the project's dependency management. Key modifications include updating TypeScript configurations, removing unnecessary files, standardizing ESLint and Vitest configurations across packages, and reorganizing the project's structure to use workspace-based dependencies.
Changes
| File/Directory | Change Summary |
|---|---|
.prettierignore |
Deleted file that previously specified formatting exclusions |
eslint.config.mjs |
Deleted ESLint configuration file |
eslint.shared.mjs |
New shared ESLint configuration |
package-fireproof-core.json |
Removed package metadata file |
package.json |
Significant script and dependency modifications |
packages/core/* |
Multiple files updated with simplified import paths |
packages/use-fireproof/* |
New configuration files and package restructuring |
tsconfig.json |
Restructured to use project references |
tsconfig.shared.json |
New shared TypeScript configuration |
Possibly related PRs
- #490: Potential connection to formatting practice changes
- #521: Significant project structure modifications
- #526: Changes in interface and type management
✨ Finishing Touches
- [ ] 📝 Generate Docstrings (Beta)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Generate unit testing code for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. (Beta) -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
I've talked about this a bit with @mabels over Discord, here's the current outcome:
- Bundling: I misunderstood the current bundling. I thought it's a bundle with all dependencies. That's not the case, it just bundles the Fireproof code into a single ESM module file. @mabels goal is to have a smaller overall bundle. As Fireproof is a library and I prefer keeping things simple (and reducing maintenance burdens) I would not bundle at all and leave the decision on how to bundle to the user using the library as part of their project. But I can also live with the current bundling.
- Vendoring: I thought the vendoring is needed when Fireproof is used with esm.sh. But that doesn't seem to be the case, as it my version it just works. @mabels mentioned that it's special environments like svelte native or react native are a problem. Though we both agreed that ideally vendoring is not needed and we'll try to get rid of it. @mabels already provided lots of PRs for the upstream dependencies, but it might also be possible to do something downstream.
- Packages: Making
@fireproof/coreanduse-fireproof"usual" packages that can be build the usual way, instead of copying files around etc.. This was postponed to a later date as @mabels is currently busy with more important things.
So after almost half a year i got it done. I just merged into main the new monorepo structure with 100% esm-only version no bundling .....
Thx for this inspiration.
Meno