|
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 = |
21 |
| - 'https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.legacy-latest-versions.jsonc'; |
22 | 20 | const validatorRulesProvider = require('@ampproject/toolbox-validator-rules');
|
23 | 21 | const {MaxAge} = require('@ampproject/toolbox-core');
|
24 |
| -const JSON5 = require('json5'); |
25 | 22 | let fallbackRuntime;
|
26 | 23 |
|
27 | 24 | try {
|
@@ -115,33 +112,14 @@ async function fetchComponentVersions_(config, runtimeParameters) {
|
115 | 112 | // Strip the leading two chars from the version identifier to get the release tag
|
116 | 113 | const releaseTag = runtimeParameters.ampRuntimeVersion.substring(2);
|
117 | 114 | const componentConfigUrl = `https://raw.githubusercontent.com/ampproject/amphtml/${releaseTag}/build-system/compile/bundles.config.extensions.json`;
|
118 |
| - const componentLatestVersionsUrl = `https://raw.githubusercontent.com/ampproject/amphtml/${releaseTag}/build-system/compile/bundles.legacy-latest-versions.jsonc`; |
119 |
| - const componentLatestVersionsUrlFallback = `https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.legacy-latest-versions.jsonc`; |
120 | 115 |
|
121 |
| - const configResponse = await config.fetch(componentConfigUrl); |
122 |
| - let latestVersionsConfigResponse = await config.fetch(componentLatestVersionsUrl); |
123 |
| - if (!configResponse.ok) { |
| 116 | + const response = await config.fetch(componentConfigUrl); |
| 117 | + if (!response.ok) { |
124 | 118 | throw new Error(
|
125 |
| - `Failed fetching latest component versions from ${URL_COMPONENT_VERSIONS} with status: ${configResponse.status}` |
| 119 | + `Failed fetching latest component versions from ${URL_COMPONENT_VERSIONS} with status: ${response.status}` |
126 | 120 | );
|
127 | 121 | }
|
128 |
| - // If the fetch for the latestVersion jsonc file fails, we try again using the |
129 |
| - // main branch since it might not exist yet in the old releaseTag. The latestVersion's |
130 |
| - // are frozen so its unlikely to have changed. |
131 |
| - if (!latestVersionsConfigResponse.ok) { |
132 |
| - latestVersionsConfigResponse = await config.fetch(componentLatestVersionsUrlFallback); |
133 |
| - if (!latestVersionsConfigResponse.ok) { |
134 |
| - throw new Error( |
135 |
| - `Failed fetching latest component versions from ${URL_COMPONENT_LATEST_VERSIONS} with status: ${latestVersionsConfigResponse.status}` |
136 |
| - ); |
137 |
| - } |
138 |
| - } |
139 |
| - const configJson = await configResponse.json(); |
140 |
| - const latestVersionsConfigJson = JSON5.parse(await latestVersionsConfigResponse.text()); |
141 |
| - configJson.forEach((entry) => { |
142 |
| - entry['latestVersion'] = latestVersionsConfigJson[entry.name]; |
143 |
| - }); |
144 |
| - return configJson; |
| 122 | + return response.json(); |
145 | 123 | }
|
146 | 124 |
|
147 | 125 | /**
|
|
0 commit comments