hackoregon / civic

The frontend monorepo for the CIVIC platform.
http://civicplatform.org
MIT License
60 stars 26 forks source link

[RFC] Component Library Migration Plan #1207

Open jaronheard opened 4 years ago

jaronheard commented 4 years ago

Component Library Migration Plan

Summary

A plan to migrate from using the component-library to using the smaller modules outlined in #1200

Motivation

Primary motivations

Module size & performance

The component-library is 8.47 MB unpacked, which is way, way too big, especially when you're trying to use CIVIC components outside of civicplatform.org. You should be able to use a Button without adding mapping libraries as dependencies. (Note that unpacked size isn't really the right way to measure the size of the module, but rest assured it is way too big, even if I don't have the gzipped numbers)

Smaller modules are easier to improve and maintain

By breaking up modules into smaller parts, we can make smaller areas of responsibility that can have the opportunity to engage contributors more effectively.

Detailed design

Plan

  1. Initial implementation of smaller modules a. #1200, which breaks out the smaller modules, but leaves the component-library as the default
  2. Cleanup smaller module implementation a. #1208, tooling & build scripts a. #1209, improve documentation
  3. Switch to usage of smaller modules in civic repo a. Update default Storybook to use smaller modules. Also our hosted Storybook would be updated at this time. b. Update civicplatform.org to use smaller modules by replacing all uses of component-library in the 2018 package.
  4. Publish "final" ci version of component-library with deprecation warning
  5. Switch to usage of smaller modules in other projects a. For example, Open Elections
  6. Remove component-library from the civic repo

How we teach this

We'll want to update our documentation and Storybook to reflect the use of these smaller modules.

Drawbacks

There is a transition period where we'll have both sets of modules in the repo.

Alternatives

This could be done in a different order. It could be possible to split out the new modules into a separate repo.

Unresolved questions

When exactly is it ok to remove the component-library?