@eutobias/serenojs 0.1.0 → 0.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/README.md +51 -7
- package/admin-dist/assets/{index-B3EgqtT6.js → index-Ddgw58Iy.js} +1 -1
- package/admin-dist/index.html +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.js +1 -0
- package/dist/core/backup.server.d.ts +5 -2
- package/dist/core/backup.server.js +279 -12
- package/dist/core/schema-codegen.server.d.ts +17 -0
- package/dist/core/schema-codegen.server.js +155 -0
- package/dist/ui/admin/i18n.js +4 -4
- package/package.json +4 -4
- package/src/config.ts +4 -0
- package/src/core/backup.server.ts +358 -17
- package/src/core/schema-codegen.server.ts +187 -0
- package/src/ui/admin/i18n.tsx +4 -4
package/README.md
CHANGED
|
@@ -40,8 +40,8 @@ consumed by any frontend.
|
|
|
40
40
|
- **Authentication** — opaque cookie sessions (no JWT), rotating refresh tokens,
|
|
41
41
|
user management and CSRF protection for unsafe requests.
|
|
42
42
|
- **Media uploads** — type/size validation, safe file serving and media lists.
|
|
43
|
-
- **Backups** — consistent SQLite snapshot
|
|
44
|
-
restore and an optional periodic scheduler.
|
|
43
|
+
- **Backups** — collection schemas, a consistent SQLite snapshot and assets in
|
|
44
|
+
a single archive, with restore and an optional periodic scheduler.
|
|
45
45
|
|
|
46
46
|
## Stack / requirements
|
|
47
47
|
|
|
@@ -56,14 +56,54 @@ consumed by any frontend.
|
|
|
56
56
|
|
|
57
57
|
Peer dependencies: `waku`, `react`, `react-dom`.
|
|
58
58
|
|
|
59
|
-
##
|
|
59
|
+
## Getting started
|
|
60
|
+
|
|
61
|
+
### Create a new project (recommended)
|
|
62
|
+
|
|
63
|
+
The fastest way to start is the official starter. It generates a Waku app with
|
|
64
|
+
the admin panel, REST API, auth, media, backups, SQLite configuration, a small
|
|
65
|
+
todos example app and agent skills already wired up.
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
npm create start-serenojs@latest my-app
|
|
69
|
+
# or
|
|
70
|
+
pnpm create start-serenojs my-app
|
|
71
|
+
# or
|
|
72
|
+
yarn create start-serenojs my-app
|
|
73
|
+
# or
|
|
74
|
+
bun create start-serenojs my-app
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The CLI prompts for the directory and asks whether to install dependencies and
|
|
78
|
+
initialize a git repository. For automation it accepts `--yes`, `--no-install`,
|
|
79
|
+
`--no-git` and `--pm <pnpm|npm|yarn|bun>`. See the
|
|
80
|
+
[`create-start-serenojs`](https://github.com/eutobias/serenojs/tree/main/packages/create-start-serenojs)
|
|
81
|
+
package for the full option list.
|
|
82
|
+
|
|
83
|
+
Then start the app:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
cd my-app
|
|
87
|
+
pnpm dev
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Open <http://localhost:3000/admin> and sign in with `admin@example.com` /
|
|
91
|
+
`admin123`. The example app is at <http://localhost:3000>.
|
|
92
|
+
|
|
93
|
+
The generated project points at the published `@eutobias/serenojs` range, so
|
|
94
|
+
there is nothing else to install manually.
|
|
95
|
+
|
|
96
|
+
### Add to an existing project (manual)
|
|
97
|
+
|
|
98
|
+
If you already have a Waku app and want to add the CMS yourself:
|
|
60
99
|
|
|
61
100
|
```sh
|
|
62
101
|
pnpm add @eutobias/serenojs
|
|
63
102
|
```
|
|
64
103
|
|
|
65
104
|
The package is ESM-only and ships compiled `dist/` plus the prebuilt
|
|
66
|
-
`admin-dist/` SPA.
|
|
105
|
+
`admin-dist/` SPA. Continue with the [Setup](#setup) steps below to create
|
|
106
|
+
`serenojs.config.ts` and mount the middleware.
|
|
67
107
|
|
|
68
108
|
## Setup
|
|
69
109
|
|
|
@@ -81,6 +121,7 @@ export default defineCmsConfig({
|
|
|
81
121
|
media: { path: "/media" },
|
|
82
122
|
files: { path: "/files" },
|
|
83
123
|
backup: { path: "/backup", enabled: true, intervalHours: 24, keep: 10 },
|
|
124
|
+
schemas: { path: "src/schemas" },
|
|
84
125
|
db: { path: ".data/admin.db" },
|
|
85
126
|
});
|
|
86
127
|
```
|
|
@@ -181,6 +222,7 @@ can render them directly. For localized content, parse the nested values:
|
|
|
181
222
|
| `backup.enabled` | `true` | Enable the periodic backup scheduler |
|
|
182
223
|
| `backup.intervalHours` | `24` | Scheduler interval |
|
|
183
224
|
| `backup.keep` | `10` | Number of stored backups to keep |
|
|
225
|
+
| `schemas.path` | `"src/schemas"` | Host directory where restore writes the schema modules |
|
|
184
226
|
| `db.path` | `".data/admin.db"` | SQLite file path |
|
|
185
227
|
|
|
186
228
|
The package also reads these environment variables:
|
|
@@ -445,10 +487,12 @@ extensions are always blocked. The default maximum size is 10 MB unless
|
|
|
445
487
|
| `PUT` | `/backup` | Restore a raw `.serenojs` archive body |
|
|
446
488
|
| `DELETE` | `/backup?name=<file>` | Delete a stored backup |
|
|
447
489
|
|
|
448
|
-
All backup endpoints require authentication. A backup contains
|
|
449
|
-
SQLite snapshot plus files under
|
|
490
|
+
All backup endpoints require authentication. A backup contains the collection
|
|
491
|
+
schemas (`src/schemas`), a consistent SQLite snapshot plus files under
|
|
492
|
+
`public/images` and `public/files`. Restoring rewrites the schema modules,
|
|
450
493
|
replaces the live tables in a transaction and rewrites assets; it may invalidate
|
|
451
|
-
the current session.
|
|
494
|
+
the current session. Backups created by older versions without embedded schemas
|
|
495
|
+
have their descriptors reconstructed from the database tables.
|
|
452
496
|
|
|
453
497
|
## API examples
|
|
454
498
|
|