sanity-plugin-markdown 2.1.0 → 2.1.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/.eslintignore +6 -0
- package/.eslintrc.js +18 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.releaserc.json +4 -0
- package/CHANGELOG.md +12 -0
- package/LICENSE +1 -1
- package/README.md +12 -1
- package/commitlint.config.js +3 -0
- package/lib/components/Editor.js +32 -7
- package/lib/components/Editor.js.map +1 -1
- package/lib/hooks/useDebounce.js +2 -6
- package/lib/hooks/useDebounce.js.map +1 -1
- package/lint-staged.config.js +4 -0
- package/package.json +40 -30
- package/renovate.json +8 -0
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
node: false,
|
|
5
|
+
},
|
|
6
|
+
extends: [
|
|
7
|
+
'sanity/react', // must come before sanity/typescript
|
|
8
|
+
'plugin:prettier/recommended',
|
|
9
|
+
'plugin:react-hooks/recommended',
|
|
10
|
+
],
|
|
11
|
+
parserOptions: {
|
|
12
|
+
ecmaFeatures: {
|
|
13
|
+
jsx: true,
|
|
14
|
+
},
|
|
15
|
+
project: './tsconfig.json',
|
|
16
|
+
},
|
|
17
|
+
plugins: ['prettier'],
|
|
18
|
+
}
|
package/.releaserc.json
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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.1.2](https://github.com/sanity-io/sanity-plugin-markdown/compare/v2.1.1...v2.1.2) (2022-11-22)
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
- **ci:** publish using semantic-release ([a597664](https://github.com/sanity-io/sanity-plugin-markdown/commit/a5976646d7712a59d1e68f80b798d4a9ddf80c8b))
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
# sanity-plugin-markdown
|
|
2
|
+
|
|
3
|
+
> This is a **Sanity Studio v2** plugin.
|
|
4
|
+
> For the v3 version, please refer to the [v3-branch](https://github.com/sanity-io/sanity-plugin-markdown).
|
|
5
|
+
|
|
2
6
|
A Markdown editor with preview for Sanity Studio. Supports Github flavored markdown and image uploads. You can either drag image(s) into the editor or click the bottom bar to bring up a file selector. The inserted image(s) has a default width crop in the url which you can change to your liking with the [Sanity image pipeline parameters](https://www.sanity.io/docs/image-urls).
|
|
3
7
|
|
|
4
8
|
## Installation
|
|
5
9
|
|
|
10
|
+
```sh
|
|
11
|
+
yarn add sanity-plugin-markdown@studio-v2
|
|
6
12
|
```
|
|
7
|
-
|
|
13
|
+
|
|
14
|
+
Next, add `"markdown"` to `sanity.json` plugins array:
|
|
15
|
+
```json
|
|
16
|
+
"plugins": [
|
|
17
|
+
"markdown"
|
|
18
|
+
]
|
|
8
19
|
```
|
|
9
20
|
|
|
10
21
|
## Usage
|
package/lib/components/Editor.js
CHANGED
|
@@ -13,6 +13,8 @@ var _reactMarkdown = _interopRequireDefault(require("react-markdown"));
|
|
|
13
13
|
|
|
14
14
|
var _remarkGfm = _interopRequireDefault(require("remark-gfm"));
|
|
15
15
|
|
|
16
|
+
var _autoId = require("@reach/auto-id");
|
|
17
|
+
|
|
16
18
|
var _patchEvent = _interopRequireWildcard(require("part:@sanity/form-builder/patch-event"));
|
|
17
19
|
|
|
18
20
|
var _client = _interopRequireDefault(require("part:@sanity/base/client"));
|
|
@@ -71,6 +73,9 @@ var _default = /*#__PURE__*/React.forwardRef(function MarkdownEditor(props, ref)
|
|
|
71
73
|
_props$value = props.value,
|
|
72
74
|
value = _props$value === void 0 ? '' : _props$value,
|
|
73
75
|
markers = props.markers,
|
|
76
|
+
onBlur = props.onBlur,
|
|
77
|
+
onChange = props.onChange,
|
|
78
|
+
onFocus = props.onFocus,
|
|
74
79
|
presence = props.presence,
|
|
75
80
|
readOnly = props.readOnly;
|
|
76
81
|
var _type$options = type.options,
|
|
@@ -87,14 +92,23 @@ var _default = /*#__PURE__*/React.forwardRef(function MarkdownEditor(props, ref)
|
|
|
87
92
|
setEditedValue = _React$useState4[1];
|
|
88
93
|
|
|
89
94
|
var debouncedValue = (0, _useDebounce.default)(editedValue, 100);
|
|
95
|
+
var textarea = React.useRef(); // Conditionally update textarea styles based on read only access.
|
|
96
|
+
// It's also possible to define inline styles via `childProps.textArea.style` on `<ReactMde />`,
|
|
97
|
+
// but this will override any dynamically created styles provided by the component itself.
|
|
98
|
+
|
|
99
|
+
React.useEffect(() => {
|
|
100
|
+
if (textarea.current) {
|
|
101
|
+
textarea.current.style.backgroundColor = readOnly ? 'rgba(240,240,240)' : 'rgba(255,255,255)';
|
|
102
|
+
}
|
|
103
|
+
}, [textarea]);
|
|
90
104
|
React.useEffect(() => {
|
|
91
105
|
setEditedValue(value);
|
|
92
106
|
}, [value]);
|
|
93
107
|
React.useEffect(() => {
|
|
94
108
|
if (!debouncedValue && value) {
|
|
95
|
-
|
|
109
|
+
onChange(_patchEvent.default.from([(0, _patchEvent.unset)()]));
|
|
96
110
|
} else if (debouncedValue !== value) {
|
|
97
|
-
|
|
111
|
+
onChange(_patchEvent.default.from([(0, _patchEvent.set)(debouncedValue)]));
|
|
98
112
|
}
|
|
99
113
|
}, [debouncedValue]);
|
|
100
114
|
|
|
@@ -116,17 +130,23 @@ var _default = /*#__PURE__*/React.forwardRef(function MarkdownEditor(props, ref)
|
|
|
116
130
|
return function saveImage(_x) {
|
|
117
131
|
return _ref.apply(this, arguments);
|
|
118
132
|
};
|
|
119
|
-
}();
|
|
133
|
+
}(); // Generate a random ID to link our FormField label and input component
|
|
134
|
+
|
|
120
135
|
|
|
136
|
+
var inputId = (0, _autoId.useId)();
|
|
121
137
|
return /*#__PURE__*/React.createElement(_components.FormField, {
|
|
122
138
|
description: type.description // Creates description from schema
|
|
123
139
|
,
|
|
140
|
+
inputId: inputId // A unique ID for this input
|
|
141
|
+
,
|
|
124
142
|
title: type.title // Creates label from schema title
|
|
125
143
|
,
|
|
126
144
|
__unstable_markers: markers // Handles all markers including validation
|
|
127
145
|
,
|
|
128
146
|
__unstable_presence: presence // Handles presence avatars
|
|
129
147
|
|
|
148
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
149
|
+
ref: ref
|
|
130
150
|
}, /*#__PURE__*/React.createElement(_reactMde.default, {
|
|
131
151
|
toolbarCommands: options['toolbar'] || defaultToolbarCommands,
|
|
132
152
|
value: editedValue,
|
|
@@ -138,17 +158,22 @@ var _default = /*#__PURE__*/React.forwardRef(function MarkdownEditor(props, ref)
|
|
|
138
158
|
markdown: markdown
|
|
139
159
|
})),
|
|
140
160
|
childProps: {
|
|
161
|
+
textArea: {
|
|
162
|
+
id: inputId,
|
|
163
|
+
onBlur,
|
|
164
|
+
onFocus
|
|
165
|
+
},
|
|
141
166
|
writeButton: {
|
|
142
167
|
tabIndex: -1
|
|
143
168
|
}
|
|
144
169
|
},
|
|
145
|
-
refs: {
|
|
146
|
-
textarea: ref
|
|
147
|
-
},
|
|
148
170
|
paste: {
|
|
149
171
|
saveImage
|
|
172
|
+
},
|
|
173
|
+
refs: {
|
|
174
|
+
textarea
|
|
150
175
|
}
|
|
151
|
-
}));
|
|
176
|
+
})));
|
|
152
177
|
});
|
|
153
178
|
|
|
154
179
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Editor.jsx"],"names":["Preview","markdown","gfm","defaultToolbarCommands","React","forwardRef","MarkdownEditor","props","ref","type","value","markers","presence","readOnly","options","useState","selectedTab","setSelectedTab","editedValue","setEditedValue","debouncedValue","useEffect","
|
|
1
|
+
{"version":3,"sources":["../../src/components/Editor.jsx"],"names":["Preview","markdown","gfm","defaultToolbarCommands","React","forwardRef","MarkdownEditor","props","ref","type","value","markers","onBlur","onChange","onFocus","presence","readOnly","options","useState","selectedTab","setSelectedTab","editedValue","setEditedValue","debouncedValue","textarea","useRef","useEffect","current","style","backgroundColor","PatchEvent","from","saveImage","data","client","sanityClient","withConfig","apiVersion","success","result","assets","upload","then","doc","url","catch","inputId","description","title","Promise","resolve","textArea","id","writeButton","tabIndex"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAEA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,OAAO,GAAG,SAAgB;AAAA,MAAdC,QAAc,SAAdA,QAAc;AAC9B,sBAAO,oBAAC,sBAAD;AAAe,IAAA,OAAO,EAAE,CAACC,kBAAD;AAAxB,KAAgCD,QAAhC,CAAP;AACD,CAFD;;AAIA,IAAME,sBAAsB,GAAG,CAC7B,CAAC,QAAD,EAAW,MAAX,EAAmB,QAAnB,EAA6B,eAA7B,CAD6B,EAE7B,CAAC,MAAD,EAAS,OAAT,EAAkB,MAAlB,CAF6B,EAG7B,CAAC,gBAAD,EAAmB,cAAnB,EAAmC,cAAnC,CAH6B,CAA/B;;4BAMeC,KAAK,CAACC,UAAN,CAAiB,SAASC,cAAT,CAAwBC,KAAxB,EAA+BC,GAA/B,EAAoC;AAClE,MAAOC,IAAP,GAAmFF,KAAnF,CAAOE,IAAP;AAAA,qBAAmFF,KAAnF,CAAaG,KAAb;AAAA,MAAaA,KAAb,6BAAqB,EAArB;AAAA,MAAyBC,OAAzB,GAAmFJ,KAAnF,CAAyBI,OAAzB;AAAA,MAAkCC,MAAlC,GAAmFL,KAAnF,CAAkCK,MAAlC;AAAA,MAA0CC,QAA1C,GAAmFN,KAAnF,CAA0CM,QAA1C;AAAA,MAAoDC,OAApD,GAAmFP,KAAnF,CAAoDO,OAApD;AAAA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nB,MAAhB,CAPzC;AAQE,IAAA,UAAU,EAAE;AACVkD,MAAAA,QAAQ,EAAE;AACRC,QAAAA,EAAE,EAAEN,OADI;AAERlC,QAAAA,MAFQ;AAGRE,QAAAA;AAHQ,OADA;AAMVuC,MAAAA,WAAW,EAAE;AACXC,QAAAA,QAAQ,EAAE,CAAC;AADA;AANH,KARd;AAkBE,IAAA,KAAK,EAAE;AAACtB,MAAAA;AAAD,KAlBT;AAmBE,IAAA,IAAI,EAAE;AAACR,MAAAA;AAAD;AAnBR,IADF,CAdF,CADF;AAwCD,CAxFc,C","sourcesContent":["import * as React from 'react'\nimport ReactMde from 'react-mde'\nimport ReactMarkdown from 'react-markdown'\nimport gfm from 'remark-gfm'\nimport {useId} from '@reach/auto-id'\n\nimport PatchEvent, {set, unset} from 'part:@sanity/form-builder/patch-event'\nimport sanityClient from 'part:@sanity/base/client'\nimport {FormField} from '@sanity/base/components'\n\nimport useDebounce from '../hooks/useDebounce'\n\nimport 'react-mde/lib/styles/css/react-mde-all.css?raw'\n\nconst Preview = ({markdown}) => {\n return <ReactMarkdown plugins={[gfm]}>{markdown}</ReactMarkdown>\n}\n\nconst defaultToolbarCommands = [\n ['header', 'bold', 'italic', 'strikethrough'],\n ['link', 'quote', 'code'],\n ['unordered-list', 'ordered-list', 'checked-list'],\n]\n\nexport default React.forwardRef(function MarkdownEditor(props, ref) {\n const {type, value = '', markers, onBlur, onChange, onFocus, presence, readOnly} = props\n const {options = {}} = type\n const [selectedTab, setSelectedTab] = React.useState('write')\n const [editedValue, setEditedValue] = React.useState(value)\n const debouncedValue = useDebounce(editedValue, 100)\n const textarea = React.useRef()\n\n // Conditionally update textarea styles based on read only access.\n // It's also possible to define inline styles via `childProps.textArea.style` on `<ReactMde />`,\n // but this will override any dynamically created styles provided by the component itself.\n React.useEffect(() => {\n if (textarea.current) {\n textarea.current.style.backgroundColor = readOnly ? 'rgba(240,240,240)' : 'rgba(255,255,255)'\n }\n }, [textarea])\n\n React.useEffect(() => {\n setEditedValue(value)\n }, [value])\n\n React.useEffect(() => {\n if (!debouncedValue && value) {\n onChange(PatchEvent.from([unset()]))\n } else if (debouncedValue !== value) {\n onChange(PatchEvent.from([set(debouncedValue)]))\n }\n }, [debouncedValue])\n\n const saveImage = async function* (data) {\n const client = sanityClient.withConfig({apiVersion: '2021-03-25'})\n\n let success = true\n const result = await client.assets\n .upload('image', data)\n .then((doc) => `${doc.url}?w=450`)\n .catch(() => {\n success = false\n return `Error: Could not upload file. Only images are supported.`\n })\n\n yield result\n return success\n }\n\n // Generate a random ID to link our FormField label and input component\n const inputId = useId()\n\n return (\n <FormField\n description={type.description} // Creates description from schema\n inputId={inputId} // A unique ID for this input\n title={type.title} // Creates label from schema title\n __unstable_markers={markers} // Handles all markers including validation\n __unstable_presence={presence} // Handles presence avatars\n >\n {/*\n Assign our forwarded ref to a wrapper element.\n\n Ideally, this should be assigned to the textarea inside <ReactMde /> component.\n Whilst `react-mde` does allow you to target individual sub-components' refs,\n it will complain if you try and assign a forwarded ref.\n */}\n <div ref={ref}>\n <ReactMde\n toolbarCommands={options['toolbar'] || defaultToolbarCommands}\n value={editedValue}\n onChange={setEditedValue}\n selectedTab={selectedTab}\n onTabChange={setSelectedTab}\n readOnly={readOnly}\n generateMarkdownPreview={(markdown) => Promise.resolve(<Preview markdown={markdown} />)}\n childProps={{\n textArea: {\n id: inputId,\n onBlur,\n onFocus,\n },\n writeButton: {\n tabIndex: -1,\n },\n }}\n paste={{saveImage}}\n refs={{textarea}}\n />\n </div>\n </FormField>\n )\n})\n"],"file":"Editor.js"}
|
package/lib/hooks/useDebounce.js
CHANGED
|
@@ -5,11 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = useDebounce;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
9
|
-
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
8
|
+
var _react = require("react");
|
|
13
9
|
|
|
14
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
11
|
|
|
@@ -34,7 +30,7 @@ function useDebounce(value, delay) {
|
|
|
34
30
|
setDebouncedValue(value);
|
|
35
31
|
}, delay);
|
|
36
32
|
return () => clearTimeout(handler);
|
|
37
|
-
}, [value]);
|
|
33
|
+
}, [value, delay]);
|
|
38
34
|
return debouncedValue;
|
|
39
35
|
}
|
|
40
36
|
//# sourceMappingURL=useDebounce.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useDebounce.js"],"names":["useDebounce","value","delay","debouncedValue","setDebouncedValue","handler","setTimeout","clearTimeout"],"mappings":";;;;;;;AAAA
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useDebounce.js"],"names":["useDebounce","value","delay","debouncedValue","setDebouncedValue","handler","setTimeout","clearTimeout"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;AACe,SAASA,WAAT,CAAqBC,KAArB,EAA4BC,KAA5B,EAAmC;AAChD,kBAA4C,qBAASD,KAAT,CAA5C;AAAA;AAAA,MAAOE,cAAP;AAAA,MAAuBC,iBAAvB;;AACA,wBAAU,MAAM;AACd,QAAMC,OAAO,GAAGC,UAAU,CAAC,MAAM;AAC/BF,MAAAA,iBAAiB,CAACH,KAAD,CAAjB;AACD,KAFyB,EAEvBC,KAFuB,CAA1B;AAIA,WAAO,MAAMK,YAAY,CAACF,OAAD,CAAzB;AACD,GAND,EAMG,CAACJ,KAAD,EAAQC,KAAR,CANH;AAQA,SAAOC,cAAP;AACD","sourcesContent":["import {useState, useEffect} from 'react'\nexport default function useDebounce(value, delay) {\n const [debouncedValue, setDebouncedValue] = useState(value)\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value)\n }, delay)\n\n return () => clearTimeout(handler)\n }, [value, delay])\n\n return debouncedValue\n}\n"],"file":"useDebounce.js"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-markdown",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Markdown fields in Sanity Studio. Supports Github flavored Markdown and image uploads.",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "sanipack build",
|
|
7
|
-
"watch": "sanipack build --watch",
|
|
8
|
-
"prepublishOnly": "sanipack build"
|
|
9
|
-
},
|
|
10
5
|
"keywords": [
|
|
11
6
|
"sanity",
|
|
12
7
|
"sanity-plugin",
|
|
@@ -14,29 +9,27 @@
|
|
|
14
9
|
"markdown",
|
|
15
10
|
"github flavored markdown"
|
|
16
11
|
],
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
"react-markdown": "^5.0.3",
|
|
21
|
-
"react-mde": "^11.5.0",
|
|
22
|
-
"remark-gfm": "^1.0.0"
|
|
12
|
+
"homepage": "https://sanity.io",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/sanity-io/sanity-plugin-markdown/issues"
|
|
23
15
|
},
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"eslint-config-sanity": "5.1.0",
|
|
28
|
-
"eslint-plugin-react": "^7.23.2",
|
|
29
|
-
"prettier": "^2.3.0",
|
|
30
|
-
"sanipack": "^2.0.1"
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git@github.com:sanity-io/sanity-plugin-markdown.git"
|
|
31
19
|
},
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "sanipack build",
|
|
24
|
+
"lint": "eslint .",
|
|
25
|
+
"prepare": "husky install",
|
|
26
|
+
"prepublishOnly": "sanipack build",
|
|
27
|
+
"watch": "sanipack build --watch"
|
|
35
28
|
},
|
|
36
29
|
"prettier": {
|
|
37
|
-
"semi": false,
|
|
38
|
-
"printWidth": 100,
|
|
39
30
|
"bracketSpacing": false,
|
|
31
|
+
"printWidth": 100,
|
|
32
|
+
"semi": false,
|
|
40
33
|
"singleQuote": true
|
|
41
34
|
},
|
|
42
35
|
"eslintConfig": {
|
|
@@ -48,12 +41,29 @@
|
|
|
48
41
|
"prettier/react"
|
|
49
42
|
]
|
|
50
43
|
},
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@reach/auto-id": "^0.13.2",
|
|
46
|
+
"react-markdown": "^5.0.3",
|
|
47
|
+
"react-mde": "^11.5.0",
|
|
48
|
+
"remark-gfm": "^1.0.0"
|
|
54
49
|
},
|
|
55
|
-
"
|
|
56
|
-
"
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@commitlint/cli": "^17.0.3",
|
|
52
|
+
"@commitlint/config-conventional": "^17.0.3",
|
|
53
|
+
"@sanity/semantic-release-preset": "^2.0.0",
|
|
54
|
+
"eslint": "^8.7.0",
|
|
55
|
+
"eslint-config-prettier": "^8.3.0",
|
|
56
|
+
"eslint-config-sanity": "^5.1.0",
|
|
57
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
58
|
+
"eslint-plugin-react": "^7.28.0",
|
|
59
|
+
"eslint-plugin-react-hooks": "^4.5.0",
|
|
60
|
+
"husky": "^8.0.1",
|
|
61
|
+
"lint-staged": "^12.4.1",
|
|
62
|
+
"prettier": "^2.7.1",
|
|
63
|
+
"sanipack": "^2.0.1"
|
|
57
64
|
},
|
|
58
|
-
"
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@sanity/base": "^2.21.5",
|
|
67
|
+
"react": "^17.0.0"
|
|
68
|
+
}
|
|
59
69
|
}
|