fireproof icon indicating copy to clipboard operation
fireproof copied to clipboard

No bundling

Open vmx opened this issue 11 months ago • 2 comments

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-fireproof package to version 0.20
    • Added support for React 19
    • Improved module path and export configurations
  • 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

vmx avatar Jan 27 '25 00:01 vmx

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?

❤️ Share
🪧 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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere 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.

coderabbitai[bot] avatar Jan 27 '25 00:01 coderabbitai[bot]

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/core and use-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.

vmx avatar Jan 28 '25 10:01 vmx

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

mabels avatar Jul 10 '25 06:07 mabels