This commit is contained in:
Peter Hedenskog 2022-10-03 15:45:20 +02:00 committed by soulgalore
parent 1aa0aceb3d
commit 16fadbefcc
4 changed files with 37 additions and 21 deletions

View File

@ -1483,6 +1483,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
describe: 'Test if the web page is sustainable.',
group: 'Sustainable'
})
.option('sustainable.model', {
describe: 'Model used for measure digital carbon emissions.',
default: '1byte',
choices: ['1byte', 'swd'],
group: 'Sustainable'
})
.option('sustainable.pageViews', {
describe: 'Number of page views used when calculating CO2.',
group: 'Sustainable'

View File

@ -64,7 +64,10 @@ module.exports = {
type: 'run'
})
);
log.info('Use the sustainable web plugin');
log.info(
'Use the sustainable web plugin with model %s',
this.sustainableOptions.model
);
break;
}
@ -89,7 +92,7 @@ module.exports = {
await tgwf.hosting.loadJSON(greenDomainJSONpath)
);
}
const CO2 = new tgwf.co2();
const CO2 = new tgwf.co2(this.sustainableOptions.model);
const co2PerDomain = CO2.perDomain(message.data, hostingGreenCheck);
const baseDomain = message.data.baseDomain;

43
npm-shrinkwrap.json generated
View File

@ -11,7 +11,7 @@
"dependencies": {
"@google-cloud/storage": "5.19.3",
"@influxdata/influxdb-client": "^1.28.0",
"@tgwf/co2": "0.8.0",
"@tgwf/co2": "0.10.4",
"aws-sdk": "2.1121.0",
"axe-core": "4.4.3",
"browsertime": "16.17.0",
@ -970,20 +970,27 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/@tgwf/co2": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/@tgwf/co2/-/co2-0.8.0.tgz",
"integrity": "sha512-vN08Vf3ziOuaZ8MQM+rO3g9T5kPg2ygp6uE7GgLwkd7TvoIX10Zw3G1ouZtwxY5wy0oXuMRN6X3OGcrP1YGSVA==",
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/@tgwf/co2/-/co2-0.10.4.tgz",
"integrity": "sha512-IE9JZeetUeKR0/up+fOKY9RSZssA3YlL2axdou7nu8nQFAnzu46aQb2M4pTUE0DjR2InmCFPXSDQeI912LexYg==",
"dependencies": {
"debug": "^4.1.1"
"debug": "^4.3.4"
}
},
"node_modules/@tgwf/co2/node_modules/debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)",
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dependencies": {
"ms": "^2.1.1"
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/@tgwf/co2/node_modules/ms": {
@ -9308,19 +9315,19 @@
}
},
"@tgwf/co2": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/@tgwf/co2/-/co2-0.8.0.tgz",
"integrity": "sha512-vN08Vf3ziOuaZ8MQM+rO3g9T5kPg2ygp6uE7GgLwkd7TvoIX10Zw3G1ouZtwxY5wy0oXuMRN6X3OGcrP1YGSVA==",
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/@tgwf/co2/-/co2-0.10.4.tgz",
"integrity": "sha512-IE9JZeetUeKR0/up+fOKY9RSZssA3YlL2axdou7nu8nQFAnzu46aQb2M4pTUE0DjR2InmCFPXSDQeI912LexYg==",
"requires": {
"debug": "^4.1.1"
"debug": "^4.3.4"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "^2.1.1"
"ms": "2.1.2"
}
},
"ms": {

View File

@ -78,7 +78,7 @@
"dependencies": {
"@google-cloud/storage": "5.19.3",
"@influxdata/influxdb-client": "^1.28.0",
"@tgwf/co2": "0.8.0",
"@tgwf/co2": "0.10.4",
"aws-sdk": "2.1121.0",
"axe-core": "4.4.3",
"browsertime": "16.17.0",