Skip to content

Commit

Permalink
feat: rename ecoindex audits groups to help lhci
Browse files Browse the repository at this point in the history
  • Loading branch information
hrenaud committed Apr 29, 2024
1 parent 4097214 commit 9863704
Showing 1 changed file with 39 additions and 33 deletions.
72 changes: 39 additions & 33 deletions lighthouse-plugin-ecoindex/plugin.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// eslint-disable-next-line no-unused-vars
import * as i18n from 'lighthouse/core/lib/i18n/i18n.js'
import fs from 'fs';
import { fileURLToPath } from 'url';

import { fileURLToPath } from 'url'
import fs from 'fs'
import path from 'path'

function getVersion(){
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const rawdata = fs.readFileSync(__dirname + '/package.json');
const pluginPackage = JSON.parse(rawdata);
return pluginPackage.version;
function getVersion() {
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const rawdata = fs.readFileSync(__dirname + '/package.json')
const pluginPackage = JSON.parse(rawdata)
return pluginPackage.version
}
/** @type {LH.Config.Plugin} */
export default {
Expand Down Expand Up @@ -69,25 +70,25 @@ export default {
},
],
groups: {
ecologic: {
'ecoindex-ecologic': {
title: 'Ecoindex results',
description: 'Ecoindex revealant metrics.',
},
technic: {
'ecoindex-technic': {
title: 'Technical results',
description: 'Technical metrics.',
},
'best-practices': {
'ecoindex-best-practices': {
title: '#RWEB web eco-design: 115 best practices',
description:
'CNUMR (Collectif Conception Numérique Responsable) "115 best practices" reference framework.',
},
'rgesn-practices': {
'ecoindex-rgesn-practices': {
title:
'#RGESN General eco-design guidelines for digital servicesBest practices',
description: 'General eco-design guidelines for digital services.',
},
'other-practices': {
'ecoindex-other-practices': {
title: 'Other ecodesign best practices',
description: 'Various best practices in eco-design.',
},
Expand All @@ -97,74 +98,79 @@ export default {
title: 'Ecoindex',
description:
'[Ecoindex®](https://www.ecoindex.fr/) revealant metrics, by [GreenIT.fr®](https://www.greenit.fr). ' +
'[GitHub](https://github.com/NovaGaia/lighthouse-plugin-ecoindex). Version: ' + getVersion(),
'[GitHub](https://github.com/NovaGaia/lighthouse-plugin-ecoindex). Version: ' +
getVersion(),
auditRefs: [
// no category audit, warn on nodes count
{ id: 'warn-nodes-count', weight: 0 },
// ecologic
{ id: 'eco-index-score', weight: 1, group: 'ecologic' },
{ id: 'eco-index-grade', weight: 0, group: 'ecologic' },
{ id: 'eco-index-water', weight: 0, group: 'ecologic' },
{ id: 'eco-index-ghg', weight: 0, group: 'ecologic' },
{ id: 'eco-index-score', weight: 1, group: 'ecoindex-ecologic' },
{ id: 'eco-index-grade', weight: 0, group: 'ecoindex-ecologic' },
{ id: 'eco-index-water', weight: 0, group: 'ecoindex-ecologic' },
{ id: 'eco-index-ghg', weight: 0, group: 'ecoindex-ecologic' },
// technic
// lighthouse-nodes is deprecated, see warn-nodes-count
// { id: 'lighthouse-nodes', weight: 0, group: 'technic' },
{ id: 'eco-index-nodes', weight: 0, group: 'technic' },
{ id: 'eco-index-size', weight: 0, group: 'technic' },
{ id: 'eco-index-requests', weight: 0, group: 'technic' },
{ id: 'eco-index-nodes', weight: 0, group: 'ecoindex-technic' },
{ id: 'eco-index-size', weight: 0, group: 'ecoindex-technic' },
{ id: 'eco-index-requests', weight: 0, group: 'ecoindex-technic' },
// best-practices
{ id: 'bp-print-css', weight: 0, group: 'best-practices' },
{ id: 'bp-print-css', weight: 0, group: 'ecoindex-best-practices' },
{
id: 'bp-add-headers-expire-and-cache-control',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-unminified-css',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-unminified-javascript',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-uses-http2',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-errors-in-console',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-redirects',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-uses-text-compression',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-no-document-write',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-plugins',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-image-size-responsive',
weight: 0,
group: 'best-practices',
group: 'ecoindex-best-practices',
},
{
id: 'bp-thegreenwebfoundation',
weight: 0,
group: 'ecoindex-other-practices',
},
{ id: 'bp-thegreenwebfoundation', weight: 0, group: 'other-practices' },
],
},
}

0 comments on commit 9863704

Please sign in to comment.