vite-plugin-decap-cms 0.4.0 → 0.5.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 +70 -70
- package/dist/index.cjs +10 -6
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +7 -3
- package/package.json +54 -56
package/README.md
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
# vite-plugin-decap-cms
|
|
2
|
-
|
|
3
|
-
> A Vite plugin to connect Decap CMS
|
|
4
|
-
|
|
5
|
-

|
|
6
|
-

|
|
7
|
-

|
|
8
|
-
|
|
9
|
-
> [!WARNING]
|
|
10
|
-
> This plugin has not reached a stable version, 1.0.0, and can include breaking changes following the semver specification. This plugin is open for contributions, both for code, suggestions and (missing) documentation.
|
|
11
|
-
|
|
12
|
-
## Install
|
|
13
|
-
|
|
14
|
-
```sh
|
|
15
|
-
pnpm add vite-plugin-decap-cms -D
|
|
16
|
-
npm install vite-plugin-decap-cms -D
|
|
17
|
-
yarn add vite-plugin-decap-cms -D
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
```ts
|
|
23
|
-
// vite.config.ts
|
|
24
|
-
import { defineConfig } from 'vite'
|
|
25
|
-
import decap, {
|
|
26
|
-
createFolderCollection,
|
|
27
|
-
createField,
|
|
28
|
-
} from 'vite-plugin-decap-cms'
|
|
29
|
-
|
|
30
|
-
export default defineConfig({
|
|
31
|
-
publicDir: 'public',
|
|
32
|
-
plugins: [
|
|
33
|
-
decap({
|
|
34
|
-
config: {
|
|
35
|
-
backend: {
|
|
36
|
-
name: 'test-repo',
|
|
37
|
-
},
|
|
38
|
-
mediaFolder: '/src/public/',
|
|
39
|
-
collections: [
|
|
40
|
-
createFolderCollection({
|
|
41
|
-
name: 'test',
|
|
42
|
-
label: 'Test collection',
|
|
43
|
-
folder: 'test',
|
|
44
|
-
fields: [
|
|
45
|
-
createField('markdown', { name: 'body' }),
|
|
46
|
-
],
|
|
47
|
-
}),
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
],
|
|
52
|
-
})
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
For more options and guides, see [the documentation](https://vite-plugin-decap-cms.pages.dev)
|
|
56
|
-
|
|
57
|
-
## Example
|
|
58
|
-
|
|
59
|
-
See [the documentation CMS](https://vite-plugin-decap-cms.pages.dev/admin/index.html) for an example
|
|
60
|
-
|
|
61
|
-
## Development
|
|
62
|
-
|
|
63
|
-
```sh
|
|
64
|
-
# in /docs/
|
|
65
|
-
npm run docs:dev
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## License
|
|
69
|
-
|
|
70
|
-
[MIT](LICENSE)
|
|
1
|
+
# vite-plugin-decap-cms
|
|
2
|
+
|
|
3
|
+
> A Vite plugin to connect Decap CMS
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
> [!WARNING]
|
|
10
|
+
> This plugin has not reached a stable version, 1.0.0, and can include breaking changes following the semver specification. This plugin is open for contributions, both for code, suggestions and (missing) documentation.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pnpm add vite-plugin-decap-cms -D
|
|
16
|
+
npm install vite-plugin-decap-cms -D
|
|
17
|
+
yarn add vite-plugin-decap-cms -D
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// vite.config.ts
|
|
24
|
+
import { defineConfig } from 'vite'
|
|
25
|
+
import decap, {
|
|
26
|
+
createFolderCollection,
|
|
27
|
+
createField,
|
|
28
|
+
} from 'vite-plugin-decap-cms'
|
|
29
|
+
|
|
30
|
+
export default defineConfig({
|
|
31
|
+
publicDir: 'public',
|
|
32
|
+
plugins: [
|
|
33
|
+
decap({
|
|
34
|
+
config: {
|
|
35
|
+
backend: {
|
|
36
|
+
name: 'test-repo',
|
|
37
|
+
},
|
|
38
|
+
mediaFolder: '/src/public/',
|
|
39
|
+
collections: [
|
|
40
|
+
createFolderCollection({
|
|
41
|
+
name: 'test',
|
|
42
|
+
label: 'Test collection',
|
|
43
|
+
folder: 'test',
|
|
44
|
+
fields: [
|
|
45
|
+
createField('markdown', { name: 'body' }),
|
|
46
|
+
],
|
|
47
|
+
}),
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
],
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For more options and guides, see [the documentation](https://vite-plugin-decap-cms.pages.dev)
|
|
56
|
+
|
|
57
|
+
## Example
|
|
58
|
+
|
|
59
|
+
See [the documentation CMS](https://vite-plugin-decap-cms.pages.dev/admin/index.html) for an example
|
|
60
|
+
|
|
61
|
+
## Development
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
# in /docs/
|
|
65
|
+
npm run docs:dev
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
[MIT](LICENSE)
|
package/dist/index.cjs
CHANGED
|
@@ -47,8 +47,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
47
47
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
48
|
|
|
49
49
|
// src/index.ts
|
|
50
|
-
var
|
|
51
|
-
__export(
|
|
50
|
+
var index_exports = {};
|
|
51
|
+
__export(index_exports, {
|
|
52
52
|
VitePress: () => VitePress,
|
|
53
53
|
createField: () => createField,
|
|
54
54
|
createFile: () => createFile,
|
|
@@ -60,7 +60,7 @@ __export(src_exports, {
|
|
|
60
60
|
fieldToSnakeCase: () => fieldToSnakeCase,
|
|
61
61
|
getGitData: () => getGitData
|
|
62
62
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
63
|
+
module.exports = __toCommonJS(index_exports);
|
|
64
64
|
|
|
65
65
|
// src/update.ts
|
|
66
66
|
var import_promises = require("fs/promises");
|
|
@@ -217,8 +217,8 @@ var defaultDecapCmsCdnVersion = "3.1.11";
|
|
|
217
217
|
var defaultNetlifyIdentityVersion = "1";
|
|
218
218
|
var addSlash = (path, slash = "/") => path.endsWith(slash) ? path : path + slash;
|
|
219
219
|
function resolveCdnRoute(options) {
|
|
220
|
-
const getUrl = (host = "https://unpkg.com/",
|
|
221
|
-
return `${addSlash(host)}decap-cms@^${
|
|
220
|
+
const getUrl = (host = "https://unpkg.com/", version2 = defaultDecapCmsCdnVersion) => {
|
|
221
|
+
return `${addSlash(host)}decap-cms@^${version2}/dist/decap-cms.js`;
|
|
222
222
|
};
|
|
223
223
|
return typeof options === "boolean" ? options ? getUrl() : void 0 : typeof options === "string" ? options : options != void 0 ? getUrl(options.base, options.version) : void 0;
|
|
224
224
|
}
|
|
@@ -307,7 +307,9 @@ function runProxy(options, log) {
|
|
|
307
307
|
PORT: port,
|
|
308
308
|
MODE: options == null ? void 0 : options.mode,
|
|
309
309
|
LOG_LEVEL: options == null ? void 0 : options.logLevel,
|
|
310
|
-
GIT_REPO_DIRECTORY: options == null ? void 0 : options.gitRepoDirectory
|
|
310
|
+
GIT_REPO_DIRECTORY: options == null ? void 0 : options.gitRepoDirectory,
|
|
311
|
+
BIND_HOST: options == null ? void 0 : options.host,
|
|
312
|
+
ORIGIN: options == null ? void 0 : options.origin
|
|
311
313
|
}, (_d = (_c = options == null ? void 0 : options.process) == null ? void 0 : _c.env) != null ? _d : {})
|
|
312
314
|
}));
|
|
313
315
|
if (log("proxy", "stdout")) (_e = proxy.stdout) == null ? void 0 : _e.pipe(process.stdout);
|
|
@@ -743,10 +745,12 @@ var VitePress = class {
|
|
|
743
745
|
};
|
|
744
746
|
|
|
745
747
|
// src/index.ts
|
|
748
|
+
var version = "0.5.1";
|
|
746
749
|
function VitePluginDecapCMS(options) {
|
|
747
750
|
let stored = null;
|
|
748
751
|
return {
|
|
749
752
|
name: "vite-plugin-decap-cms",
|
|
753
|
+
version,
|
|
750
754
|
async configResolved(config) {
|
|
751
755
|
const needsUpdate = stored != null ? stored.command !== config.command || stored.publicDir !== config.publicDir : true;
|
|
752
756
|
const log = createLogger(options.debug);
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { Plugin } from 'vite';
|
|
|
2
2
|
import * as yaml from 'yaml';
|
|
3
3
|
import { ExecOptions } from 'node:child_process';
|
|
4
4
|
import * as decap_cms_core from 'decap-cms-core';
|
|
5
|
-
import { CmsEventListener, CMS, EditorComponentOptions, Formatter,
|
|
5
|
+
import { CmsEventListener, CMS, EditorComponentOptions, Formatter, CmsCollection, CmsField, CmsCollectionFile, CmsConfig, CmsLocalBackend, CmsBackend, CmsFieldMeta, CmsFieldStringOrText, CmsFieldBase, CmsFieldMarkdown } from 'decap-cms-core';
|
|
6
6
|
|
|
7
7
|
interface CmsHookContext {
|
|
8
8
|
app: CMS;
|
|
@@ -177,12 +177,21 @@ interface DecapProxyOptions {
|
|
|
177
177
|
* @default true
|
|
178
178
|
*/
|
|
179
179
|
enabled?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Set the CORS 'Access-Content-Allow-Origin' for the server.
|
|
182
|
+
* @default '*'
|
|
183
|
+
*/
|
|
184
|
+
origin?: string;
|
|
180
185
|
/**
|
|
181
186
|
* Run the proxy on a different port.
|
|
182
187
|
* Does not change the local backend allowed hosts
|
|
183
188
|
* @default 8081
|
|
184
189
|
*/
|
|
185
190
|
port?: number;
|
|
191
|
+
/**
|
|
192
|
+
* Binds the proxy server to an IP address.
|
|
193
|
+
*/
|
|
194
|
+
host?: string;
|
|
186
195
|
/**
|
|
187
196
|
* Undocumented.
|
|
188
197
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Plugin } from 'vite';
|
|
|
2
2
|
import * as yaml from 'yaml';
|
|
3
3
|
import { ExecOptions } from 'node:child_process';
|
|
4
4
|
import * as decap_cms_core from 'decap-cms-core';
|
|
5
|
-
import { CmsEventListener, CMS, EditorComponentOptions, Formatter,
|
|
5
|
+
import { CmsEventListener, CMS, EditorComponentOptions, Formatter, CmsCollection, CmsField, CmsCollectionFile, CmsConfig, CmsLocalBackend, CmsBackend, CmsFieldMeta, CmsFieldStringOrText, CmsFieldBase, CmsFieldMarkdown } from 'decap-cms-core';
|
|
6
6
|
|
|
7
7
|
interface CmsHookContext {
|
|
8
8
|
app: CMS;
|
|
@@ -177,12 +177,21 @@ interface DecapProxyOptions {
|
|
|
177
177
|
* @default true
|
|
178
178
|
*/
|
|
179
179
|
enabled?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Set the CORS 'Access-Content-Allow-Origin' for the server.
|
|
182
|
+
* @default '*'
|
|
183
|
+
*/
|
|
184
|
+
origin?: string;
|
|
180
185
|
/**
|
|
181
186
|
* Run the proxy on a different port.
|
|
182
187
|
* Does not change the local backend allowed hosts
|
|
183
188
|
* @default 8081
|
|
184
189
|
*/
|
|
185
190
|
port?: number;
|
|
191
|
+
/**
|
|
192
|
+
* Binds the proxy server to an IP address.
|
|
193
|
+
*/
|
|
194
|
+
host?: string;
|
|
186
195
|
/**
|
|
187
196
|
* Undocumented.
|
|
188
197
|
*
|
package/dist/index.js
CHANGED
|
@@ -185,8 +185,8 @@ var defaultDecapCmsCdnVersion = "3.1.11";
|
|
|
185
185
|
var defaultNetlifyIdentityVersion = "1";
|
|
186
186
|
var addSlash = (path, slash = "/") => path.endsWith(slash) ? path : path + slash;
|
|
187
187
|
function resolveCdnRoute(options) {
|
|
188
|
-
const getUrl = (host = "https://unpkg.com/",
|
|
189
|
-
return `${addSlash(host)}decap-cms@^${
|
|
188
|
+
const getUrl = (host = "https://unpkg.com/", version2 = defaultDecapCmsCdnVersion) => {
|
|
189
|
+
return `${addSlash(host)}decap-cms@^${version2}/dist/decap-cms.js`;
|
|
190
190
|
};
|
|
191
191
|
return typeof options === "boolean" ? options ? getUrl() : void 0 : typeof options === "string" ? options : options != void 0 ? getUrl(options.base, options.version) : void 0;
|
|
192
192
|
}
|
|
@@ -275,7 +275,9 @@ function runProxy(options, log) {
|
|
|
275
275
|
PORT: port,
|
|
276
276
|
MODE: options == null ? void 0 : options.mode,
|
|
277
277
|
LOG_LEVEL: options == null ? void 0 : options.logLevel,
|
|
278
|
-
GIT_REPO_DIRECTORY: options == null ? void 0 : options.gitRepoDirectory
|
|
278
|
+
GIT_REPO_DIRECTORY: options == null ? void 0 : options.gitRepoDirectory,
|
|
279
|
+
BIND_HOST: options == null ? void 0 : options.host,
|
|
280
|
+
ORIGIN: options == null ? void 0 : options.origin
|
|
279
281
|
}, (_d = (_c = options == null ? void 0 : options.process) == null ? void 0 : _c.env) != null ? _d : {})
|
|
280
282
|
}));
|
|
281
283
|
if (log("proxy", "stdout")) (_e = proxy.stdout) == null ? void 0 : _e.pipe(process.stdout);
|
|
@@ -711,10 +713,12 @@ var VitePress = class {
|
|
|
711
713
|
};
|
|
712
714
|
|
|
713
715
|
// src/index.ts
|
|
716
|
+
var version = "0.5.1";
|
|
714
717
|
function VitePluginDecapCMS(options) {
|
|
715
718
|
let stored = null;
|
|
716
719
|
return {
|
|
717
720
|
name: "vite-plugin-decap-cms",
|
|
721
|
+
version,
|
|
718
722
|
async configResolved(config) {
|
|
719
723
|
const needsUpdate = stored != null ? stored.command !== config.command || stored.publicDir !== config.publicDir : true;
|
|
720
724
|
const log = createLogger(options.debug);
|
package/package.json
CHANGED
|
@@ -1,56 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vite-plugin-decap-cms",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Simplify the configuration of Decap cms for Vite projects",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"vite",
|
|
9
|
-
"vite-plugin",
|
|
10
|
-
"decap-cms"
|
|
11
|
-
],
|
|
12
|
-
"homepage": "https://github.com/ghostrider-05/vite-plugin-decap-cms",
|
|
13
|
-
"bugs": "https://github.com/ghostrider-05/vite-plugin-decap-cms/issues",
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "https://github.com/ghostrider-05/vite-plugin-decap-cms"
|
|
17
|
-
},
|
|
18
|
-
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"types": "./dist/index.d.ts",
|
|
21
|
-
"require": "./dist/index.cjs",
|
|
22
|
-
"import": "./dist/index.js"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"main": "./dist/index.cjs",
|
|
26
|
-
"module": "./dist/index.js",
|
|
27
|
-
"types": "./dist/index.d.ts",
|
|
28
|
-
"files": [
|
|
29
|
-
"dist"
|
|
30
|
-
],
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "tsup src/index.ts --dts --format cjs,esm"
|
|
33
|
-
},
|
|
34
|
-
"overrides": {
|
|
35
|
-
"react": "^
|
|
36
|
-
"@types/react": "^
|
|
37
|
-
"react-dom": "^
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"decap-cms-core": "^3.
|
|
41
|
-
"decap-server": "^3.
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"@
|
|
47
|
-
"@typescript-eslint/
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "vite-plugin-decap-cms",
|
|
3
|
+
"version": "0.5.2",
|
|
4
|
+
"description": "Simplify the configuration of Decap cms for Vite projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"vite",
|
|
9
|
+
"vite-plugin",
|
|
10
|
+
"decap-cms"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/ghostrider-05/vite-plugin-decap-cms",
|
|
13
|
+
"bugs": "https://github.com/ghostrider-05/vite-plugin-decap-cms/issues",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/ghostrider-05/vite-plugin-decap-cms.git"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"require": "./dist/index.cjs",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/index.cjs",
|
|
26
|
+
"module": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup src/index.ts --dts --format cjs,esm"
|
|
33
|
+
},
|
|
34
|
+
"overrides": {
|
|
35
|
+
"react": "^19.2.4",
|
|
36
|
+
"@types/react": "^19.2.14",
|
|
37
|
+
"react-dom": "^19.2.4"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"decap-cms-core": "^3.10.1",
|
|
41
|
+
"decap-server": "^3.5.2",
|
|
42
|
+
"yaml": "^2.8.2"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "22.19.13",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
47
|
+
"@typescript-eslint/parser": "^8.56.1",
|
|
48
|
+
"eslint": "^10.0.2",
|
|
49
|
+
"tsup": "^8.5.1",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"vite": "^7.3.1",
|
|
52
|
+
"vue": "^3.5.29"
|
|
53
|
+
}
|
|
54
|
+
}
|