Right now the Codex repo has four workspaces that each build their own build products, but none of them build something that we could publish to NPM. The main approaches I think we could take are:
- Publish each workspace as a separate package
- This would require renaming the workspaces to their equivalent NPM package names, e.g. codex-icons instead of icons, codex-tokens instead of design-tokens and codex-components (or codex?) instead of vue-components
- End users would have to import both the components and the icons package for typical usage, which is not very user-friendly. End users that need tokens would also need to import a third package.
- We would be able to deliver separate CommonJS/UMD builds for components and icons without having to do anything weird in our Vite config
- Publishing would be more laborious, because there would be more packages to keep track of
- Publish everything as one big package
- This would not require renaming any existing workspaces. We'd publish from a new, separate workspace.
- End users would have a more user-friendly experience of being able to use one NPM package that gives them everything they need (components, icons and tokens)
- Delivering split CommonJS/UMD builds could be trickier: they would probably require more configuration, and we would likely have to come up with unique global variable names for each of them
- Combine 1+2: publish each package separately, but also publish a wrapper package that groups them (similar to what Vue does)
- End users would still be able to use one package for everything
- CJS/UMD end users who need separate builds could get them from the subpackages; we wouldn't need much additional configuration to make this work
- We would still have to rename our workspaces to match the subpackage names
- We would have to keep track of even more NPM packages that we publish (four instead of three)