-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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(locales): ignore all locales from devtools & extension build #6170
Conversation
// @ts-ignore | ||
window.runLighthouseInLR = runLighthouseInLR; | ||
// @ts-ignore | ||
window.getDefaultCategories = background.getDefaultCategories; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do I need to expose this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah you can remove it and the listen fn
If you have a proper way of testing this please let me know. I tested the extension and no errors so far. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice. this matches up with what i was thinking. :)
} | ||
|
||
/** @param {(status: [string, string, string]) => void} listenCallback */ | ||
function listenForStatus(listenCallback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can drop this
// @ts-ignore | ||
window.runLighthouseInLR = runLighthouseInLR; | ||
// @ts-ignore | ||
window.getDefaultCategories = background.getDefaultCategories; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah you can remove it and the listen fn
lighthouse-extension/gulpfile.js
Outdated
const locales = fs.readdirSync('../lighthouse-core/lib/i18n/locales/') | ||
.map(f => require.resolve(`../lighthouse-core/lib/i18n/locales/${f}`)); | ||
|
||
const isDevtools = (file) => new RegExp(`${CONSUMERS.DEVTOOLS}$`).test(file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endsWith?
lighthouse-extension/gulpfile.js
Outdated
|
||
const isDevtools = (file) => new RegExp(`${CONSUMERS.DEVTOOLS}$`).test(file); | ||
const isExtension = (file) => new RegExp(`${CONSUMERS.EXTENSION}$`).test(file); | ||
// const isLightrider = (file) => new RegExp(`${CONSUMERS.LIGHTRIDER}$`).test(file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess you can remove now
lighthouse-extension/gulpfile.js
Outdated
'app/src/lighthouse-background.js', | ||
'app/src/lighthouse-ext-background.js', | ||
], {read: false}) | ||
return gulp.src(Object.values(CONSUMERS).map(consumer => `app/src/${consumer}`), {read: false}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lots going on here. extract the obj.values().map() to a const?
lighthouse-extension/gulpfile.js
Outdated
return gulp.src([ | ||
'dist/scripts/lighthouse-background.js', | ||
'dist/scripts/lighthouse-ext-background.js']) | ||
return gulp.src(Object.values(CONSUMERS).map(consumer => `dist/scripts/${consumer}`)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract to a const
lighthouse-extension/gulpfile.js
Outdated
bundle.ignore(require.resolve('../lighthouse-core/report/html/html-report-assets.js')); | ||
} | ||
|
||
if (isDevtools(file.path) || isExtension(file.path)) { | ||
// eslint-disable-next-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we specify which rule to disable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I don't need it anymore it was for testing console.log
@brendankenny and I thought about renaming the files here and have a proposal:
hows that feel to folks? @wardpeet let's put this filename change into the next PR. |
@@ -6,12 +6,12 @@ | |||
'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brendankenny is it ok if I renamed this file? we were testing LR anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it ok if I renamed this file? we were testing LR anyway.
yep, makes sense
nice!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sure @paulirish |
Summary
We now have 3 files we export devtools, extension and lightrider. Devtools and Extension will exclude all locale files except en-us.json. Lightrider will have all locales.
So what happend here? I created a new file called
lighthouse-lr-background.js
.Sourcemaps can be found:
http://wardpeet-filestorage.surge.sh/lh-store/pr-6170/lighthouse-background
http://wardpeet-filestorage.surge.sh/lh-store/pr-6170/lighthouse-ext-background
http://wardpeet-filestorage.surge.sh/lh-store/pr-6170/lighthouse-lr-background
Related Issues/PRs
#5719