17
17
18
18
const URL_COMPONENT_VERSIONS =
19
19
'https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.config.extensions.json' ;
20
- const URL_COMPONENT_LATEST_VERSIONS = 'https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.legacy-latest-versions.jsonc' ;
20
+ const URL_COMPONENT_LATEST_VERSIONS =
21
+ 'https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.legacy-latest-versions.jsonc' ;
21
22
const validatorRulesProvider = require ( '@ampproject/toolbox-validator-rules' ) ;
22
23
const { MaxAge} = require ( '@ampproject/toolbox-core' ) ;
23
24
const JSON5 = require ( 'json5' ) ;
@@ -117,7 +118,6 @@ async function fetchComponentVersions_(config, runtimeParameters) {
117
118
const componentLatestVersionsUrl = `https://raw.githubusercontent.com/ampproject/amphtml/${ releaseTag } /build-system/compile/bundles.legacy-latest-versions.jsonc` ;
118
119
const componentLatestVersionsUrlFallback = `https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.legacy-latest-versions.jsonc` ;
119
120
120
- debugger ;
121
121
const configResponse = await config . fetch ( componentConfigUrl ) ;
122
122
let latestVersionsConfigResponse = await config . fetch ( componentLatestVersionsUrl ) ;
123
123
if ( ! configResponse . ok ) {
@@ -132,12 +132,16 @@ async function fetchComponentVersions_(config, runtimeParameters) {
132
132
latestVersionsConfigResponse = await config . fetch ( componentLatestVersionsUrlFallback ) ;
133
133
if ( ! latestVersionsConfigResponse . ok ) {
134
134
throw new Error (
135
- `Failed fetching latest component versions from ${ URL_COMPONENT_LATEST_VERSIONS } with status: ${ latestVersionsConfig . status } `
135
+ `Failed fetching latest component versions from ${ URL_COMPONENT_LATEST_VERSIONS } with status: ${ latestVersionsConfigResponse . status } `
136
136
) ;
137
137
}
138
138
}
139
139
const configJson = await configResponse . json ( ) ;
140
- const latestVersionConfigJson = JSON5 . parse ( await latestVersionsConfigResponse . text ( ) ) ;
140
+ const latestVersionsConfigJson = JSON5 . parse ( await latestVersionsConfigResponse . text ( ) ) ;
141
+ configJson . forEach ( ( entry ) => {
142
+ entry [ 'latestVersion' ] = latestVersionsConfigJson [ entry . name ] ;
143
+ } ) ;
144
+ return configJson ;
141
145
}
142
146
143
147
/**
0 commit comments