@sap-ux/project-access 1.32.4 → 1.32.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -107,6 +107,10 @@ async function refreshSpecificationDistTags(options) {
|
|
|
107
107
|
logger
|
|
108
108
|
});
|
|
109
109
|
const distTags = JSON.parse(distTagsString);
|
|
110
|
+
if ('error' in distTags) {
|
|
111
|
+
// Abort writing cache: received error in dist-tags response
|
|
112
|
+
throw new Error(distTagsString);
|
|
113
|
+
}
|
|
110
114
|
await (0, file_1.writeFile)(specificationDistTagPath, JSON.stringify(distTags, null, 4));
|
|
111
115
|
const uniqueVersions = new Set(Object.values(distTags));
|
|
112
116
|
// Check if we have cached versions that are not required anymore
|
|
@@ -154,7 +158,16 @@ async function convertDistTagToVersion(distTag, options) {
|
|
|
154
158
|
logger?.debug(`Specification dist-tags not found at '${specificationDistTagPath}'. Trying to refresh.`);
|
|
155
159
|
await refreshSpecificationDistTags({ logger });
|
|
156
160
|
}
|
|
157
|
-
|
|
161
|
+
let specificationDistTags = await (0, file_1.readJSON)(specificationDistTagPath);
|
|
162
|
+
// Validate the current dist-tags file
|
|
163
|
+
if ('error' in specificationDistTags &&
|
|
164
|
+
!(distTag in specificationDistTags) &&
|
|
165
|
+
!('latest' in specificationDistTags)) {
|
|
166
|
+
// Refresh if dist-tags are invalid
|
|
167
|
+
logger?.debug(`Specification dist-tags file has error at '${specificationDistTagPath}'. Trying to refresh.`);
|
|
168
|
+
await refreshSpecificationDistTags({ logger });
|
|
169
|
+
specificationDistTags = await (0, file_1.readJSON)(specificationDistTagPath);
|
|
170
|
+
}
|
|
158
171
|
const version = specificationDistTags[distTag] ?? specificationDistTags.latest;
|
|
159
172
|
return version;
|
|
160
173
|
}
|