@nuasite/cms 0.1.2 → 0.2.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 +22 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
# @nuasite/
|
|
1
|
+
# @nuasite/cms
|
|
2
2
|
|
|
3
3
|
Astro integration that adds inline visual editing to any Astro site. Scans your components, marks editable elements with CMS IDs, and serves a live editor overlay during development. All write operations (text, images, colors, components, markdown) are handled locally via a built-in dev server — no external backend required.
|
|
4
4
|
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- **Tailwind CSS v4** — Your site must use Tailwind. The CMS color editor, text styling, and class-based editing features all operate on Tailwind utility classes. Without Tailwind, those features won't work.
|
|
8
|
+
|
|
5
9
|
## Quick Start
|
|
6
10
|
|
|
7
11
|
```typescript
|
|
@@ -13,7 +17,7 @@ export default defineConfig({
|
|
|
13
17
|
})
|
|
14
18
|
```
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
Run `astro dev` and the CMS editor loads automatically. Edits write directly to your source files, and Vite HMR picks up the changes instantly.
|
|
17
21
|
|
|
18
22
|
## How It Works
|
|
19
23
|
|
|
@@ -104,44 +108,44 @@ Changes are grouped by source file, sorted by line number (descending to avoid o
|
|
|
104
108
|
|
|
105
109
|
Media uploads use a pluggable adapter pattern. Three adapters are included:
|
|
106
110
|
|
|
107
|
-
###
|
|
111
|
+
### Contember (R2 + Database) — Recommended
|
|
108
112
|
|
|
109
|
-
|
|
113
|
+
Files are stored in Cloudflare R2 with metadata tracked in the Contember database. This is the only adapter that gives you proper asset IDs, metadata, and AI-powered image annotation. Use this for production sites.
|
|
110
114
|
|
|
111
115
|
```typescript
|
|
112
|
-
import nuaCms, {
|
|
116
|
+
import nuaCms, { contemberMedia } from '@nuasite/astro-cms'
|
|
113
117
|
|
|
114
118
|
nuaCms({
|
|
115
|
-
media:
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
media: contemberMedia({
|
|
120
|
+
apiBaseUrl: 'https://api.example.com',
|
|
121
|
+
projectSlug: 'my-project',
|
|
122
|
+
sessionToken: process.env.NUA_SESSION_TOKEN,
|
|
118
123
|
}),
|
|
119
124
|
})
|
|
120
125
|
```
|
|
121
126
|
|
|
122
|
-
|
|
127
|
+
This adapter calls the worker's `/cms/:projectSlug/media/*` endpoints, which handle R2 upload, Asset record creation, and image annotation. Authentication uses the `NUA_SITE_SESSION_TOKEN` cookie.
|
|
123
128
|
|
|
124
|
-
###
|
|
129
|
+
### Local Filesystem (default)
|
|
125
130
|
|
|
126
|
-
|
|
131
|
+
Stores files in `public/uploads/`. Served directly by Vite's static file server. Zero configuration needed. Files are committed to your repo alongside your source code.
|
|
127
132
|
|
|
128
133
|
```typescript
|
|
129
|
-
import nuaCms, {
|
|
134
|
+
import nuaCms, { localMedia } from '@nuasite/astro-cms'
|
|
130
135
|
|
|
131
136
|
nuaCms({
|
|
132
|
-
media:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
sessionToken: process.env.NUA_SESSION_TOKEN,
|
|
137
|
+
media: localMedia({
|
|
138
|
+
dir: 'public/uploads', // default
|
|
139
|
+
urlPrefix: '/uploads', // default
|
|
136
140
|
}),
|
|
137
141
|
})
|
|
138
142
|
```
|
|
139
143
|
|
|
140
|
-
|
|
144
|
+
Files are named with UUIDs to avoid collisions. Listed by modification time (newest first).
|
|
141
145
|
|
|
142
146
|
### S3 / R2 Direct
|
|
143
147
|
|
|
144
|
-
Direct S3-compatible storage. Works with AWS S3, Cloudflare R2, MinIO, or any S3-compatible provider. Requires `@aws-sdk/client-s3` as a peer dependency.
|
|
148
|
+
Direct S3-compatible object storage. Works with AWS S3, Cloudflare R2, MinIO, or any S3-compatible provider. Listing, uploading, and deleting all work, but there is no database layer — content types are not preserved on list, and there are no image dimensions or annotations. Requires `@aws-sdk/client-s3` as a peer dependency.
|
|
145
149
|
|
|
146
150
|
```typescript
|
|
147
151
|
import nuaCms, { s3Media } from '@nuasite/astro-cms'
|