sanity-io / sanity-plugin-dashboard-widget-netlify Goto Github PK
View Code? Open in Web Editor NEWSanity Studio Dashboard Widget for triggering Netlify builds
License: MIT License
Sanity Studio Dashboard Widget for triggering Netlify builds
License: MIT License
We are using this plugin for a multi-site setup but have some content that spans across the network of sites. Rather than having to manually publish each site, it would be useful to have the option of clicking a single button to redeploy all of the sites on Netlify.
I'm happy to look at making this modification, but it may take a while as I'll have to fit the change in around actual work.
Cheers all
I was able to follow the documentation for setting up the plugin and connecting my Gatsby site hosted with Netlify in the dashboardConfig file. The point of confusion for me was when I needed to connect the Sanity Studio. I am not hosting my studio on Netlify, but rather Sanity itself so I wasn't clear on what configs to add to this object:
{
title: 'Sanity Studio',
apiId: 'xxxxx-yyyy-zzzz-xxxx-yyyyyyyy',
buildHookId: 'xxxyyyxxxyyyyxxxyyy',
name: 'sanity-gatsby-blog-20-studio',
}
I took a wild stab and got it right that I didn't need that object and needed to set up a webhook that connected to my netlify build hook I set up. Below is a set by step guide on how to achieve this assuming the user has already created and configured their netlify build hook:
It would actually be awesome to also have a usage dashboard widget for Sanity itself.
The same info would be quite useful to pull in from Gatsby Hosting / Cloud.
For a client, I wanted to set up a staging website where he can preview his changes and easily share the URL. I used Netlify branch deploy with the URL https://staging--website.netlify.com.
In the dashboard widget, I registered the production website and the staging website, with each its own build hook.
Everything worked fine, except that both Netlify badges are linked with the production website. I've looked online and it seems that it's not possible to get badges for branch deploys.
It's a pity because this badge is a clever and easy way to show the build status.
Do you have an idea how to show the build status for branch deploys inside the widget?
In Netlify CMS, the user has to click the button "Check for preview" to see if the preview is ready.
Another way would be to provide a setting to at least hide the badge.
Hi. I just started using this plugin and my Netlifty deploys fail because of the conflicting peer dependency @sanity/ui v. 0.36.17
7:52:53 PM: npm ERR! Found: @sanity/[email protected]
7:52:53 PM: npm ERR! node_modules/@sanity/ui
7:52:53 PM: npm ERR! @sanity/ui@"^0.37.2" from @sanity/[email protected]
7:52:53 PM: npm ERR! node_modules/@sanity/base
7:52:53 PM: npm ERR! @sanity/base@"^2.27.2" from the root project
7:52:53 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
7:52:53 PM: npm ERR! peer @sanity/base@"^2.0.0" from @sanity/[email protected]
7:52:53 PM: npm ERR! node_modules/@sanity/dashboard
7:52:53 PM: npm ERR! @sanity/dashboard@"^2.29.2" from the root project
7:52:53 PM: npm ERR! 6 more (@sanity/default-layout, @sanity/desk-tool, ...)
7:52:53 PM: npm ERR! @sanity/ui@"^0.37.2" from @sanity/[email protected]
7:52:53 PM: npm ERR! node_modules/@sanity/dashboard
7:52:53 PM: npm ERR! @sanity/dashboard@"^2.29.2" from the root project
7:52:53 PM: npm ERR! 6 more (@sanity/default-layout, @sanity/default-login, ...)
7:52:53 PM: npm ERR!
7:52:53 PM: npm ERR! Could not resolve dependency:
7:52:53 PM: npm ERR! sanity-plugin-dashboard-widget-netlify@"^1.2.1" from the root project
7:52:53 PM: npm ERR!
7:52:53 PM: npm ERR! Conflicting peer dependency: @sanity/[email protected]
7:52:53 PM: npm ERR! node_modules/@sanity/ui
7:52:53 PM: npm ERR! peer @sanity/ui@"^0.36.12" from [email protected]
7:52:53 PM: npm ERR! node_modules/sanity-plugin-dashboard-widget-netlify
7:52:53 PM: npm ERR! sanity-plugin-dashboard-widget-netlify@"^1.2.1" from the root project
7:52:53 PM: npm ERR!
7:52:53 PM: npm ERR! Fix the upstream dependency conflict, or retry
7:52:53 PM: npm ERR! this command with --force, or --legacy-peer-deps
7:52:53 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
7:52:53 PM: npm ERR!
7:52:53 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
7:52:53 PM: npm ERR! A complete log of this run can be found in:
7:52:53 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-04-03T18_52_50_009Z-debug-0.log
7:52:53 PM: Error during NPM install
7:52:53 PM: Build was terminated: Build script returned non-zero exit code: 1
7:52:53 PM: Failing build: Failed to build site
7:52:53 PM: Finished processing build request in 9.193144098s
I've been forced to use the --legacy-peer-deps
install option to make the site build on my local environment but I don't know of a way to influence the npm install
operation on Netlify.
I'm mapping out datasets to Netlify branch deploys and was wondering if there was an easy way to configure this? They're not different apps, so adding a site with the same apiID seems a little goofy. I'd prefer not to trigger a development deploy every time a production article gets updated.
When I see the Netlify build logs from my clients, I see that they triggered multiple builds in a very short time span. For example, one of the websites takes about 2 minutes to build and the logs show something like 12:03, 12:05, 12:07.
I suspect that they click several times (by accident) on the deploy button, which queues up deploy commands.
From my testing, double-clicking the deploy button doesn't trigger two builds. However, after ~10 seconds, it will trigger a new build.
I propose to disable the deploy button right after clicking on it and to enable again at after the build has completed.
What do you think? Have you fellow devs run into a similar issue with clients?
For sites with custom domains, it would be great to be able to override the url
prop with a custom domain.
Something along these lines:
{
name: 'netlify',
options: {
title: 'Deployments',
sites: [
{
title: 'Website',
apiId: 'xxxx-xxxxx',
buildHookId: 'xxxxxxxxx',
name: 'website',
url: 'https://example.com/'
}
]
}
}
When pushing content changes through git to a site on a multi-site monorepo, all utilising different datasets of a sanity project, Netlify will cancel all sites with no content changes and display the cancelled badge.
On the widget in Sanity, cancelled sites will show the failed badge, is this intentional?
I'd love to fork this as a basis for a similar non-Netlify integration (possibly too specific to be useful to anyone else).
So far as I've spotted, all I have to go on for the license is the package.json
MIT declaration.
Please would you consider adding a LICENSE file to this repository? Thank you.
I noticed the following file was expected to be there, but VSCode is outputting the following error:
File '<path to install>/studio/node_modules/sanity-plugin-dashboard-widget-netlify/dist/types/sanity-plugin-dashboard-widget-netlify.d.ts' not found.
Maybe it would be good if there is an option for refreshing data before deploying (for those who are using API CDN).
A screenshot and slightly more detailed description of what this plugin does (or does not do) would be much appreciated as it helps a lot with figuring out whether it's going to be worth the effort to set up.
A few questions I had as an outsider from skimming the readme were:
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
Using a curated preset maintained by
These problems occurred while renovating this repository. View logs.
These branches will be created by Renovate only once you click their checkbox below.
@commitlint/cli
, @commitlint/config-conventional
)@commitlint/cli
, @commitlint/config-conventional
)@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
)@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
, eslint-config-sanity
)These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@babel/preset-env
, @babel/preset-react
, @commitlint/cli
, @commitlint/config-conventional
, @sanity/dashboard
, @sanity/pkg-utils
, @sanity/plugin-kit
, @sanity/semantic-release-preset
, @sanity/ui
, @testing-library/jest-dom
, @types/jest
, @types/react
, @types/react-dom
, @types/styled-components
, @typescript-eslint/eslint-plugin
, @typescript-eslint/parser
, actions/checkout
, actions/setup-node
, eslint
, eslint-config-prettier
, eslint-plugin-react
, jest
, jest-date-mock
, jest-environment-jsdom
, prettier
, prettier-plugin-packagejson
, react
, react-dom
, sanity
, styled-components
, ts-jest
, typescript
).github/workflows/main.yml
actions/checkout v3@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
actions/setup-node v3@8c91899e586c5b171469028077307d293428b516
actions/checkout v3@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
actions/setup-node v3@8c91899e586c5b171469028077307d293428b516
actions/checkout v3@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
actions/setup-node v3@8c91899e586c5b171469028077307d293428b516
package.json
@sanity/incompatible-plugin ^1.0.4
@sanity/ui ^1.0.0
abort-controller ^2.0.3
react-props-stream ^1.0.1
rxjs ^6.6.7
@babel/preset-env ^7.19.4
@babel/preset-react ^7.18.6
@commitlint/cli ^17.2.0
@commitlint/config-conventional ^17.2.0
@sanity/dashboard ^3.0.0
@sanity/pkg-utils ^1.17.2
@sanity/plugin-kit ^2.1.5
@sanity/semantic-release-preset ^2.0.2
@testing-library/jest-dom ^5.16.5
@testing-library/react ^13.4.0
@types/jest ^29.2.1
@types/react ^18
@types/react-dom ^18
@types/styled-components ^5.1.26
@typescript-eslint/eslint-plugin ^5.42.0
@typescript-eslint/parser ^5.42.0
eslint ^8.26.0
eslint-config-prettier ^8.5.0
eslint-config-sanity ^6.0.0
eslint-plugin-prettier ^4.2.1
eslint-plugin-react ^7.31.10
eslint-plugin-react-hooks ^4.6.0
jest ^29.2.2
jest-date-mock ^1.0.8
jest-environment-jsdom ^29.2.2
prettier ^2.7.1
prettier-plugin-packagejson ^2.3.0
react ^18
react-dom ^18
rimraf ^3.0.2
sanity ^3.0.0
styled-components ^5.3.6
ts-jest ^29.0.3
typescript ^4.8.4
@sanity/dashboard ^3.0.0
react ^18
react-dom ^18
sanity ^3.0.0
styled-components ^5.2
node >=14
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.