|
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 | 21 | const validatorRulesProvider = require('@ampproject/toolbox-validator-rules');
|
21 | 22 | const {MaxAge} = require('@ampproject/toolbox-core');
|
| 23 | +const JSON5 = require('json5'); |
22 | 24 | let fallbackRuntime;
|
23 | 25 |
|
24 | 26 | try {
|
@@ -111,15 +113,29 @@ async function fetchComponentVersionsFromCache_(config, runtimeParameters) {
|
111 | 113 | async function fetchComponentVersions_(config, runtimeParameters) {
|
112 | 114 | // Strip the leading two chars from the version identifier to get the release tag
|
113 | 115 | const releaseTag = runtimeParameters.ampRuntimeVersion.substring(2);
|
| 116 | + console.log('releaseTag', releaseTag); |
114 | 117 | 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`; |
115 | 119 |
|
116 |
| - const response = await config.fetch(componentConfigUrl); |
117 |
| - if (!response.ok) { |
| 120 | + const configResponse = await config.fetch(componentConfigUrl); |
| 121 | + const latestVersionsConfigResponse = await config.fetch(componentLatestVersionsUrl); |
| 122 | + if (!configResponse.ok) { |
| 123 | + console.log('a'); |
| 124 | + debugger; |
| 125 | + throw new Error( |
| 126 | + `Failed fetching latest component versions from ${URL_COMPONENT_VERSIONS} with status: ${configResponse.status}` |
| 127 | + ); |
| 128 | + } |
| 129 | + if (!latestVersionsConfig.ok) { |
| 130 | + console.log('b'); |
| 131 | + debugger; |
118 | 132 | throw new Error(
|
119 |
| - `Failed fetching latest component versions from ${URL_COMPONENT_VERSIONS} with status: ${response.status}` |
| 133 | + `Failed fetching latest component versions from ${URL_COMPONENT_LATEST_VERSIONS} with status: ${latestVersionsConfig.status}` |
120 | 134 | );
|
121 | 135 | }
|
122 |
| - return response.json(); |
| 136 | + console.log('c'); |
| 137 | + debugger; |
| 138 | + return configResponse.json(); |
123 | 139 | }
|
124 | 140 |
|
125 | 141 | /**
|
|
0 commit comments