netlify / addons

Netlify add-on documentation
34 stars 16 forks source link

[Addons] Add 'message' field to addon `create`, `config`, & `delete` #13

Open DavidWells opened 5 years ago

DavidWells commented 5 years ago

Is your feature request related to a problem? Please describe.

When addons are created, updated, or deleted the user sees a generic message without additional context on what to do next.

Example CLI output with no additional context:

image

VGS needs to tell the user to complete some additional steps to finish setup and would like to log out instructions after creation/updating

A couple of addon providers have requested being able to show a message after netlify addons:create/update/delete

This would be an extra field passed back from their API in the provisioning calls. Example from create

{
  // `id` (required) - A unique ID generated by you, for reference within your own API
  id: uuid(),
+ message: "My custom message for the user to see in the CLI or the UI"
  // `endpoint` (optional) - Proxied endpoint.
  // This will be callable at https://user-netlify-site.com/.netlify/your-addon-namespace
  endpoint: "https://my-endpoint.example.com",
  /* `config` (optional) - This can return back exactly what was received in the POST request, or include additional fields or altered values. This should also be what is returned in response to a GET request to /instances/:id */
  config: {},
  // `env` (optional) - Environment Keys accessible by Netlify user in build context & in functions
  env: {
    'YOUR_SERVICE_API_SECRET': 'value'
  },
  // `snippets` (optional) - JS Snippet content to inject into the calling Netlify site
  snippets: [
    {
      title: 'Snippet From Demo App',
      position: 'head',
      html: `<script>console.log("Hello from ${logValue}")</script>`
    }
  ]
}

Proposed Solution

Add message field to allowed values back from addon endpoints and pass those down to the client (CLI & UI)

Show message here in CLI https://github.com/netlify/cli/blob/master/src/commands/addons/create.js#L65

DavidWells commented 5 years ago

Update:

You can use the message field listed here: https://github.com/netlify/addons/blob/master/README.md#response-to-netlify-1 in the creation flow.

This only works for the creation flow. We still need to update the update and delete flows to support messages