Doist / reactist

Open source React components made with โค๏ธ by Doist
http://doist.github.io/reactist
MIT License
253 stars 21 forks source link

Improve tooling of reactist #675

Open gnapse opened 2 years ago

gnapse commented 2 years ago

โ‰๏ธ Why

๐Ÿ—บ Overview

โœ… Task Breakdown

  1. Build Process

    We want to unify and simplify our build process while making it faster if possible. This includes:

    • [x] Remove built artifacts from source control (#252)
    • [ ] Switch off from TSDX to another setup (webpack? esbuild? Something else?)
      • Should we make storybook and our apps build share the same build process (related: #465)
    • [ ] Support tree-shaking. Apps and other libraries using Reactist must only include strictly what they are using from it, and nothing more.
    • [ ] Support TypeScript, CSS modules and SVGs imported as React components. It must also support .less while we still rely on it, as we gradually move away from it.
  2. Automated project life-cycle

    Implement automation of versioning and release. This could be achieved drawing inspiration, for instance, from how jest-dom does it (powered internally by cycjimmy/semantic-release-action).

    This includes:

    • [ ] Having actions that make sure that all commits and/or PR titles follow the Angular Commit Message Conventions.
    • [ ] The release automation draws conclusions from the commits/PRs in the release, to determine if the release is a patch, minor or major (breaking change) release.
    • [ ] Push actions to main trigger a new release fully automatically, including determining the new version.
    • [ ] Automated release of storybooks to https://doist.github.io/reactist/
  3. PR review process aids

๐Ÿšง Potential problems / unknowns

๐Ÿ”ฎ Out of scope / future improvements

๐Ÿ“ Related documents & discussion

frankieyan commented 2 weeks ago

A proposal from @pawelgrimm (ref) is to switch away from publishing Reactist as an npm package, and leveraging shadcn's cli - which lives in https://github.com/shadcn/ui - allowing the Reactist source files to be copied into consumer codebases in an automated. way. This avoids having to rely on the "link" mechanism when dealing with local npm packages and docker.

Pros/cons:

  • ๐Ÿ‘ Much easier to customize
  • ๐Ÿ‘ No real build process needed in Reactist (shadcn already provides the script to โ€œcompileโ€ the registry)
  • ๐Ÿ‘ Better DX (develop directly against todoist-web, then commit the same patch to Reactist)
  • ๐Ÿ‘Ž Worse upgrade experience (manually integrate updates from Reactist into todoist-web)
  • ๐Ÿ‘Ž Looser constraints (i.e. Reactist canโ€™t impose any hard rules, they can be overridden easily within the consuming code)

To make this work, we'll have to enforce (whether automated or not) on the todoist-web side that Reactist source files are not to be manipulated, similar to how we treat other build artifacts like colour variables.

Next step: small PoC to demonstrate to the team how this works.

gnapse commented 2 weeks ago

Thanks for summarizing that down, @frankieyan. It's really helpful.

About those cons.

Worse upgrade experience (manually integrate updates from Reactist into todoist-web)

Why is this exactly worse? Assuming we have a script to do it, it should not be too different from increasing a version number in package.json and running npm install. Or am I missing something?

Looser constraints (i.e. Reactist canโ€™t impose any hard rules, they can be overridden easily within the consuming code)

I could see that as a positive, depending on how easily things can be overridden. As in "can they be inadvertently overridden easily?" or is it more like "they can be easily overridden, but doing it is explicit enough so that you are unlike to do it by accident".

By "overriding" you refer to what you talk about at the end, regarding the modification of the Reactist artifacts? If so, then I agree that we should do something to prevent that, and possibly we can do that. Or is the "overriding con" about other types of overrides?