-
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
core(fr): add base config #11915
core(fr): add base config #11915
Conversation
202073f
to
d750427
Compare
* @param {Object<string, any>|Array<any>} extension | ||
* @param {boolean=} overwriteArrays | ||
*/ | ||
function _mergeConfigFragment(base, extension, overwriteArrays = 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.
logic here was untouched but comment and name are new
function expandAuditShorthand(audits) { | ||
if (!audits) { | ||
return null; | ||
function expandAuditShorthand(audit) { |
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.
changed to operate on an individual audit instead of an array for consistency with gatherers, otherwise untouched
} else { | ||
// See if the audit is a Lighthouse core audit. | ||
const auditPathJs = `${audit.path}.js`; |
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.
extracted this into requireAudit
for structural consistency with resolveGathererToDefn
function requireAudits(audits, configDir) { | ||
const expandedAudits = expandAuditShorthand(audits); | ||
if (!expandedAudits) { | ||
function resolveAuditsToDefns(audits, configDir) { |
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.
I stopped short of converting this one to individual because of the minor annoyance of the Runner.getAuditList
call, but if everyone would prefer that final step for more complete consistency, I'm game
@@ -0,0 +1,107 @@ | |||
/** | |||
* @license Copyright 2020 The Lighthouse Authors. All Rights Reserved. |
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.
I did write this file in 2020, before anyone asks :P
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!
Summary
Base config logic for the new Fraggle Rock config. It's lots of lines, but mostly a move + adding missing tests.
config.js
toconfig-helpers.js
merge
was fairly generic when it has some highly specific config logic it it, renamed tomergeConfigFragment
resolveThing
is the new nomenclature used for converting from config input to config output (i.e.thingJson
tothingDefn
). This was previously some mixture ofrequireThing
/initializeThing
requireThing
is now just the logic to actually require an individualThing
fraggle-rock/config/config.js
to contain new config logic.Related Issues/PRs
ref #11313
Design Doc