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

extension: refactor option/flag passing (breaking change) #5769

Merged
merged 2 commits into from
Aug 7, 2018

Conversation

paulirish
Copy link
Member

@paulirish paulirish commented Aug 2, 2018

disclaimer: This is a breaking change for our integrations with them so all the clients must also update for this to work.

So I'm okay with delaying this PR for a bit.


This simplifies how we were juggling "options" coming in from extension/devtools/LR. Basically we were passing around an options object in the 2 -background files and all we cared about was its flags property. And in the case of LR, 2 other props came in on options and eventually are delivered into Runner.run, despite our typing.

reviewers:
runner.js only has a rename. boring.
the background files have all the good stuff.

@paulirish paulirish added i18n internationalization thangs chillin ❄ labels Aug 2, 2018
@paulirish
Copy link
Member Author

let's defer this a tad.

@paulirish paulirish removed the i18n internationalization thangs label Aug 2, 2018
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!

🎉 🎉 to understandable options/flags/settings flow :)


const results = await background.runLighthouseForConnection(connection, url, options,
categoryIDs);
// TODO(paulirish): update LR to provide flags and map outputFormat -> output
Copy link
Member

Choose a reason for hiding this comment

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

seems like this TODO shouldn't be in this file? (work here is already done)

@@ -73,19 +73,17 @@ async function runLighthouseInExtension(options, categoryIDs) {
* Run lighthouse for connection and provide similar results as in CLI.
* @param {Connection} connection
* @param {string} url
* @param {{flags: LH.Flags} & {outputFormat: string, logAssets: boolean}} options Lighthouse options.
* @param {LH.Flags & {logAssets: boolean}} flags Lighthouse flags plus logAssets
Copy link
Member

Choose a reason for hiding this comment

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

logAssets could also be a fifth parameter to the function, or we could wait for some future refactor of saveArtifacts/saveAssets/logAssets (or this could @return {Promise<LH.RunnerResult|void>} and the caller could pull the artifacts off there)

@brendankenny
Copy link
Member

tsc also flags

await background.runLighthouseInExtension({flags}, selectedCategories);

as needing to be updated to just using flags

@paulirish paulirish changed the title WIP extension: refactor option/flag passing extension: refactor option/flag passing (breaking change) Aug 7, 2018
@paulirish paulirish merged commit f1fee4e into master Aug 7, 2018
@paulirish paulirish deleted the flagpassing branch August 7, 2018 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants