How to use the netlify/src/addons.createAddon function in netlify

To help you get started, we’ve selected a few netlify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github netlify / cli / src / commands / addons / create.js View on Github external
async function createSiteAddon({ addonName, settings, accessToken, siteData, error }, logger) {
  let addonResponse
  try {
    // TODO update to https://open-api.netlify.com/#/default/createServiceInstance
    addonResponse = await createAddon(settings, accessToken)
  } catch (e) {
    error(e.message)
  }

  if (addonResponse.code === 404) {
    logger(`No add-on "${addonName}" found. Please double check your add-on name and try again`)
    return false
  }
  logger(`Add-on "${addonName}" created for ${siteData.name}`)
  if (addonResponse.config && addonResponse.config.message) {
    logger()
    logger(`${addonResponse.config.message}`)
  }
  return addonResponse
}
github netlify / netlify-dev-plugin / src / utils / addons.js View on Github external
async function actuallyCreateSiteAddon({
  addonName,
  settings,
  accessToken,
  siteData
}) {
  const addonResponse = await createAddon(settings, accessToken);

  if (addonResponse.code === 404) {
    console.log(
      `No add-on "${addonName}" found. Please double check your add-on name and try again`
    );
    return false;
  }
  console.log(`Add-on "${addonName}" created for ${siteData.name}`);
  if (addonResponse.config && addonResponse.config.message) {
    console.log();
    console.log(`${addonResponse.config.message}`);
  }
  return addonResponse;
}
github netlify / cli / src / utils / addons.js View on Github external
async function actuallyCreateSiteAddon({ addonName, settings, accessToken, siteData }) {
  const addonResponse = await createAddon(settings, accessToken)

  if (addonResponse.code === 404) {
    console.log(`No add-on "${addonName}" found. Please double check your add-on name and try again`)
    return false
  }
  console.log(`Add-on "${addonName}" created for ${siteData.name}`)
  if (addonResponse.config && addonResponse.config.message) {
    console.log()
    console.log(`${addonResponse.config.message}`)
  }
  return addonResponse
}