easy-cms 0.9.1 → 0.11.0
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 +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-ACQWSB2M.js → chunk-PX7UK2R3.js} +36 -3
- package/dist/index.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# easy-cms
|
|
2
2
|
|
|
3
|
-
Command line tool for [Easy CMS](https://github.com/maritonx/easy-
|
|
3
|
+
Command line tool for [Easy CMS](https://github.com/maritonx/easy-cms). Install it as a dev
|
|
4
4
|
dependency; every command loads `.env` from the project root.
|
|
5
5
|
|
|
6
6
|
```bash
|
package/dist/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
|
-
import { writeFile } from "fs/promises";
|
|
4
|
-
import { isAbsolute, join, resolve } from "path";
|
|
3
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
4
|
+
import { dirname, isAbsolute, join, resolve } from "path";
|
|
5
5
|
import { createInterface } from "readline/promises";
|
|
6
6
|
import { parseArgs } from "util";
|
|
7
7
|
import {
|
|
@@ -31,7 +31,8 @@ function createStandaloneHandler(cms) {
|
|
|
31
31
|
const admin = createAdminHandler({
|
|
32
32
|
basePath: adminPath,
|
|
33
33
|
apiPath: config.routes.api,
|
|
34
|
-
locale: config.admin.locale
|
|
34
|
+
locale: config.admin.locale,
|
|
35
|
+
brand: config.admin.brand
|
|
35
36
|
});
|
|
36
37
|
const under = (path, base) => path === base || path.startsWith(`${base}/`);
|
|
37
38
|
return async (request, clientIp) => {
|
|
@@ -195,6 +196,7 @@ Commands:
|
|
|
195
196
|
create-admin Create an admin user
|
|
196
197
|
serve Run the CMS as its own server (admin + REST API)
|
|
197
198
|
run-scheduled Run due scheduled publishes and webhook retries
|
|
199
|
+
backup <file> Copy a SQLite database to a file while the CMS runs
|
|
198
200
|
|
|
199
201
|
Options:
|
|
200
202
|
--config <file> Config file (default: easy-cms.config.ts)
|
|
@@ -226,6 +228,14 @@ The file has no imports, so a frontend in another repository can copy it.
|
|
|
226
228
|
|
|
227
229
|
Creates a user (role "admin" unless --role is given). The password is asked for in the
|
|
228
230
|
terminal, or read from EASY_CMS_ADMIN_PASSWORD when there is no terminal.
|
|
231
|
+
`,
|
|
232
|
+
backup: `Usage: easy-cms backup <file> [options]
|
|
233
|
+
|
|
234
|
+
Copies the SQLite database to <file> (relative to the project root) while the CMS keeps running,
|
|
235
|
+
as a consistent snapshot. The file must not exist yet. Uploads are not included: back up the
|
|
236
|
+
uploads folder or bucket separately.
|
|
237
|
+
|
|
238
|
+
Postgres: use pg_dump, e.g. pg_dump --format=custom --file=cms.dump "$DATABASE_URL".
|
|
229
239
|
`,
|
|
230
240
|
"run-scheduled": `Usage: easy-cms run-scheduled [options]
|
|
231
241
|
|
|
@@ -295,6 +305,29 @@ async function run(argv, io = defaultIO) {
|
|
|
295
305
|
});
|
|
296
306
|
try {
|
|
297
307
|
switch (command) {
|
|
308
|
+
case "backup": {
|
|
309
|
+
const target = rest.join(" ").trim();
|
|
310
|
+
if (!target) {
|
|
311
|
+
io.err("Missing backup file.\n");
|
|
312
|
+
io.err(COMMAND_HELP.backup);
|
|
313
|
+
return 1;
|
|
314
|
+
}
|
|
315
|
+
if (!cms.db.backup) {
|
|
316
|
+
io.err(
|
|
317
|
+
'This database cannot back itself up. For Postgres use pg_dump, e.g.\n pg_dump --format=custom --file=cms.dump "$DATABASE_URL"'
|
|
318
|
+
);
|
|
319
|
+
return 1;
|
|
320
|
+
}
|
|
321
|
+
const file = isAbsolute(target) ? target : resolve(cwd, target);
|
|
322
|
+
if (existsSync(file)) {
|
|
323
|
+
io.err(`${file} already exists; choose a new file name.`);
|
|
324
|
+
return 1;
|
|
325
|
+
}
|
|
326
|
+
await mkdir(dirname(file), { recursive: true });
|
|
327
|
+
await cms.db.backup(file);
|
|
328
|
+
io.out(`Backed up the database to ${file}`);
|
|
329
|
+
return 0;
|
|
330
|
+
}
|
|
298
331
|
case "run-scheduled": {
|
|
299
332
|
const { ran, failed, webhooks } = await cms.runJobs();
|
|
300
333
|
io.out(`Ran ${ran} scheduled job(s)${failed ? `, ${failed} failed` : ""}.`);
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-cms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Command line tool for Easy CMS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"node": ">=22.12"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@easy-cms/
|
|
25
|
-
"@easy-cms/
|
|
24
|
+
"@easy-cms/admin": "^0.11.0",
|
|
25
|
+
"@easy-cms/core": "^0.11.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@easy-cms/db-sqlite": "^0.
|
|
28
|
+
"@easy-cms/db-sqlite": "^0.11.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/maritonx/easy-
|
|
35
|
+
"url": "git+https://github.com/maritonx/easy-cms.git",
|
|
36
36
|
"directory": "packages/cli"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|