w3c / sustyweb

Sustainable Web Design Community Group
https://www.w3.org/community/sustyweb/
Other
153 stars 9 forks source link

Google Lighthouse Plugin #54

Open AlexDawsonUK opened 7 months ago

AlexDawsonUK commented 7 months ago

Note: The below was discussed at our monthly meeting (25/10/23) by Zoe, so to avoid the useful feedback getting buried in our minutes doc I'm raising it here (copied in full) so that we can utilize it when we get the opportunity as a roadmapped feature.

High-level insights from LH PM Scale of impact: Are we targeting individual developers, or sites at scale?

Lighthouse plugin recommended as initial step

Attribution: Could recommendations also identify parts of the architecture that might have the biggest impact for each specific scenario?

Business: Connection to analytics could strengthen the narrative

Integrating feedback with the community and next steps

What would the future of tooling look like?

Credit: @notmariazoe

airbr commented 7 months ago

Hello, I am catching up on this, I am very interested in seeing how the guidelines could relate to lighthouse, and I volunteer myself to help with anything I can. @notmariazoe @AlexDawsonUK .

I would be interested for example, in some of the kinds of tests that Are my third parties green? tests for: https://aremythirdpartiesgreen.com/ but reproduced in a lighthouse context. It would in my mind bring the audits for sustainability to a wider audience

notmariazoe commented 7 months ago

Thanks for the feedback @airbr ! Those tests sound great, but wouldn't they be an addendum to the WSGs?

I would love to do a mapping to understand the degree of automation of WSGs, and then we could also consider extra tests to include. I see that #29 has a headstart there.

Would you be happy if I added you to a public repo to work on this together? Would you want to be part of it @AlexDawsonUK ?

AlexDawsonUK commented 7 months ago

@notmariazoe We do have an issue (#11) which talks about the creation of a test suite (it's on my todo list for the next draft). I'll be working out parameters, and publishing details to create and test them in an open sub-directory of this repo.

This will hopefully form the basis of the testability criteria for issue #29 (I spoke about it very briefly during the meeting).

Edit: Once I've worked out all the details, I'll be sure to let everyone know!

notmariazoe commented 7 months ago

I meant directly testable with existing Lighthouse Audits, to leverage them in the plugin, rather than through an external test suite! As for the repo for the Plugin, are you happy with me creating it independently?

AlexDawsonUK commented 7 months ago

Oh, absolutely, feel free to create and tag me & Tim in!

airbr commented 7 months ago

I meant directly testable with existing Lighthouse Audits, to leverage them in the plugin, rather than through an external test suite! As for the repo for the Plugin, are you happy with me creating it independently?

Ill look out for this and also feel free to tag me. Any work done in this area will be useful and inform future efforts I think!

fershad commented 7 months ago

@notmariazoe the tests on https://aremythirdpartiesgreen.com/ actually take data from a Lighthouse run (network-requests audit) and then parses that data along with inputs from https://github.com/patrickhulce/third-party-web and Green Web Foundation API. Not sure if that's too much abstraction for what you're after (??)

I'd be happy to contribute to a plugin as well once there's a repo.

AlexDawsonUK commented 5 months ago

Note: @mgifford makes some useful comments regarding scanning & testing in #28.

notmariazoe commented 5 months ago

Thanks for the note! Apologies for the delay in the creation of the repo - the shell has been there for a while but something unexpected came up. I trust I'll be able to have at least a minimal config to tag folks on by the end of this week.

notmariazoe commented 5 months ago

Looking into docs to populate the repository with at least a few samples based on the WSGs, I have confirmed a suspicion I had. One of the key guidelines for the creation of new audits for lighthouse is to not use 3rd party APIs for completing the audit check.

This will make leveraging CO2.js or the GWF API more difficult. I see the GWF plugin actually uses their own 3rd Party API, so maybe we can get an exception. It would be great if someone from the GWF team could shed some light into this.

In the meantime I'll keep setting this up and will keep you posted.

fershad commented 5 months ago

A workaround to using the API is to check against a snapshot of our (GWF) dataset.

We make this available at https://admin.thegreenwebfoundation.org/admin/green-urls but as you can see, the last snapshot was run in November & is likely a fair bit out of date. We're hoping to set it up to run daily again, but right now we're prioritising other bits of work.

One downside of using the snapshot is that it only captures known green URLs, which are URLs which have been checked against our API and are known to be green hosted. So if I've got a new website hosted on a green provider & then check it against the snapshot it won't show up as green. Using the snapshot will also mean a need for a regular update cadence for the Lighthouse Plugin to keep it up to date.

It's also worth bearing in mind the size of the snapshot, almost 150MB at present when compressed.

There is code in CO2.js to check against a database snapshot, however we don't expose it in the NPM package. If there's a desire to take this approach, I'd suggest looking at another library of ours https://github.com/thegreenwebfoundation/url2green-js

A complete alternative to this would be to have a link out from that section of the audit to our Green Web Check https://www.thegreenwebfoundation.org/green-web-check/?url=<SOME_URL> and let people find out that way.

airbr commented 5 months ago

I have no useful input to say other than I am really interested and enthusiastic for this line of thought and work

DSGND commented 5 months ago

If I may suggest this plugin : https://github.com/cnumr/lighthouse-plugin-ecoindex

notmariazoe commented 4 months ago

I believe that while all those plugins are great at offering information and other perspectives, a plugin for the WSGs should try to map the WSGs themselves with pass or fail criteria based on artifacts available in LH.

This would ensure that we're working on common ground, rather than integrating perspectives that aren't necessarily shared by everyone (as some calculations might be).

So, to say it with other words, the purpose of this plugin is to be an automated, LH-integrable way to test the WSGs, not to integrate other measurements or metrics.

And on that note, if we ever wish to see a future where this is integrated with other LH audits (or its own categories), we must also follow the guidelines for audit creation. This is why it's best to avoid not following the best practices (eg 3P API requests)

I believe the test suite will provide better indications for this, but I'm planning on doing some initial mapping based on 3.x (unfortunately the dedication I can provide to this is lesser than I'd like!)