Warn if using an unsupported Node version

This commit is contained in:
mrrfv
2023-09-11 18:42:36 +02:00
parent 6185f9e223
commit aa7cec1e15
+4
View File
@@ -1,6 +1,10 @@
import { ACCOUNT_EMAIL, ACCOUNT_ID, API_HOST, API_TOKEN } from "./constants.js";
if (!globalThis.fetch) {
console.warn("\nIMPORTANT: Your Node.js version doesn't have native fetch support and may not be supported in the future. Please update to v18 or later.\n")
// Advise what to do if running in GitHub Actions
if (process.env.GITHUB_WORKSPACE) console.warn("Since you're running in GitHub Actions, you should update your Actions workflow configuration to use Node v18 or higher.")
// Import node-fetch since there's no native fetch in this environment
globalThis.fetch = (await import("node-fetch")).default;
}