datocms-plugin-sdk 2.2.5 → 2.2.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/README.md +34 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
# `datocms-plugin-sdk`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK to build DatoCMS plugins.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Using this SDK
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
To build a plugin with this SDK, see the official [DatoCMS Plugin SDK documentation](https://www.datocms.com/docs/plugin-sdk) for guides and API reference.
|
|
8
|
+
|
|
9
|
+
Plugins scaffolded from the official plugin template already include the SDK (alongside [`datocms-react-ui`](https://github.com/datocms/plugins-sdk/tree/master/packages/react-ui)). You should not need to manually add this.
|
|
10
|
+
|
|
11
|
+
## Developing
|
|
12
|
+
|
|
13
|
+
This package is developed in the [`datocms/plugins-sdk`](https://github.com/datocms/plugins-sdk) repository, a [Lerna](https://lerna.js.org/) monorepo (a single Git repo hosting multiple npm packages, with Lerna managing their shared version number and publishing). The monorepo contains two packages, released in lockstep:
|
|
14
|
+
|
|
15
|
+
- `datocms-plugin-sdk` — this core plugin SDK;
|
|
16
|
+
- [`datocms-react-ui`](https://github.com/datocms/plugins-sdk/tree/master/packages/react-ui) — a React component library that depends on it.
|
|
17
|
+
|
|
18
|
+
To work on the SDK (e.g. to prepare a PR), clone the whole monorepo — this package isn't buildable standalone:
|
|
8
19
|
|
|
9
20
|
```sh
|
|
10
|
-
|
|
21
|
+
git clone https://github.com/datocms/plugins-sdk && cd plugins-sdk
|
|
22
|
+
npm install && npx lerna bootstrap # root tooling + per-package dependencies
|
|
23
|
+
npx lerna run build # build all packages in dependency order
|
|
11
24
|
```
|
|
12
25
|
|
|
13
|
-
|
|
26
|
+
To verify the checkout, `npm test` runs the monorepo's small Jest suite (unit tests for SDK and UI helpers); it takes a couple of seconds and every test should pass.
|
|
27
|
+
|
|
28
|
+
### Testing your changes inside a real plugin
|
|
29
|
+
|
|
30
|
+
Use the provided npm `install-in-place` script, which rebuilds **this package only** and copies its artifacts (`dist/`, `manifest.json`) over the copy installed in a plugin project:
|
|
14
31
|
|
|
15
32
|
```sh
|
|
16
|
-
|
|
33
|
+
cd packages/sdk
|
|
34
|
+
INSTALL_PATH=/path/to/your-plugin npm run install-in-place
|
|
17
35
|
```
|
|
36
|
+
|
|
37
|
+
Re-run it after every change; if the plugin uses Vite, restart the dev server with `--force` so its dependency cache doesn't serve stale bits. This is enough even if the plugin also uses `datocms-react-ui`: at runtime the UI library resolves `datocms-plugin-sdk` from the plugin's `node_modules`, so it picks up your copied build automatically. To restore the registry version afterwards, in the plugin run:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
rm -rf node_modules/datocms-plugin-sdk node_modules/.vite && npm install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Releasing (maintainers)
|
|
44
|
+
|
|
45
|
+
From the repo root, `npm run publish` runs the tests, builds everything, and hands off to `lerna publish`, which bumps **both** packages to the same version (fixed mode), commits, tags `vX.Y.Z`, and publishes to npm. Use `npm run publish-next` for a prerelease under the `next` dist-tag.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-plugin-sdk",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"glob": "^11.0.0",
|
|
48
48
|
"typescript": "^5.6.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "91bf7db2461d0953cf0c531687dba2296026e2fb"
|
|
51
51
|
}
|