sanity-plugin-workspace-home 1.0.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Sanity
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # sanity-plugin-workspace-home
2
+
3
+ > This is a **Sanity Studio v3** plugin.
4
+
5
+ This plugin adds a "Home" Tool to your Studio with a listing of all available workspaces. Useful as the first page of your Studio to quickly navigate to the workspace of your choice.
6
+
7
+ ![plugin inside sanity studio showing workspaces](https://user-images.githubusercontent.com/9684022/226922805-490922c0-8b85-4d06-9770-ff81e0a33837.png)
8
+
9
+ ## Installation
10
+
11
+ ```sh
12
+ npm install sanity-plugin-workspace-home
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ For simple installation, import the predefined workspace config from the plugin and use it as the first config in your `sanity.config.ts` (or .js) file.
18
+
19
+ ```ts
20
+ import {defineConfig} from 'sanity'
21
+ import {workspaceHomeConfig} from 'sanity-plugin-workspace-home'
22
+
23
+ export default defineConfig([
24
+ workspaceHomeConfig({
25
+ // projectId and dataset are required, but not used by the plugin
26
+ projectId: 'replace-with-your-project-id',
27
+ dataset: 'replace-with-your-dataset-name',
28
+ }),
29
+ // ...all other workspaces
30
+ ])
31
+ ```
32
+
33
+ Alternatively, define your own workspace config for the plugin. This plugin is designed to be used in a workspace where it is the only plugin. This should be the first workspace configured in `sanity.config.ts` (or .js).
34
+
35
+ ```ts
36
+ import {defineConfig} from 'sanity'
37
+ import {workspaceHome} from 'sanity-plugin-workspace-home'
38
+
39
+ export default defineConfig([{
40
+ {
41
+ name: 'home',
42
+ title: 'Home',
43
+ basePath: '/home',
44
+ icon: HomeIcon,
45
+ plugins: [workspaceHome()],
46
+ // projectId and dataset are required, but not used by the plugin
47
+ projectId: 'replace-with-your-project-id',
48
+ dataset: 'replace-with-your-dataset-name',
49
+ },
50
+ // ...all other workspaces
51
+ }])
52
+ ```
53
+
54
+ ## License
55
+
56
+ [MIT](LICENSE) © Sanity
57
+
58
+ ## Develop & test
59
+
60
+ This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
61
+ with default configuration for build & watch scripts.
62
+
63
+ See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
64
+ on how to run this plugin with hotreload in the studio.
65
+
66
+
67
+ ### Release new version
68
+
69
+ Run ["CI & Release" workflow](TODO/actions/workflows/main.yml).
70
+ Make sure to select the main branch and check "Release new version".
71
+
72
+ Semantic release will only release on configured branches, so it is safe to run release on any branch.
@@ -0,0 +1,13 @@
1
+ import {Config} from 'sanity'
2
+ import {Plugin as Plugin_2} from 'sanity'
3
+
4
+ export declare const workspaceHome: Plugin_2<void>
5
+
6
+ export declare const workspaceHomeConfig: ({projectId, dataset}: WorkspaceHomeConfigProps) => Config
7
+
8
+ declare type WorkspaceHomeConfigProps = {
9
+ projectId: string
10
+ dataset: string
11
+ }
12
+
13
+ export {}