UNPKG

@netlify/config

Version:
20 lines (19 loc) 578 B
import fetch from 'node-fetch'; export const getAvailableIntegrations = async function ({ testOpts, offline, }) { if (offline) { return []; } const { host } = testOpts; const baseUrl = new URL(host ? `http://${host}/` : `https://api.netlifysdk.com/`); try { const response = await fetch(`${baseUrl}integrations`); if (response.ok) { const integrations = (await response.json()); return Array.isArray(integrations) ? integrations : []; } return []; } catch { return []; } };