@sanity/cross-dataset-duplicator 1.2.1 → 1.2.2
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/README.md +29 -27
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Cross Dataset Duplicator
|
|
2
2
|
|
|
3
3
|
Sanity Studio v3 Tool and Document Action for empowering content editors to migrate Documents and Assets between Sanity Datasets and Projects from inside the Studio.
|
|
4
|
+
|
|
4
5
|
## Installation
|
|
5
6
|
|
|
6
7
|
```
|
|
@@ -39,7 +40,7 @@ The **Duplicate to...** Document Action allows you to migrate an individual Docu
|
|
|
39
40
|
|
|
40
41
|
### 1. Workspaces
|
|
41
42
|
|
|
42
|
-
You must have more than one [Workspace configured](https://www.sanity.io/docs/config-api-reference#37c85e3072b2) to use this plugin.
|
|
43
|
+
You must have more than one [Workspace configured](https://www.sanity.io/docs/config-api-reference#37c85e3072b2) to use this plugin.
|
|
43
44
|
|
|
44
45
|
All Datasets and Project IDs set up as Workspaces will become selectable "destinations" for Migrations.
|
|
45
46
|
|
|
@@ -87,7 +88,7 @@ The Document Action has additional config options:
|
|
|
87
88
|
The `onDuplicated` callback could be used to update update metadata after documents have been synced, or to perform arbitrary cleanup tasks like closing the dialog:
|
|
88
89
|
|
|
89
90
|
```tsx
|
|
90
|
-
const DuplicatorAction = ({
|
|
91
|
+
const DuplicatorAction = ({published, onComplete}: DocumentActionProps) => {
|
|
91
92
|
const [dialogOpen, setDialogOpen] = useState(false)
|
|
92
93
|
const [submitting, setSubmitting] = useState(false)
|
|
93
94
|
const [duplicated, setDuplicated] = useState(false)
|
|
@@ -99,31 +100,32 @@ const DuplicatorAction = ({ published, onComplete }: DocumentActionProps) => {
|
|
|
99
100
|
disabled: submitting || duplicated,
|
|
100
101
|
loading: submitting,
|
|
101
102
|
icon: PublishIcon,
|
|
102
|
-
dialog: dialogOpen &&
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
103
|
+
dialog: dialogOpen &&
|
|
104
|
+
published && {
|
|
105
|
+
type: 'popover',
|
|
106
|
+
title: 'Cross Dataset Duplicator',
|
|
107
|
+
content: (
|
|
108
|
+
<CrossDatasetDuplicatorAction
|
|
109
|
+
docs={[published]}
|
|
110
|
+
onDuplicated={async () => {
|
|
111
|
+
alert('data migrated')
|
|
112
|
+
await new Promise((resolve) => {
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
setDialogOpen(false)
|
|
115
|
+
setDuplicated(true)
|
|
116
|
+
resolve()
|
|
117
|
+
}, 1000)
|
|
118
|
+
})
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
121
|
+
),
|
|
122
|
+
onHandle: () => setDialogOpen(true),
|
|
123
|
+
onClose: () => {
|
|
124
|
+
onComplete()
|
|
125
|
+
setDialogOpen(false)
|
|
126
|
+
setSubmitting(false)
|
|
127
|
+
},
|
|
128
|
+
},
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cross-dataset-duplicator",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Empower content editors to migrate Documents and Assets between Sanity Projects and Datasets from inside Sanity Studio",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"source": "./src/index.ts",
|
|
23
23
|
"require": "./dist/index.js",
|
|
24
|
+
"node": {
|
|
25
|
+
"module": "./dist/index.esm.js",
|
|
26
|
+
"import": "./dist/index.cjs.mjs"
|
|
27
|
+
},
|
|
24
28
|
"import": "./dist/index.esm.js",
|
|
25
29
|
"default": "./dist/index.esm.js"
|
|
26
30
|
},
|
|
@@ -60,15 +64,15 @@
|
|
|
60
64
|
"@sanity/ui": "^1.0.0",
|
|
61
65
|
"async": "^3.2.1",
|
|
62
66
|
"dset": "^3.1.0",
|
|
63
|
-
"semantic-release": "^
|
|
67
|
+
"semantic-release": "^22.0.0",
|
|
64
68
|
"styled-components": "^5.3.3"
|
|
65
69
|
},
|
|
66
70
|
"devDependencies": {
|
|
67
|
-
"@commitlint/cli": "^
|
|
68
|
-
"@commitlint/config-conventional": "^
|
|
71
|
+
"@commitlint/cli": "^18.2.0",
|
|
72
|
+
"@commitlint/config-conventional": "^18.1.0",
|
|
69
73
|
"@sanity/pkg-utils": "^2.2.13",
|
|
70
74
|
"@sanity/plugin-kit": "^3.1.7",
|
|
71
|
-
"@sanity/semantic-release-preset": "^4.1.
|
|
75
|
+
"@sanity/semantic-release-preset": "^4.1.6",
|
|
72
76
|
"@types/react": "^18.0.31",
|
|
73
77
|
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
|
74
78
|
"@typescript-eslint/parser": "^5.57.0",
|
|
@@ -79,7 +83,7 @@
|
|
|
79
83
|
"eslint-plugin-react": "^7.32.2",
|
|
80
84
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
81
85
|
"husky": "^8.0.3",
|
|
82
|
-
"lint-staged": "^
|
|
86
|
+
"lint-staged": "^15.0.2",
|
|
83
87
|
"npm-run-all": "^4.1.5",
|
|
84
88
|
"prettier": "^2.8.7",
|
|
85
89
|
"prettier-plugin-packagejson": "^2.4.3",
|