Skip to content

Commit

Permalink
misc(build): adjust deployment filenames (#9338)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish authored Jul 9, 2019
1 parent 25b309f commit 5e52dcc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lighthouse-core/scripts/build-report-for-autodeployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp').sync;
const rimraf = require('rimraf').sync;
const swapLocale = require('../lib/i18n/swap-locale.js');

const ReportGenerator = require('../../lighthouse-core/report/report-generator.js');
Expand All @@ -27,7 +28,7 @@ const DIST = path.join(__dirname, `../../dist`);
const filenameToLhr = {
'english': lhr,
'espanol': swapLocale(lhr, 'es').lhr,
'arabic': swapLocale(lhr, 'ar').lhr,
'ɑrabic': swapLocale(lhr, 'ar').lhr,
'xl-accented': swapLocale(lhr, 'en-XL').lhr,
'error': errorLhr,
};
Expand All @@ -36,14 +37,14 @@ const DIST = path.join(__dirname, `../../dist`);
Object.entries(filenameToLhr).forEach(([filename, lhr]) => {
let html = ReportGenerator.generateReportHtml(lhr);
// TODO: PSI is another variant to consider
for (const variant of ['', '-devtools']) {
if (variant === '-devtools') {
for (const variant of ['', '⌣.cdt.']) {
if (variant.includes('cdt')) {
// TODO: Make the DevTools Audits panel "emulation" more comprehensive
// - the parent widget/vbox container with overflow
// - a more constrained/realistic default size
html = html.replace(`"lh-root lh-vars"`, `"lh-root lh-vars lh-devtools"`);
}
const filepath = `${DIST}/${filename}${variant}/index.html`;
const filepath = `${DIST}/${variant}${filename}/index.html`;
mkdirp(path.dirname(filepath));
fs.writeFileSync(filepath, html, {encoding: 'utf-8'});
console.log('✅', filepath, 'written.');
Expand Down Expand Up @@ -124,5 +125,6 @@ async function generateErrorLHR() {
appleTouchIconAudit.scoreDisplayMode = 'binary';
appleTouchIconAudit.score = 1;

rimraf(TMP);
return errorLhr;
}

0 comments on commit 5e52dcc

Please sign in to comment.