Skip to content

Commit 486964c

Browse files
committed
revert the fetchRuntimeParameters changes. not needed
1 parent 3f79437 commit 486964c

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

packages/optimizer/build/downloadRuntimeParameters.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ const JSON5 = require('json5');
5353
`Failed downloading ${extensionConfigUrl} with status ${configResponse.status}`
5454
);
5555
}
56-
// If the fetch for the latestVersion jsonc file fails, we try again using the
57-
// main branch since it might not exist yet in the old releaseTag. The latestVersion's
58-
// are frozen so its unlikely to have changed.
5956
if (!latestVersionsConfigResponse.ok) {
6057
throw new Error(
6158
`Failed fetching latest component versions from ${latestVersionsUrl} with status: ${latestVersionsConfigResponse.status}`

packages/optimizer/lib/fetchRuntimeParameters.js

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@
1717

1818
const URL_COMPONENT_VERSIONS =
1919
'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';
2220
const validatorRulesProvider = require('@ampproject/toolbox-validator-rules');
2321
const {MaxAge} = require('@ampproject/toolbox-core');
24-
const JSON5 = require('json5');
2522
let fallbackRuntime;
2623

2724
try {
@@ -115,33 +112,14 @@ async function fetchComponentVersions_(config, runtimeParameters) {
115112
// Strip the leading two chars from the version identifier to get the release tag
116113
const releaseTag = runtimeParameters.ampRuntimeVersion.substring(2);
117114
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`;
120115

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) {
124118
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}`
126120
);
127121
}
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();
145123
}
146124

147125
/**

0 commit comments

Comments
 (0)