Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(build): adjust deployment filenames #9338

Merged
merged 1 commit into from
Jul 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}