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(locales): ignore all locales from devtools & extension build #6170

Merged
merged 6 commits into from
Oct 4, 2018

Conversation

wardpeet
Copy link
Collaborator

@wardpeet wardpeet commented Oct 3, 2018

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

@wardpeet wardpeet changed the title chore misc(locales): ignore all locales from devtools & extension build Oct 3, 2018
// @ts-ignore
window.runLighthouseInLR = runLighthouseInLR;
// @ts-ignore
window.getDefaultCategories = background.getDefaultCategories;
Copy link
Collaborator Author

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?

Copy link
Member

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

@wardpeet
Copy link
Collaborator Author

wardpeet commented Oct 3, 2018

If you have a proper way of testing this please let me know. I tested the extension and no errors so far.

Copy link
Member

@paulirish paulirish left a 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) {
Copy link
Member

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;
Copy link
Member

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 Show resolved Hide resolved
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endsWith?


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);
Copy link
Member

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

'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})
Copy link
Member

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?

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}`))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract to a const

bundle.ignore(require.resolve('../lighthouse-core/report/html/html-report-assets.js'));
}

if (isDevtools(file.path) || isExtension(file.path)) {
// eslint-disable-next-line
Copy link
Member

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?

Copy link
Collaborator Author

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

@paulirish
Copy link
Member

@brendankenny and I thought about renaming the files here and have a proposal:

## src 
devtools-entry.js
extention-entry.js
lightrider-entry.js

## dest
lighthouse-dt-bundle.js
lighthouse-ext-bundle.js
lighthouse-lr-bundle.js

hows that feel to folks? @wardpeet let's put this filename change into the next PR.

@@ -6,12 +6,12 @@
'use strict';
Copy link
Collaborator Author

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.

Copy link
Member

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

@paulirish paulirish merged commit 1ce80f4 into master Oct 4, 2018
@paulirish paulirish deleted the chore/locale-bundling branch October 4, 2018 19:27
@paulirish
Copy link
Member

nice!!
ward wanna take these renames now? #6170 (comment)

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wardpeet
Copy link
Collaborator Author

wardpeet commented Oct 4, 2018

Sure @paulirish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants