Sanity Studio Dashboard Widget for triggering Netlify builds.
To get dashboard support in Sanity Studio in general:
sanity install @sanity/dashboard
sanity install dashboard-widget-netlify
- Implement your own dashboardConfig. In your
sanity.jsonfile, append the following line to thepartsarray:
{
"implements": "part:@sanity/dashboard/config",
"path": "src/dashboardConfig.js"
}- Create the file
src/dashboardConfig.jsand inlcude thenetlifywidget 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'
}
]
}
}
]
}title - Override the widget default title
sites[] - Your Netlify sites to show deploys for
apiId- The Netfliy API id of your site (see Settings > General/Site Details > Site Information Box).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 titlename- The Netlify site name
To simulate using your development version as a real module inside a studio, you can do the following:
- Run
npm install && npm linkfrom the root of this repository. - Run
npm run watchto start developing and build the module when changes are made.
With the mono-repo's test-studio:
- Bootstrap the monorepo:
npm run bootstrap - Add
sanity-plugin-dashboard-widget-netlifywith the current version number topackage.jsonin thetest-studioroot folder (but don't runnpm installafterwards) - Run
npm link sanity-plugin-dashboard-widget-netlifyinside the mono-repo's root. - Restart the
test-studio
With a regular Sanity Studio:
- Run
npm install - Add
sanity-plugin-dashboard-widget-netlifywith the current version number topackage.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.