easy-cms 0.64.0 → 0.65.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/dist/bin.js +1 -1
- package/dist/{chunk-F42YCHIP.js → chunk-WCISVCEZ.js} +31 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/dist/bin.js
CHANGED
|
@@ -13,7 +13,12 @@ import {
|
|
|
13
13
|
ValidationError,
|
|
14
14
|
warnDeprecated
|
|
15
15
|
} from "@easy-cms/core";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
copyDatabase,
|
|
18
|
+
decryptBackup,
|
|
19
|
+
generateTypes,
|
|
20
|
+
writeBackupFile
|
|
21
|
+
} from "@easy-cms/core/internal";
|
|
17
22
|
|
|
18
23
|
// src/serve.ts
|
|
19
24
|
import { watch } from "fs";
|
|
@@ -200,6 +205,7 @@ Commands:
|
|
|
200
205
|
serve Run the CMS as its own server (admin + REST API)
|
|
201
206
|
jobs:run Run due scheduled publishes, jobs, webhook and email retries (also: run-scheduled)
|
|
202
207
|
backup <file> Copy the database to a SQLite file while the CMS runs
|
|
208
|
+
backup:decrypt <file> Decrypt a backup made with backups.encryptionKey
|
|
203
209
|
copy --from <config> Copy all content from another config's database into this one
|
|
204
210
|
<plugin command> Commands from your config's plugins, e.g. nested:rebuild
|
|
205
211
|
|
|
@@ -242,6 +248,11 @@ yet. Postgres needs backups: { sqlite } in the config. Uploads are not included:
|
|
|
242
248
|
uploads folder or bucket separately.
|
|
243
249
|
|
|
244
250
|
Postgres: use pg_dump, e.g. pg_dump --format=custom --file=cms.dump "$DATABASE_URL".
|
|
251
|
+
`,
|
|
252
|
+
"backup:decrypt": `Usage: easy-cms backup:decrypt <file> [--out <file>] [options]
|
|
253
|
+
|
|
254
|
+
Decrypts a backup the admin made with backups.encryptionKey (a .db.gz.enc file, e.g. copied from
|
|
255
|
+
the backup bucket) into a .db.gz file, with the key from the config. The database isn't opened.
|
|
245
256
|
`,
|
|
246
257
|
copy: `Usage: easy-cms copy --from <config> [options]
|
|
247
258
|
|
|
@@ -322,6 +333,25 @@ async function run(argv, io = defaultIO) {
|
|
|
322
333
|
return 0;
|
|
323
334
|
}
|
|
324
335
|
if (command === "copy") return await copy(values.from, config, cwd, logger, io);
|
|
336
|
+
if (command === "backup:decrypt") {
|
|
337
|
+
const source = rest.join(" ").trim();
|
|
338
|
+
const key = config.backups?.encryptionKey;
|
|
339
|
+
if (!source || !key) {
|
|
340
|
+
io.err(source ? "Set backups.encryptionKey in the config.\n" : "Missing backup file.\n");
|
|
341
|
+
io.err(COMMAND_HELP["backup:decrypt"]);
|
|
342
|
+
return 1;
|
|
343
|
+
}
|
|
344
|
+
const input = isAbsolute(source) ? source : resolve(cwd, source);
|
|
345
|
+
const target = values.out ?? input.replace(/\.enc$/, "");
|
|
346
|
+
const out = isAbsolute(target) ? target : resolve(cwd, target);
|
|
347
|
+
if (out === input || existsSync(out)) {
|
|
348
|
+
io.err(`${out} already exists; choose another name with --out.`);
|
|
349
|
+
return 1;
|
|
350
|
+
}
|
|
351
|
+
await writeFile(out, decryptBackup(await readFile(input), key));
|
|
352
|
+
io.out(`Decrypted ${input} to ${out}`);
|
|
353
|
+
return 0;
|
|
354
|
+
}
|
|
325
355
|
const schema = command === "admin:create" && process.env.NODE_ENV !== "production" ? "push" : "skip";
|
|
326
356
|
const cms = await createEasyCMS2(config, {
|
|
327
357
|
cwd,
|
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.65.0",
|
|
4
4
|
"description": "Command line tool for Easy CMS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"node": ">=22.12"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@easy-cms/core": "^0.
|
|
25
|
-
"@easy-cms/admin": "^0.
|
|
24
|
+
"@easy-cms/core": "^0.65.0",
|
|
25
|
+
"@easy-cms/admin": "^0.65.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@easy-cms/db-sqlite": "^0.
|
|
28
|
+
"@easy-cms/db-sqlite": "^0.65.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|