sanity-plugin-dashboard-widget-vercel 1.1.1 → 2.0.0-v3-studio.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +41 -34
  2. package/LICENSE +1 -1
  3. package/README.md +51 -36
  4. package/lib/cjs/index.js +1710 -0
  5. package/lib/cjs/index.js.map +1 -0
  6. package/lib/esm/index.js +1703 -0
  7. package/lib/esm/index.js.map +1 -0
  8. package/lib/types/index.d.ts +47 -0
  9. package/lib/types/index.d.ts.map +1 -0
  10. package/package.json +86 -67
  11. package/sanity.json +3 -8
  12. package/lib/app.js +0 -168
  13. package/lib/client.js +0 -17
  14. package/lib/components/DeployButton/index.js +0 -101
  15. package/lib/components/Deployment/index.js +0 -107
  16. package/lib/components/DeploymentPlaceholder/index.js +0 -43
  17. package/lib/components/DeploymentTarget/index.js +0 -61
  18. package/lib/components/DeploymentTargets/index.js +0 -31
  19. package/lib/components/Deployments/index.js +0 -191
  20. package/lib/components/DialogForm/index.js +0 -363
  21. package/lib/components/FormFieldInputLabel/index.js +0 -65
  22. package/lib/components/FormFieldInputText/index.js +0 -43
  23. package/lib/components/PlaceholderAvatar/index.js +0 -28
  24. package/lib/components/PlaceholderText/index.js +0 -35
  25. package/lib/components/StateDebug/index.js +0 -52
  26. package/lib/components/StatusDot/index.js +0 -29
  27. package/lib/components/TableCell/index.js +0 -79
  28. package/lib/constants.js +0 -35
  29. package/lib/hooks/useDeployments.js +0 -96
  30. package/lib/index.js +0 -25
  31. package/lib/machines/deploy.js +0 -166
  32. package/lib/machines/deploymentTargetList.js +0 -143
  33. package/lib/machines/dialog.js +0 -54
  34. package/lib/machines/form.js +0 -112
  35. package/lib/machines/refresh.js +0 -37
  36. package/lib/types/index.js +0 -1
  37. package/lib/utils/fetcher.js +0 -96
  38. package/lib/utils/sanitizeFormData.js +0 -34
