simorgh
simorgh copied to clipboard
10%: Enforce component health for new components
Overall changes
Adding a script to ensure that component health metadata is added for all new components going forward.
The script does the following:
- gets a list of all components within the src/app directory which have an index.stories file
- gets a list of all components within the src/app directory which have a metadata.json file
- has an "allow list" for all of the existing components which have a stories file but don't have a metadata.json file
- if a component does not have a metadata.json file, but the path to that component is not in the allow list, then the script will fail
The component health check script is hooked into the PR checks, so if we add a new component, and do not add a metadata.json file, then the Misc Checks will fail.
In order to get the build to pass, the preferred option is to add a metadata.json file for the component
Code changes
- Add a new script - scripts/componentHealthCheck
- Add a new yarn script as a shortcut to run the script:
yarn test:component-health - Invoke the component health check from the misc checks github action
Testing
- [x] Purposely remove the Byline component from the allow list. Expected result: Misc checks fail. https://github.com/bbc/simorgh/actions/runs/4574070278/jobs/8075254474?pr=10750
- [x] Add Byline to the allow list. Expected result: Misc checks pass. https://github.com/bbc/simorgh/actions/runs/4574226752/jobs/8075586554?pr=10750