Lighthouse report automation
An easy way to have automated Lighthouse reports is using the Google tool called Lighthouse CI that allows us to pass the ligthouse test to a website and save the results on a server to compare them with the results of other executions.
You can see the improvements in performance, accessibility, SEO, etc. of your website. You can even add new rules with custom plugins, for example, to check that no html has been added that does not comply with the accessibility rules.
In a future post the idea is to create a lighthouse plugin from scratch to check some unwritten SEO "rules" in each of my posts.
To always have a current snapshot of the sitemap of my site I use playwright to check the sitemap, have the link tree and create a flowchart using Treant.js as you can see here lighthouse report.
How did I do it?
1. Get all urls from your sitemap
2. Run lighthouse on each of the urls and save the report.
3. Create an organisation chart using Treant.js
Example of the first level of the tree only
All the code is available in my github repository
Run your script and deploy the files to a static server like Vercel.
node main.js
If you want to see the results just click on "Lightouse" in the top navigation bar.