v3.accords-library.com/scripts/download-payload-sdk.ts

15 lines
392 B
TypeScript
Raw Normal View History

2024-02-17 22:11:17 +00:00
import { writeFileSync } from "fs";
const PAYLOAD_FOLDER = `${process.cwd()}/src/shared/payload`;
const sdk = await fetch(`${import.meta.env.PAYLOAD_API_URL}/sdk`);
if (!sdk.ok) {
console.error("Failed to get the sdk", sdk.status, sdk.statusText);
} else {
const sdkFile = await sdk.text();
2024-02-17 22:11:17 +00:00
writeFileSync(`${PAYLOAD_FOLDER}/payload-sdk.ts`, sdkFile, {
encoding: "utf-8",
});
}