@sanity/plugin-kit 2.0.0 → 2.0.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 +2 -2
- package/lib/package.json +2 -2
- package/lib/src/actions/verify/validations.js +2 -2
- package/lib/src/configs/default-source.js +8 -8
- package/lib/src/configs/forced-package-versions.d.ts +1 -1
- package/lib/src/configs/forced-package-versions.js +1 -1
- package/lib/src/configs/forced-package-versions.js.map +1 -1
- package/lib/src/util/readme.js +2 -2
- package/package.json +2 -2
- package/src/actions/verify/validations.ts +2 -2
- package/src/configs/default-source.ts +8 -8
- package/src/configs/forced-package-versions.ts +1 -1
- package/src/util/readme.ts +2 -2
package/README.md
CHANGED
|
@@ -63,10 +63,10 @@ yalc add --link sanity-plugin-testing-it-out && yarn install
|
|
|
63
63
|
|
|
64
64
|
Now, configure the plugin in sanity.config.ts (or .js) in Sanity Studio:
|
|
65
65
|
```ts
|
|
66
|
-
import {
|
|
66
|
+
import {defineConfig} from 'sanity'
|
|
67
67
|
import {myPlugin} from 'sanity-plugin-testing-it-out'
|
|
68
68
|
|
|
69
|
-
export const
|
|
69
|
+
export const defineConfig({
|
|
70
70
|
//...
|
|
71
71
|
plugins: [
|
|
72
72
|
myPlugin({})
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/plugin-kit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Enhanced Sanity.io plugin development experience",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf lib",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"prettier": "^2.7.1",
|
|
107
107
|
"readdirp": "^3.6.0",
|
|
108
108
|
"rimraf": "^3.0.2",
|
|
109
|
-
"sanity": "3.0.0-
|
|
109
|
+
"sanity": "3.0.0-rc.0",
|
|
110
110
|
"sinon": "^14.0.0",
|
|
111
111
|
"tap": "^16.3.0",
|
|
112
112
|
"ts-node": "^10.9.1",
|
|
@@ -286,10 +286,10 @@ function validateStudioConfig({ basePath }) {
|
|
|
286
286
|
|
|
287
287
|
${chalk_1.default
|
|
288
288
|
.green((0, outdent_1.default) `
|
|
289
|
-
import {
|
|
289
|
+
import { defineConfig } from "sanity"
|
|
290
290
|
import { deskTool } from "sanity/desk"
|
|
291
291
|
|
|
292
|
-
export default
|
|
292
|
+
export default defineConfig({
|
|
293
293
|
name: "default",
|
|
294
294
|
|
|
295
295
|
projectId: '${(_g = (_f = sanityJson === null || sanityJson === void 0 ? void 0 : sanityJson.api) === null || _f === void 0 ? void 0 : _f.projectId) !== null && _g !== void 0 ? _g : 'project-id'}',
|
|
@@ -7,16 +7,16 @@ exports.defaultSourceTs = exports.defaultSourceJs = void 0;
|
|
|
7
7
|
const outdent_1 = __importDefault(require("outdent"));
|
|
8
8
|
function defaultSourceJs(pkg) {
|
|
9
9
|
return ((0, outdent_1.default) `
|
|
10
|
-
import {
|
|
10
|
+
import {definePlugin} from 'sanity'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* ## Usage in sanity.config.js (or .js)
|
|
14
14
|
*
|
|
15
15
|
* \`\`\`
|
|
16
|
-
* import {
|
|
16
|
+
* import {defineConfig} from 'sanity'
|
|
17
17
|
* import {myPlugin} from '${pkg.name}'
|
|
18
18
|
*
|
|
19
|
-
* export const
|
|
19
|
+
* export const defineConfig({
|
|
20
20
|
* /...
|
|
21
21
|
* plugins: [
|
|
22
22
|
* myPlugin({})
|
|
@@ -24,7 +24,7 @@ function defaultSourceJs(pkg) {
|
|
|
24
24
|
* })
|
|
25
25
|
* \`\`\`
|
|
26
26
|
*/
|
|
27
|
-
export const myPlugin =
|
|
27
|
+
export const myPlugin = definePlugin((config = {}) => {
|
|
28
28
|
// eslint-disable-next-line no-console
|
|
29
29
|
console.log(\`hello from ${pkg.name}\`)
|
|
30
30
|
return {
|
|
@@ -36,7 +36,7 @@ function defaultSourceJs(pkg) {
|
|
|
36
36
|
exports.defaultSourceJs = defaultSourceJs;
|
|
37
37
|
function defaultSourceTs(pkg) {
|
|
38
38
|
return ((0, outdent_1.default) `
|
|
39
|
-
import {
|
|
39
|
+
import {definePlugin} from 'sanity'
|
|
40
40
|
|
|
41
41
|
interface MyPluginConfig {
|
|
42
42
|
/* nothing here yet */
|
|
@@ -46,10 +46,10 @@ function defaultSourceTs(pkg) {
|
|
|
46
46
|
* ## Usage in sanity.config.ts (or .js)
|
|
47
47
|
*
|
|
48
48
|
* \`\`\`
|
|
49
|
-
* import {
|
|
49
|
+
* import {defineConfig} from 'sanity'
|
|
50
50
|
* import {myPlugin} from '${pkg.name}'
|
|
51
51
|
*
|
|
52
|
-
* export const
|
|
52
|
+
* export const defineConfig({
|
|
53
53
|
* /...
|
|
54
54
|
* plugins: [
|
|
55
55
|
* myPlugin()
|
|
@@ -57,7 +57,7 @@ function defaultSourceTs(pkg) {
|
|
|
57
57
|
* })
|
|
58
58
|
* \`\`\`
|
|
59
59
|
*/
|
|
60
|
-
export const myPlugin =
|
|
60
|
+
export const myPlugin = definePlugin<MyPluginConfig | void>((config = {}) => {
|
|
61
61
|
// eslint-disable-next-line no-console
|
|
62
62
|
console.log('hello from ${pkg.name}')
|
|
63
63
|
return {
|
|
@@ -3,6 +3,6 @@ export declare const forcedPackageVersions: {
|
|
|
3
3
|
readonly '@types/react': "^18.0.0";
|
|
4
4
|
readonly 'react-dom': "^18.0.0";
|
|
5
5
|
readonly '@types/react-dom': "^18.0.0";
|
|
6
|
-
readonly sanity: "dev-preview || 3.0.0-
|
|
6
|
+
readonly sanity: "dev-preview || 3.0.0-rc.0";
|
|
7
7
|
readonly '@sanity/ui': "^1.0.0-beta.31";
|
|
8
8
|
};
|
|
@@ -6,7 +6,7 @@ exports.forcedPackageVersions = {
|
|
|
6
6
|
'@types/react': '^18.0.0',
|
|
7
7
|
'react-dom': '^18.0.0',
|
|
8
8
|
'@types/react-dom': '^18.0.0',
|
|
9
|
-
sanity: 'dev-preview || 3.0.0-
|
|
9
|
+
sanity: 'dev-preview || 3.0.0-rc.0',
|
|
10
10
|
'@sanity/ui': '^1.0.0-beta.31',
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=forced-package-versions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forced-package-versions.js","sourceRoot":"","sources":["../../../src/configs/forced-package-versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG;IACnC,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,WAAW,EAAE,SAAS;IACtB,kBAAkB,EAAE,SAAS;IAC7B,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"forced-package-versions.js","sourceRoot":"","sources":["../../../src/configs/forced-package-versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG;IACnC,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,WAAW,EAAE,SAAS;IACtB,kBAAkB,EAAE,SAAS;IAC7B,MAAM,EAAE,2BAA2B;IACnC,YAAY,EAAE,gBAAgB;CACtB,CAAA"}
|
package/lib/src/util/readme.js
CHANGED
|
@@ -28,10 +28,10 @@ function generateReadme(data) {
|
|
|
28
28
|
Add it as a plugin in sanity.config.ts (or .js):
|
|
29
29
|
|
|
30
30
|
\`\`\`
|
|
31
|
-
import {
|
|
31
|
+
import {defineConfig} from 'sanity'
|
|
32
32
|
import {myPlugin} from '${pluginName}'
|
|
33
33
|
|
|
34
|
-
export const
|
|
34
|
+
export const defineConfig({
|
|
35
35
|
/...
|
|
36
36
|
plugins: [
|
|
37
37
|
myPlugin({})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/plugin-kit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Enhanced Sanity.io plugin development experience",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf lib",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"prettier": "^2.7.1",
|
|
107
107
|
"readdirp": "^3.6.0",
|
|
108
108
|
"rimraf": "^3.0.2",
|
|
109
|
-
"sanity": "3.0.0-
|
|
109
|
+
"sanity": "3.0.0-rc.0",
|
|
110
110
|
"sinon": "^14.0.0",
|
|
111
111
|
"tap": "^16.3.0",
|
|
112
112
|
"ts-node": "^10.9.1",
|
|
@@ -308,10 +308,10 @@ export async function validateStudioConfig({basePath}: {basePath: string}): Prom
|
|
|
308
308
|
${chalk
|
|
309
309
|
.green(
|
|
310
310
|
outdent`
|
|
311
|
-
import {
|
|
311
|
+
import { defineConfig } from "sanity"
|
|
312
312
|
import { deskTool } from "sanity/desk"
|
|
313
313
|
|
|
314
|
-
export default
|
|
314
|
+
export default defineConfig({
|
|
315
315
|
name: "default",
|
|
316
316
|
|
|
317
317
|
projectId: '${sanityJson?.api?.projectId ?? 'project-id'}',
|
|
@@ -4,16 +4,16 @@ import {PackageJson} from '../actions/verify/types'
|
|
|
4
4
|
export function defaultSourceJs(pkg: PackageJson) {
|
|
5
5
|
return (
|
|
6
6
|
outdent`
|
|
7
|
-
import {
|
|
7
|
+
import {definePlugin} from 'sanity'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* ## Usage in sanity.config.js (or .js)
|
|
11
11
|
*
|
|
12
12
|
* \`\`\`
|
|
13
|
-
* import {
|
|
13
|
+
* import {defineConfig} from 'sanity'
|
|
14
14
|
* import {myPlugin} from '${pkg.name}'
|
|
15
15
|
*
|
|
16
|
-
* export const
|
|
16
|
+
* export const defineConfig({
|
|
17
17
|
* /...
|
|
18
18
|
* plugins: [
|
|
19
19
|
* myPlugin({})
|
|
@@ -21,7 +21,7 @@ export function defaultSourceJs(pkg: PackageJson) {
|
|
|
21
21
|
* })
|
|
22
22
|
* \`\`\`
|
|
23
23
|
*/
|
|
24
|
-
export const myPlugin =
|
|
24
|
+
export const myPlugin = definePlugin((config = {}) => {
|
|
25
25
|
// eslint-disable-next-line no-console
|
|
26
26
|
console.log(\`hello from ${pkg.name}\`)
|
|
27
27
|
return {
|
|
@@ -35,7 +35,7 @@ export function defaultSourceJs(pkg: PackageJson) {
|
|
|
35
35
|
export function defaultSourceTs(pkg: PackageJson) {
|
|
36
36
|
return (
|
|
37
37
|
outdent`
|
|
38
|
-
import {
|
|
38
|
+
import {definePlugin} from 'sanity'
|
|
39
39
|
|
|
40
40
|
interface MyPluginConfig {
|
|
41
41
|
/* nothing here yet */
|
|
@@ -45,10 +45,10 @@ export function defaultSourceTs(pkg: PackageJson) {
|
|
|
45
45
|
* ## Usage in sanity.config.ts (or .js)
|
|
46
46
|
*
|
|
47
47
|
* \`\`\`
|
|
48
|
-
* import {
|
|
48
|
+
* import {defineConfig} from 'sanity'
|
|
49
49
|
* import {myPlugin} from '${pkg.name}'
|
|
50
50
|
*
|
|
51
|
-
* export const
|
|
51
|
+
* export const defineConfig({
|
|
52
52
|
* /...
|
|
53
53
|
* plugins: [
|
|
54
54
|
* myPlugin()
|
|
@@ -56,7 +56,7 @@ export function defaultSourceTs(pkg: PackageJson) {
|
|
|
56
56
|
* })
|
|
57
57
|
* \`\`\`
|
|
58
58
|
*/
|
|
59
|
-
export const myPlugin =
|
|
59
|
+
export const myPlugin = definePlugin<MyPluginConfig | void>((config = {}) => {
|
|
60
60
|
// eslint-disable-next-line no-console
|
|
61
61
|
console.log('hello from ${pkg.name}')
|
|
62
62
|
return {
|
package/src/util/readme.ts
CHANGED
|
@@ -26,10 +26,10 @@ export function generateReadme(data: PackageData) {
|
|
|
26
26
|
Add it as a plugin in sanity.config.ts (or .js):
|
|
27
27
|
|
|
28
28
|
\`\`\`
|
|
29
|
-
import {
|
|
29
|
+
import {defineConfig} from 'sanity'
|
|
30
30
|
import {myPlugin} from '${pluginName}'
|
|
31
31
|
|
|
32
|
-
export const
|
|
32
|
+
export const defineConfig({
|
|
33
33
|
/...
|
|
34
34
|
plugins: [
|
|
35
35
|
myPlugin({})
|