Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

sanity-plugin-dashboard-widget-netlify

1.0.1 • Public • Published

Sanity Dashboard Widget: Netlify

Sanity Studio Dashboard Widget for triggering Netlify builds.

Installing

Install the dashboard plugin

To get dashboard support in Sanity Studio in general:

sanity install @sanity/dashboard

Install the Netlify widget plugin

sanity install dashboard-widget-netlify

Configuring

  1. Implement your own dashboardConfig. In your sanity.json file, append the following line to the parts array:
{
  "implements": "part:@sanity/dashboard/config",
  "path": "src/dashboardConfig.js"
}
  1. Create the file src/dashboardConfig.js and inlcude the netlify widget config like this:
export default {
  widgets: [
      {
      name: 'netlify',
      options: {
        title: 'My Netlify deploys',
        sites: [
          {
            title: 'Sanity Studio',
            apiId: 'xxxxx-yyyy-zzzz-xxxx-yyyyyyyy',
            buildHookId: 'xxxyyyxxxyyyyxxxyyy',
            name: 'sanity-gatsby-blog-20-studio',
          },
          {
            title: 'Website',
            apiId: 'yyyyy-xxxxx-zzzz-xxxx-yyyyyyyy',
            buildHookId: 'yyyyxxxxxyyyxxdxxx',
            name: 'sanity-gatsby-blog-20-web'
          }
        ]
      }
    }
  ]
}

Widget options

title - Override the widget default title

sites[] - Your Netlify sites to show deploys for

  • apiIdId- The Netfliy API id of your site
  • buildHookId - The id of a build hook you have created for your site within the Netlify administration panel (see Settings > Continous Deployment).
  • title - Override the site name with a custom title
  • name - The Netlify site name

Developing on this module

To simulate using your development version as a real module inside a studio, you can do the following:

  • Run npm install && npm link from the root of this repository.
  • Run npm run watch to start developing and build the module when changes are made.

Displaying your development version inside a studio

With the mono-repo's test-studio:

  • Bootstrap the monorepo: npm run bootstrap
  • Add sanity-plugin-dashboard-widget-netlify with the current version number to package.json in the test-studio root folder (but don't run npm install afterwards)
  • Run npm link sanity-plugin-dashboard-widget-netlify inside the mono-repo's root.
  • Restart the test-studio

With a regular Sanity Studio:

  • Run npm install
  • Add sanity-plugin-dashboard-widget-netlify with the current version number to package.json.
  • Run npm link sanity-plugin-dashboard-widget-netlify
  • Start the studio

When you are done and have published your new version, you can run npm unlink inside this repo, and npm unlink sanity-plugin-dashboard-widget-netlify inside the mono-repo or studio to get back to the normal state. Then run npm run bootstrap for the mono-repo or npm install inside the regular studio to use the published version.

Install

npm i sanity-plugin-dashboard-widget-netlify

DownloadsWeekly Downloads

3,010

Version

1.0.1

License

MIT

Unpacked Size

8.32 MB

Total Files

45

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar