Skip to content

Commit

Permalink
feat: example lhci
Browse files Browse the repository at this point in the history
  • Loading branch information
hrenaud committed Apr 27, 2024
1 parent 0616818 commit 795f2f4
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 111 deletions.
2 changes: 2 additions & 0 deletions examples/lhci/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.lighthouserc.js
.lighthouserc.cjs
.lighthouserc.mjs
lighthouse-plugin-ecoindex
!.lighthouseci/.gitkeep
50 changes: 50 additions & 0 deletions examples/lhci/.lighthouserc.cjs.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
const path = require('path');
function getLighthouseConfig(){
return path.join(
require.resolve('lighthouse-plugin-ecoindex'),
'../helpers/lhci/custom-config.cjs'
)
}
function getPuppeteerConfig(){
return 'node_modules/lighthouse-plugin-ecoindex/helpers/.puppeteerrc.cjs'
}
module.exports = {
ci: {
collect: {
url: [
'https://www.ecoindex.fr/',
'https://www.ecoindex.fr/comment-ca-marche/',
],
numberOfRuns: 1,
settings: {
// must adapte the path to the custom-config.js file, it must be an absolute path
configPath: getLighthouseConfig(),
},
puppeteerLaunchOptions: {
headless: 'new',
args: [
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--no-sandbox',
],
},
puppeteerScript:
getPuppeteerConfig(),
},
assert: {
preset: 'lighthouse:default',
},
upload: {
target: 'lhci',
serverBaseUrl: 'http://localhost:9001', // The Lighthouse CI server URL
token: 'xxx', // The Lighthouse CI server build token for the project
ignoreDuplicateBuildFailure: true,
},
},
}
52 changes: 0 additions & 52 deletions examples/lhci/.lighthouserc.js.template

This file was deleted.

57 changes: 0 additions & 57 deletions examples/lhci/.puppeteerrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions examples/lhci/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"description": "Test with lhci",
"scripts": {
"lhci": "npm run lhci:collect && npm run lhci:upload",
"lhci": "npm run lhci:healthcheck && npm run lhci:collect && npm run lhci:upload",
"lhci:collect": "lhci collect --url https://www.ecoindex.fr/ --url https://www.ecoindex.fr/comment-ca-marche/",
"lhci:upload": "lhci upload",
"clean": "rm -rf .lighthouseci/* && touch .lighthouseci/.gitkeep"
Expand All @@ -16,4 +16,4 @@
"lighthouse": "^11.3.0",
"lighthouse-plugin-ecoindex": "4.0.0-beta.0"
}
}
}

0 comments on commit 795f2f4

Please sign in to comment.