@fils/sanity-components 0.0.4 → 0.0.6
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/lib/config/utils.d.ts +18 -0
- package/lib/config/utils.js +36 -0
- package/lib/main.d.ts +1 -0
- package/lib/main.js +1 -0
- package/lib/validators/utils.d.ts +4 -0
- package/lib/validators/utils.js +4 -0
- package/package.json +4 -2
package/lib/config/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DocumentActionComponent, DocumentActionsContext } from "sanity";
|
|
2
2
|
import { StructureResolver } from 'sanity/structure';
|
|
3
|
+
import { SiteWidgetOption } from "sanity-plugin-dashboard-widget-netlify";
|
|
3
4
|
export declare function getActions(singletonTypes: Set<string>): (input: DocumentActionComponent[], context: DocumentActionsContext) => DocumentActionComponent[];
|
|
4
5
|
export declare function getDefaultConfig(projectId: string, title: string, structure: StructureResolver, schemaTypes: any, singletonTypes: Set<string>): {
|
|
5
6
|
name: string;
|
|
@@ -18,3 +19,20 @@ export declare function getDefaultConfig(projectId: string, title: string, struc
|
|
|
18
19
|
actions: (input: DocumentActionComponent[], context: DocumentActionsContext) => DocumentActionComponent[];
|
|
19
20
|
};
|
|
20
21
|
};
|
|
22
|
+
export declare function getConfigWithNetlify(projectId: string, title: string, structure: StructureResolver, schemaTypes: any, singletonTypes: Set<string>, sites: SiteWidgetOption[]): {
|
|
23
|
+
name: string;
|
|
24
|
+
title: string;
|
|
25
|
+
projectId: string;
|
|
26
|
+
dataset: string;
|
|
27
|
+
scheduledPublishing: {
|
|
28
|
+
enabled: false;
|
|
29
|
+
};
|
|
30
|
+
plugins: import("sanity").PluginOptions[];
|
|
31
|
+
schema: {
|
|
32
|
+
types: any;
|
|
33
|
+
templates: (templates: import("sanity").Template<any, any>[]) => import("sanity").Template<any, any>[];
|
|
34
|
+
};
|
|
35
|
+
document: {
|
|
36
|
+
actions: (input: DocumentActionComponent[], context: DocumentActionsContext) => DocumentActionComponent[];
|
|
37
|
+
};
|
|
38
|
+
};
|
package/lib/config/utils.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from "sanity";
|
|
2
2
|
import { structureTool } from 'sanity/structure';
|
|
3
|
+
import { netlifyWidget } from "sanity-plugin-dashboard-widget-netlify";
|
|
4
|
+
import { dashboardTool } from '@sanity/dashboard';
|
|
3
5
|
// Define the actions that should be available for singleton documents
|
|
4
6
|
const singletonActions = new Set(["publish", "discardChanges", "restore"]);
|
|
5
7
|
export function getActions(singletonTypes) {
|
|
@@ -31,3 +33,37 @@ export function getDefaultConfig(projectId, title, structure, schemaTypes, singl
|
|
|
31
33
|
},
|
|
32
34
|
});
|
|
33
35
|
}
|
|
36
|
+
export function getConfigWithNetlify(projectId, title, structure, schemaTypes, singletonTypes, sites) {
|
|
37
|
+
return defineConfig({
|
|
38
|
+
name: 'default',
|
|
39
|
+
title,
|
|
40
|
+
projectId,
|
|
41
|
+
dataset: 'production',
|
|
42
|
+
scheduledPublishing: {
|
|
43
|
+
enabled: false
|
|
44
|
+
},
|
|
45
|
+
plugins: [
|
|
46
|
+
structureTool({
|
|
47
|
+
structure
|
|
48
|
+
}),
|
|
49
|
+
dashboardTool({
|
|
50
|
+
widgets: [
|
|
51
|
+
netlifyWidget({
|
|
52
|
+
title: 'Deploy Site',
|
|
53
|
+
sites
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
],
|
|
58
|
+
schema: {
|
|
59
|
+
types: schemaTypes,
|
|
60
|
+
// Filter out singleton types from the global “New document” menu options
|
|
61
|
+
templates: (templates) => templates.filter(({ schemaType }) => !singletonTypes.has(schemaType)),
|
|
62
|
+
},
|
|
63
|
+
document: {
|
|
64
|
+
// For singleton types, filter out actions that are not explicitly included
|
|
65
|
+
// in the `singletonActions` list defined above
|
|
66
|
+
actions: getActions(singletonTypes),
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
package/lib/main.d.ts
CHANGED
package/lib/main.js
CHANGED
package/lib/validators/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fils/sanity-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Fil's Components for Sanity Back-Ends",
|
|
5
5
|
"main": "lib/main.js",
|
|
6
6
|
"repository": "git@github.com:fil-studio/fils.git",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"lib"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"sanity": "^
|
|
18
|
+
"@sanity/dashboard": "^4.1.3",
|
|
19
|
+
"sanity": "^3.85.1",
|
|
20
|
+
"sanity-plugin-dashboard-widget-netlify": "^2.0.1"
|
|
19
21
|
},
|
|
20
22
|
"devDependencies": {
|
|
21
23
|
"@sanity/types": "^3.85.1",
|