UNPKG

@netlify/config

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