@knolljo/astro-sveltia-cms 0.1.0 → 0.2.1
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 +26 -6
- package/dist/index.d.ts +5 -4
- package/dist/index.js +5 -5
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@ Sveltia CMS integration for Astro.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install astro-sveltia-cms @sveltia/cms
|
|
9
|
+
|
|
10
|
+
bun add astro-sveltia-cms @sveltia/cms
|
|
11
|
+
|
|
12
|
+
deno add astro-sveltia-cms @sveltia/cms
|
|
9
13
|
```
|
|
10
14
|
|
|
11
15
|
## Usage
|
|
@@ -19,7 +23,8 @@ import sveltia from "astro-sveltia-cms";
|
|
|
19
23
|
export default defineConfig({
|
|
20
24
|
integrations: [
|
|
21
25
|
sveltia({
|
|
22
|
-
|
|
26
|
+
route: "/cms", // Optional, defaults to "/admin"
|
|
27
|
+
title: "My CMS", // Optional, defaults to "Sveltia CMS"
|
|
23
28
|
config: {
|
|
24
29
|
load_config_file: false,
|
|
25
30
|
backend: {
|
|
@@ -40,12 +45,27 @@ export default defineConfig({
|
|
|
40
45
|
This will serve the Sveltia CMS admin interface at `/cms` (or `/admin` by default).
|
|
41
46
|
The configuration object is passed directly to `CMS.init()`.
|
|
42
47
|
|
|
43
|
-
##
|
|
48
|
+
## Backend Configuration
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
The `config.backend` property determines where your content is stored. Sveltia CMS supports various Git-based backends and a local development backend.
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
### GitHub
|
|
53
|
+
```js
|
|
54
|
+
backend: {
|
|
55
|
+
name: "github",
|
|
56
|
+
repo: "username/repo",
|
|
57
|
+
branch: "main",
|
|
58
|
+
}
|
|
59
|
+
```
|
|
49
60
|
|
|
50
|
-
|
|
61
|
+
### Gitea / Codeberg
|
|
62
|
+
```js
|
|
63
|
+
backend: {
|
|
64
|
+
name: "gitea",
|
|
65
|
+
repo: "username/repo",
|
|
66
|
+
base_url: "https://codeberg.org",
|
|
67
|
+
api_root: "https://codeberg.org/api/v1",
|
|
68
|
+
}
|
|
51
69
|
```
|
|
70
|
+
|
|
71
|
+
For more details on backend configuration, including authentication and other providers, see the [Sveltia CMS Backend Documentation](https://sveltiacms.app/en/docs/backends).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { AstroIntegration } from "astro";
|
|
2
|
-
|
|
2
|
+
import type { CmsConfig } from "@sveltia/cms";
|
|
3
|
+
export type { CmsConfig };
|
|
3
4
|
export type SveltiaOptions = {
|
|
4
5
|
/**
|
|
5
6
|
* The route where the CMS will be served.
|
|
6
7
|
* @default "/admin"
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
route?: string;
|
|
9
10
|
/**
|
|
10
11
|
* The page title for the CMS admin interface.
|
|
11
|
-
* @default "
|
|
12
|
+
* @default "Sveltia CMS"
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
title?: string;
|
|
14
15
|
/**
|
|
15
16
|
* The Sveltia CMS configuration object.
|
|
16
17
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default function sveltiaCms(options) {
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const route = options.route || "/admin";
|
|
3
|
+
const title = options.title || "Sveltia CMS";
|
|
4
4
|
const virtualModuleId = "virtual:astro-sveltia-cms/config";
|
|
5
5
|
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
6
6
|
return {
|
|
@@ -9,7 +9,7 @@ export default function sveltiaCms(options) {
|
|
|
9
9
|
"astro:config:setup": ({ injectRoute, updateConfig, logger }) => {
|
|
10
10
|
// Inject the admin page route
|
|
11
11
|
injectRoute({
|
|
12
|
-
pattern:
|
|
12
|
+
pattern: route,
|
|
13
13
|
entrypoint: new URL("./admin.astro", import.meta.url),
|
|
14
14
|
});
|
|
15
15
|
// Register the virtual module plugin
|
|
@@ -27,7 +27,7 @@ export default function sveltiaCms(options) {
|
|
|
27
27
|
if (id === resolvedVirtualModuleId) {
|
|
28
28
|
return `
|
|
29
29
|
export const config = ${JSON.stringify(options.config)};
|
|
30
|
-
export const title = ${JSON.stringify(
|
|
30
|
+
export const title = ${JSON.stringify(title)};
|
|
31
31
|
`;
|
|
32
32
|
}
|
|
33
33
|
},
|
|
@@ -35,7 +35,7 @@ export default function sveltiaCms(options) {
|
|
|
35
35
|
],
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
|
-
logger.info(`Sveltia CMS injected at ${
|
|
38
|
+
logger.info(`Sveltia CMS injected at ${route}`);
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knolljo/astro-sveltia-cms",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Sveltia CMS integration for Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro-integration"
|
|
@@ -17,12 +17,13 @@
|
|
|
17
17
|
"build": "tsc && cp src/admin.astro dist/admin.astro",
|
|
18
18
|
"dev": "tsc --watch"
|
|
19
19
|
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@sveltia/cms": "^0.140.4"
|
|
22
|
+
},
|
|
20
23
|
"peerDependencies": {
|
|
21
|
-
"@sveltia/cms": "^0.140.4",
|
|
22
24
|
"astro": "^4.0.0 || ^5.0.0"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {
|
|
25
|
-
"@sveltia/cms": "^0.140.4",
|
|
26
27
|
"@types/node": "^20.0.0",
|
|
27
28
|
"astro": "^5.0.0",
|
|
28
29
|
"typescript": "^5.0.0"
|