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

core(lr): add LR presets for desktop and mobile #5886

Merged
merged 8 commits into from
Aug 22, 2018
Merged

core(lr): add LR presets for desktop and mobile #5886

merged 8 commits into from
Aug 22, 2018

Conversation

patrickhulce
Copy link
Collaborator

Introduces a desktop and mobile config preset of LR, mobile is arguably unnecessary but if LR uses it then it allows us to easily change the configuration in the future.

Also brought over a few things from the run string over on LR side to hopefully reduce the complexity there a bit. @paulirish you can comment if you'd prefer to have it here or there.

disableStorageReset: true,
disableDeviceEmulation: true,
throttling: {
// Using a "broadband" connection type
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I ran a few tests with this vs. observed mode unthrottled. Observed tended to produce slightly more optimistic and variable results, so I'm inclined to say we keep this (then we should also be covered for that batch case @paulirish), but I don't feel strongly and would be fine with throttlingMethod: 'observed' as well.

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.

generally lg. a few questions

flags.logLevel = flags.logLevel || 'info';
const config = background.getDefaultConfigForCategories(categoryIDs);
const config = LR_PRESETS[preset || 'lr-mobile'];
Copy link
Member

Choose a reason for hiding this comment

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

wdyt about mapping LR Device -> Preset within here?

Looks like preset would be a string of either: 'UNKNOWN_DEVICE', 'MOBILE', or 'DESKTOP'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, can we name it something other than preset then :)

Copy link
Member

Choose a reason for hiding this comment

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

lrDevice ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sg

flags.logLevel = flags.logLevel || 'info';
const config = background.getDefaultConfigForCategories(categoryIDs);
const config = LR_PRESETS[preset || 'lr-mobile'];
if (categoryIDs) {
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 me or are you also beguiled at how this undefined string actually works.. https://goto.google.com/wmjay

maybe every caller already expresses all cats, so we just never hit it?

😕

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

at how this undefined string actually works...

yeah that's super confusing, my guess is that it's invoked via the template string which will either stringify the value or return 'undefined'?

Copy link
Member

Choose a reason for hiding this comment

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

ah the array (or undefined) is totally manually constructed. L204-218
lovely. :)

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.

% that

@@ -121,7 +121,7 @@ function getFlags(manualArgv) {
])
.choices('output', printer.getValidOutputOptions())
.choices('throttling-method', ['devtools', 'provided', 'simulate'])
.choices('preset', ['full', 'perf', 'mixed-content'])
.choices('preset', ['full', 'perf', 'mixed-content', 'lr-mobile', 'lr-desktop'])
Copy link
Member

Choose a reason for hiding this comment

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

we don't need to expose these to CLI, IMO.
let's keep em private to core.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

kk

@paulirish paulirish merged commit a513c51 into master Aug 22, 2018
@paulirish paulirish deleted the lrpresets branch August 22, 2018 05:25
@paulirish
Copy link
Member

@patrickhulce i notice afterwards that the desktop preset creates a report that still says "Simulated Fast 3G network" at the top. however the items in the footer are correct.

@patrickhulce
Copy link
Collaborator Author

@paulirish yeah but we're not using the header in LR right? didn't think we needed to make that flexible since we're officially saying do this at your own risk :)

@paulirish
Copy link
Member

We use it when using the googleplex demo all with HTML format. But it's not a big deal to me. Just noting it.

@patrickhulce
Copy link
Collaborator Author

We use it when using the googleplex demo all with HTML format.

Oh, ok. Probably worth silently establishing the other network presets as configs and updating the header to match :)

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.

2 participants