|
| 1 | +# [Transition Stacks to a monorepo] |
| 2 | + |
| 3 | +**Date:** 2022-11-28 |
| 4 | + |
| 5 | +**Related PR:** #1191 |
| 6 | + |
| 7 | +## Issue |
| 8 | + |
| 9 | +The Stacks repo is growing in complexity and will soon require many different dependencies that are optional for most consumers. |
| 10 | + |
| 11 | +## Decision |
| 12 | + |
| 13 | +Despite shipping many different concepts (atomic classes, CSS components, JS components), the interdependency chains are relatively linear. This means that we can fairly trivially split the repo into smaller portions. |
| 14 | + |
| 15 | +Our current codebase could be split like so: |
| 16 | +- Atomic classes (no dependencies) |
| 17 | +- CSS Components (depends on Atomic components) |
| 18 | +- JS Components (depends on Stimulus, Popper.js, CSS + Atomic components) |
| 19 | +- Documentation site (depends on JS components, 11ty + plugins) |
| 20 | + |
| 21 | +When the codebase expands in the future, we'll be able to add the following without worrying about consumers needing to import dependencies they don't need: |
| 22 | +- Front-end component library or libraries (e.g. React, Web Components) |
| 23 | +- Large, complex components (e.g. autocomplete) |
| 24 | +- Extra build chain items, such as a [Style Dictionary](https://amzn.github.io/style-dictionary/) |
| 25 | + |
| 26 | +We'd also be able to fold the [Stacks-Icons](https://github.com/StackExchange/Stacks-Icons) and [Stacks-Utils](https://github.com/StackExchange/Stacks-Utils) repos into this main monorepo as well. |
| 27 | + |
| 28 | +## Additional Info |
| 29 | + |
| 30 | +On the technical front, we could manage the monorepo with [npm workspaces](https://docs.npmjs.com/cli/v9/using-npm/workspaces?v=true) or another dedicated tool such as [Rush](https://rushjs.io/pages/intro/welcome/), [Lerna](https://lerna.js.org/) or [Bit](https://bit.dev/). |
| 31 | + |
| 32 | +In regards to changelog / release notes generation, we'd continue using Conventional Commits, but moving to use [release-please](https://github.com/googleapis/release-please) which [does support monorepos](https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md). |
| 33 | + |
| 34 | +For backwards compatibility, we can trivially create a `@stackoverflow/stacks` "meta-package" that simply imports, then re-exports the dependency packages. |
0 commit comments