package/CHANGELOG.md CHANGED
@@ -1,39 +1,56 @@
1
+ <!-- markdownlint-disable --><!-- textlint-disable -->
2
+
3
+ # 📓 Changelog
4
+
5
+ All notable changes to this project will be documented in this file. See
6
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
+
8
+ ## [2.0.0-v3-studio.1](https://github.com/sanity-io/sanity-plugin-dashboard-widget-vercel/compare/v1.1.1...v2.0.0-v3-studio.1) (2022-09-02)
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+
12
+ - v3 version
13
+
14
+ ### Features
15
+
16
+ - initial V3 version ([d73b762](https://github.com/sanity-io/sanity-plugin-dashboard-widget-vercel/commit/d73b762ed8b07a696b6c422cfc977d01c28e323b))
17
+
18
+ ### Bug Fixes
19
+
20
+ - v3 version ([ed8b793](https://github.com/sanity-io/sanity-plugin-dashboard-widget-vercel/commit/ed8b79337dab47316efe8620f5f109edd8381d65))
21
+
1
22
  # Changelog
2
23
 
3
24
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
25
 
5
26
  ### [1.1.1](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v1.1.0...v1.1.1) (2022-01-03)
6
27
 
7
-
8
28
  ### Bug Fixes
9
29
 
10
- * correctly namespace deployment target _ids ([cd97cd3](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/cd97cd39bd35260efe728c796d8cbadf4d788aa6))
30
+ - correctly namespace deployment target \_ids ([cd97cd3](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/cd97cd39bd35260efe728c796d8cbadf4d788aa6))
11
31
 
12
32
  ## [1.1.0](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v1.0.0...v1.1.0) (2021-03-25)
13
33
 
14
-
15
34
  ### Features
16
35
 
17
- * use API-versioned client if available ([44ca27f](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/44ca27fbd0649be8c050aad8b7eecf67324ee65d))
36
+ - use API-versioned client if available ([44ca27f](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/44ca27fbd0649be8c050aad8b7eecf67324ee65d))
18
37
 
19
38
  ## [1.0.0](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.1.5...v1.0.0) (2021-03-24)
20
39
 
21
-
22
40
  ### ⚠ BREAKING CHANGES
23
41
 
24
- * Deployment targets are now configured within sanity - please remove any vercel
25
- related configuration you may have stored inside your dashboard config file. Support for forcing
26
- small layout has also been (temporarily) dropped.
42
+ - Deployment targets are now configured within sanity - please remove any vercel
43
+ related configuration you may have stored inside your dashboard config file. Support for forcing
44
+ small layout has also been (temporarily) dropped.
27
45
 
28
46
  ### Features
29
47
 
30
- * store tokens in a namespaced sanity document, add support for multiple deploy targets ([a1a3446](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/a1a34464590934f1bf7adf3812f29acbef3ed314))
31
-
48
+ - store tokens in a namespaced sanity document, add support for multiple deploy targets ([a1a3446](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/a1a34464590934f1bf7adf3812f29acbef3ed314))
32
49
 
33
50
  ### Bug Fixes
34
51
 
35
- * add eventless transitions to deployment target list machine ([7a6d921](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/7a6d921e05c238adbb335331531999a31f680b14))
36
- * set correct form defaults, update input descriptions, include target name in deploy button ([bf10600](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/bf106000b1a69c9f127f517da98d901fbbbcd481))
52
+ - add eventless transitions to deployment target list machine ([7a6d921](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/7a6d921e05c238adbb335331531999a31f680b14))
53
+ - set correct form defaults, update input descriptions, include target name in deploy button ([bf10600](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/bf106000b1a69c9f127f517da98d901fbbbcd481))
37
54
 
38
55
  ### [0.1.5](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.1.4...v0.1.5) (2021-01-23)
39
56
 
@@ -41,70 +58,60 @@ small layout has also been (temporarily) dropped.
41
58
 
42
59
  ### [0.1.3](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.1.2...v0.1.3) (2020-11-23)
43
60
 
44
-
45
61
  ### Bug Fixes
46
62
 
47
- * add babel plugin-transform-runtime ([7a5ad89](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/7a5ad89b553387717017be01ee3778c641fca570))
63
+ - add babel plugin-transform-runtime ([7a5ad89](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/7a5ad89b553387717017be01ee3778c641fca570))
48
64
 
49
65
  ### [0.1.2](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.1.1...v0.1.2) (2020-11-23)
50
66
 
51
-
52
67
  ### Bug Fixes
53
68
 
54
- * don't return an empty array prior to aliases being fetched ([856be29](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/856be2981a9c02362d80212f6f773669a6fd7094))
69
+ - don't return an empty array prior to aliases being fetched ([856be29](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/856be2981a9c02362d80212f6f773669a6fd7094))
55
70
 
56
71
  ### [0.1.1](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.1.0...v0.1.1) (2020-11-21)
57
72
 
58
-
59
73
  ### Bug Fixes
60
74
 
61
- * add babel preset-env ([4da6993](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/4da69936e8158277fe9b9a77b491516e74dec4b3))
75
+ - add babel preset-env ([4da6993](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/4da69936e8158277fe9b9a77b491516e74dec4b3))
62
76
 
63
77
  ## [0.1.0](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.0.6...v0.1.0) (2020-11-21)
64
78
 
65
79
  ### [0.0.6](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.0.5...v0.0.6) (2020-11-21)
66
80
 
67
-
68
81
  ### Features
69
82
 
70
- * allow deployLimit to be user configurable, minor cleanup" ([d15f4a8](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/d15f4a8f0ffa1525cb106a2006ff61ef53c29401))
71
-
83
+ - allow deployLimit to be user configurable, minor cleanup" ([d15f4a8](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/d15f4a8f0ffa1525cb106a2006ff61ef53c29401))
72
84
 
73
85
  ### Bug Fixes
74
86
 
75
- * correctly show cancelled dot color ([5045a3d](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/5045a3d4c9e3ba94945a97d3f1dfd5b636cf184a))
87
+ - correctly show cancelled dot color ([5045a3d](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/5045a3d4c9e3ba94945a97d3f1dfd5b636cf184a))
76
88
 
77
89
  ### [0.0.5](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.0.4...v0.0.5) (2020-11-20)
78
90
 
79
-
80
91
  ### Features
81
92
 
82
- * make deployHook optional, show error snackbar on refresh error, add deployment skeleton" ([a24071e](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/a24071e7ab9d44f9b1a655cb260ee0680c698617))
93
+ - make deployHook optional, show error snackbar on refresh error, add deployment skeleton" ([a24071e](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/a24071e7ab9d44f9b1a655cb260ee0680c698617))
83
94
 
84
95
  ### [0.0.4](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.0.3...v0.0.4) (2020-11-20)
85
96
 
86
-
87
97
  ### Features
88
98
 
89
- * create dedicated cell components, force cell widths, minor cleanup ([fb4b36a](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/fb4b36a14332eb61f4f0f44484b2570a1b248418))
90
- * display configuration error message, store config error in machine context ([e8ce270](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/e8ce270cf74215f5419a1053426d2742d2d3eee3))
91
-
99
+ - create dedicated cell components, force cell widths, minor cleanup ([fb4b36a](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/fb4b36a14332eb61f4f0f44484b2570a1b248418))
100
+ - display configuration error message, store config error in machine context ([e8ce270](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/e8ce270cf74215f5419a1053426d2742d2d3eee3))
92
101
 
93
102
  ### Bug Fixes
94
103
 
95
- * add delay to DEPLOYED event before forcing refresh ([cd104fc](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/cd104fc8ba39ed601a39a7f139121106910dc3da))
104
+ - add delay to DEPLOYED event before forcing refresh ([cd104fc](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/cd104fc8ba39ed601a39a7f139121106910dc3da))
96
105
 
97
106
  ### [0.0.3](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/compare/v0.0.2...v0.0.3) (2020-11-19)
98
107
 
99
-
100
108
  ### Features
101
109
 
102
- * add initial xstate machines, use react-query ([ffff751](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/ffff751e0167a981a3d649ce991ca9ba06a048e6))
103
- * add xstate deploy machhine, pull config values from sanity, add run-time config checking" ([6c940cb](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/6c940cb64d57e708f022f06840c9b9796b1d4883))
110
+ - add initial xstate machines, use react-query ([ffff751](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/ffff751e0167a981a3d649ce991ca9ba06a048e6))
111
+ - add xstate deploy machhine, pull config values from sanity, add run-time config checking" ([6c940cb](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/6c940cb64d57e708f022f06840c9b9796b1d4883))
104
112
 
105
113
  ### 0.0.2 (2020-11-11)
106
114
 
107
-
108
115
  ### Features
109
116
 
110
- * add commitizen, standard-release and husky ([160646c](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/160646c73d140af6738e6ea8864e275a736a13f8))
117
+ - add commitizen, standard-release and husky ([160646c](https://github.com/robinpyon/sanity-plugin-dashboard-widget-vercel/commit/160646c73d140af6738e6ea8864e275a736a13f8))
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Robin Pyon
3
+ Copyright (c) 2022 Robin Pyon
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ > **NOTE**
2
+ >
3
+ > This is the **Sanity Studio v3 version** of sanity-plugin-dashboard-widget-vercel.
4
+ >
5
+ > For the v2 version, please refer to the [v2 version](https://github.com/sanity-io/sanity-plugin-dashboard-widget-vercel/tree/main).
6
+
1
7
  # Vercel Dashboard Widget (for Sanity)
2
8
 
3
9
  View your recent [Vercel](https://vercel.com/) deployments and manually trigger builds directly from your [Sanity](https://www.sanity.io/) dashboard.
@@ -15,55 +21,56 @@ View your recent [Vercel](https://vercel.com/) deployments and manually trigger
15
21
 
16
22
  ## Install
17
23
 
18
- In your Sanity project folder:
24
+ ```
25
+ npm install --save sanity-plugin-dashboard-widget-vercel@studio-v3
26
+ ```
27
+
28
+ or
19
29
 
20
- ```sh
21
- sanity install dashboard-widget-vercel
30
+ ```
31
+ yarn add sanity-plugin-dashboard-widget-vercel@studio-v3
22
32
  ```
23
33
 
24
- ### Configure your dashboard
34
+ Ensure that you have followed install and usage instructions for [@sanity/dashboard](https://github.com/sanity-io/dashboard).
25
35
 
26
- If you haven't configured a [dashboard](https://www.sanity.io/docs/dashboard) yet:
27
36
 
28
- ```sh
29
- sanity install @sanity/dashboard
30
- ```
37
+ ## Usage
31
38
 
32
- In your studio's `sanity.json` append the following to `plugins` and `parts`:
39
+ Add it as a widget to @sanity/dashboard plugin in sanity.config.ts (or .js):
33
40
 
34
- ```javascript
35
- "plugins": [
36
- // ...
37
- "dashboard-widget-vercel"
38
- ],
39
- "parts": [
41
+ ```js
42
+ import { dashboardTool } from "@sanity/dashboard";
43
+ import { vercelWidget } from "sanity-plugin-dashboard-widget-vercel";
44
+
45
+ export default createConfig({
40
46
  // ...
41
- {
42
- "implements": "part:@sanity/dashboard/config",
43
- "path": "dashboardConfig.js"
44
- }
45
- ]
47
+ plugins: [
48
+ dashboardTool({
49
+ widgets: [
50
+ vercelWidget(),
51
+ ],
52
+ }
53
+ ),
54
+ ]
55
+ })
46
56
  ```
47
57
 
48
- In `dashboardConfig.js`, ensure that `widgets` includes the following:
49
-
50
- ```javascript
51
- export default {
52
- widgets: [
53
- // ...
54
- {
55
- name: 'vercel',
56
- layout: {
57
- width: 'full', // full width is recommended!
58
- },
59
- },
60
- ],
61
- }
58
+ ### Configure
59
+
60
+ The widget size can be controlled using layout.width:
61
+
62
+ ```js
63
+ dashboardTool({
64
+ widgets: [
65
+ vercelWidget({ layout: { width: "full" /* default and reccomended */ } }),
66
+ ],
67
+ }
68
+ )
62
69
  ```
63
70
 
64
71
  ### Add a deployment target
65
72
 
66
- Simply visit your Sanity dashboard and click the '+' icon in the top right to add a new deploment target.
73
+ Simply visit your Sanity dashboard and click the '+' icon in the top right to add a new deployment target.
67
74
 
68
75
  You'll need to fill in the following:
69
76
 
@@ -79,7 +86,8 @@ This can be created in Vercel under **Account > Settings > Tokens**.
79
86
 
80
87
  #### Vercel Project ID (required)
81
88
 
82
- This can be retrieved via [Vercel's API](https://vercel.com/docs/api#endpoints/projects/get-projects).
89
+ This can be retrieved via [Vercel's API](https://vercel.com/docs/api#endpoints/projects/get-projects),
90
+ or via the web UI on _<project-page> -> Settings -> General -> Scroll down to Project ID_.
83
91
 
84
92
  #### Vercel Team ID
85
93
 
@@ -127,3 +135,10 @@ Please also keep the following in mind when manually deploying:
127
135
  ## Contributing
128
136
 
129
137
  Contributions, issues and feature requests are welcome!
138
+
139
+ ## Release new version
140
+
141
+ Run ["CI & Release" workflow](https://github.com/sanity-io/sanity-plugin-dashboard-widget-vercel/actions/workflows/main.yml).
142
+ Make sure to select the main (or v3, depending) branch and check "Release new version".
143
+
144
+ Semantic release will only release on configured branches, so it is safe to run release on any branch.