This repository has been archived by the owner on Aug 13, 2023. It is now read-only.
Investigate reducing the number of Psammead dependencies we have to integrate into Simorgh #4338
Labels
investigation
Refinement Needed
This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test.
Is your feature request related to a problem? Please describe.
Psammead is a monorepo of visual components primarily used in Simorgh but also by other BBC teams and potentially other open source projects; currently, we build, publish the components individually. As a consequence, in Simorgh we have to integrate each component individually. This approach allows for a 'mix and match' integration of Psammead components, e.g. a newer version of
psammead-consent-banner
while other components are left pinned to older versions. Allowing this though has consequences, particularly around sub-dependencies, in the example above in Simorgh we would have:installed alongside
This means that two versions of
psammead-styles
will be bundled with the Simorgh application, bloating the production bundle and giving a poorer experience to users through an increased download size. This situation could become a lot worse depending on how many combinations of psammead components are installed simulataneously in Simorgh at different versions.We mitigate a lot of these problems using two approaches:
psammead-styles
is released,psammead-consent-banner
andpsammead-byline
etc, are bumped to a newer version and updated to use the new version ofpsammead-styles
As above, when we deviate from the second point we get a bloated production bundle.
Additionaly using an inconsistent combination of psammead packages can cause visual inconsitencies, recently we nearly released Simorgh with components using two different versions of a BBC font for RTL languages as we were fixing a bug in one component at the same time as upgrading a fonts in a common, shared dependency of most psammead packages.
Supporting all this flexibility causes us to need a package bumping bot and tooling to publish the packages invidiually.
Describe the solution you'd like
Create a spike branch for psammead implementing the following:
Add a new psammead package that exports all psammead packages via one package taking a similar approach to the chakra component library; the package could be published under a new name such as
psammead-react
to allow us to test without interfering with live integrations in Simorgh and beyond. We could then install this into Simorgh (see approach from chakra: https://github.com/chakra-ui/chakra-ui/tree/main/packages/react#installing-chakra-ui) on a spike branch and verify a hypothesis:The theory behind this is that rather than facilitating a 'mix and match' approach to installing psammead packages, this approach allows us to release one single package with all our dependencies setup in a predictable way. We will make it no longer possible to use two different versions of psammead styles at the same time; we keep releases simple and focused and what new functionality they are enabling. If we need to do patches on older versions of the single psammead package, we could consider practicing gitflow where we could branch off a previous version and a hotfix release to fix a bug while a new version with some new functionality is in progress.
Describe alternatives you've considered
In discussions we have suggested various other approaches to this problem:
Simplify our package structure
Decrease the number and depth of dependencies in our psammead dependency tree, our existing model works better with a shallower dependency tree as we don't need to run talos and publish packages as many times.
Move some packages to Simorgh
Some packages are quite tightly coupled to Simorgh and are not so much 'atomic' components you would expect to find in a component library, e.g. radio-schedules; lifting these into Simorgh would simplify our dependency tree and decrease the amount of packages to manage in psammead.
Testing notes
[Tester to complete]
Dev insight: Will there be any potential regression? etc
Additional context
Example Psammead Dependency Tree
The text was updated successfully, but these errors were encountered: