-
Notifications
You must be signed in to change notification settings - Fork 243
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
fix auto fetching of "latestVersion" configuration from amphtml repo #1273
Conversation
@sebastianbenz what is the different between |
bf41d59
to
42cc87d
Compare
42cc87d
to
486964c
Compare
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.
Thanks for fixing! One nit, otherwise looks good.
throw new Error(`Failed downloading ${extensionConfigUrl} with status ${response.status}`); | ||
const latestVersionsUrl = `https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.legacy-latest-versions.jsonc`; | ||
|
||
const configResponse = await fetch(extensionConfigUrl); |
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 parallelize the two requests?
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.
yes. ill make the change
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.
done.
// We add back the "latestVersion" field so that the auto importer | ||
// code knows what "stable" version of the extension to use. | ||
extensionConfig.forEach((entry) => { | ||
entry['latestVersion'] = latestVersionsConfig[entry.name]; |
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!
const response = await fetch(extensionConfigUrl); | ||
if (!response.ok) { | ||
throw new Error(`Failed downloading ${extensionConfigUrl} with status ${response.status}`); | ||
const latestVersionsUrl = `https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.legacy-latest-versions.jsonc`; |
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.
Cool. I've essentially taken this same approach in ampproject/amp-wp#6803.
This is no longer needed as the ampproject#1273 brings back the "latestVersion" in the configuration
the previous fix which assumed that the highest version of an extension should be automatically used by the auto importer is incorrect. for example on some instances the newest version is not yet in stable and should not be used.
We fetch the frozen latest version configuration and merge it to generate an "extensionConfig.json" with a "latestVersion" field