48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import type { UserConfig } from 'unlighthouse'
|
|
|
|
export default async (): Promise<UserConfig> => {
|
|
/* fetch sitemap from debug container */
|
|
const sitemap = await (await fetch('http://website:8081/sitemap-0.xml')).text();
|
|
/* format URLs to work with debug container */
|
|
const urls = sitemap.match(/<loc>(.*?)<\/loc>/g)!.map(
|
|
(loc) => loc.replace(/<\/?loc>/g, '').replace(/https:\/\/firq.dev/g, 'http://website:8081')
|
|
);
|
|
/* ensure serve is already "warm", preventing startup lag that reduces performance */
|
|
for (const url of urls) { await fetch(url) };
|
|
/* actual config */
|
|
return {
|
|
lighthouseOptions: {
|
|
throttlingMethod: 'devtools',
|
|
throttling: {
|
|
cpuSlowdownMultiplier: 4,
|
|
requestLatencyMs: 150,
|
|
downloadThroughputKbps: 1638.4,
|
|
uploadThroughputKbps: 1638.4,
|
|
},
|
|
screenEmulation: {
|
|
width: 412,
|
|
height: 823,
|
|
deviceScaleFactor: 1.75,
|
|
},
|
|
skipAudits: [ 'is-on-https', 'redirects-http', 'uses-http2' ],
|
|
},
|
|
puppeteerOptions: {
|
|
args: [ '--no-sandbox', '--disable-setuid-sandbox' ],
|
|
},
|
|
puppeteerClusterOptions: {
|
|
maxConcurrency: 1
|
|
},
|
|
ci: {
|
|
budget: 50,
|
|
buildStatic: true,
|
|
},
|
|
scanner: {
|
|
sitemap: false,
|
|
dynamicSampling: false,
|
|
samples: 1,
|
|
},
|
|
outputPath: 'unlighthouse-reports',
|
|
cache: true,
|
|
urls
|
|
}
|
|
}
|