Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Improve update-sapui5-types script #464

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion scripts/metadataProvider/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ const RAW_API_JSON_FILES_FOLDER = fileURLToPath(new URL(`../../tmp/apiJson`, imp
export async function fetchAndExtractApiJsons(url: string) {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Unexpected response ${response.statusText}`);
if (response.status === 404) {
throw new Error(`The requested version does not exist`);
} else {
throw new Error(`Unexpected response ${response.status}: ${response.statusText}`);
}
}

if (response.body && response.body instanceof ReadableStream) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/update-sapui5-types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import createMetadataInfo from "./metadataProvider/createMetadataInfo.js";
import createPseudoModulesInfo from "./metadataProvider/createPseudoModulesInfo.js";
import {cleanup, fetchAndExtractApiJsons} from "./metadataProvider/helpers.js";
Expand Down Expand Up @@ -28,6 +29,6 @@ try {
// Update @sapui5/types npm package
await execFile("npm", ["install", "-E", `@sapui5/types@${version}`]);
} catch (err) {
process.stderr.write(String(err));
console.log(err);
process.exit(1);
}
Loading