Skip to content
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

Open
1 task
andrewscfc opened this issue Feb 12, 2021 · 0 comments
Labels
investigation Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test.

Comments

@andrewscfc
Copy link
Contributor

andrewscfc commented Feb 12, 2021

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:

psammead-consent-banner 
|_psammead-styles 7.5.0

installed alongside

psammead-byline
|_psammead-styles 7.0.0

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:

  • The talos bumping bot, raising PRs to update components that depend on new release of sub-dependencies
    • e.g. psammead-styles is released, psammead-consent-banner and psammead-byline etc, are bumped to a newer version and updated to use the new version of psammead-styles
    • on merge these a published to npm
  • In Simorgh we generally integrate all the latest versions of psammead components, assuming talos has bumped all the components we can be assured only one version of a given psammead dependency will be bundled with Simorgh

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:

  • We can change our psammead package imports to use the new single package and demonstrate this has no significant effect on our bundle size
    • We don't want a situation where psammead is added as a single giant bundle and therefore downloaded on every page type, regardless of which components are actually used on that page type

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

  • This feature is expected to need manual testing.

Additional context

Example Psammead Dependency Tree
├── @bbc/[email protected]
├─┬ @bbc/[email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected]
├── @bbc/[email protected]
├── @bbc/[email protected]
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
│ └── [email protected]
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @juggle/[email protected]
│ └── [email protected]
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├── @bbc/[email protected]
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ └── [email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── [email protected] deduped
│ └── [email protected]
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ └── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
├─┬ @bbc/[email protected]
│ ├── [email protected]
│ └─┬ [email protected]
│   └── [email protected]
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── [email protected] deduped
├── @bbc/[email protected]
├── @bbc/[email protected]
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ ├── @bbc/[email protected] deduped
│ ├── UNMET PEER DEPENDENCY @emotion/styled@^10.0.27
│ └── [email protected] deduped
├─┬ @bbc/[email protected]
│ ├── @bbc/[email protected] deduped
│ └── @bbc/[email protected] deduped
├── @bbc/[email protected]
@andrewscfc andrewscfc added Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test. investigation labels Feb 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
investigation Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test.
Projects
None yet
Development

No branches or pull requests

1 participant