create-volt 0.20.0 → 0.21.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/CHANGELOG.md +12 -0
- package/index.js +25 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to `create-volt` are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/), and this project adheres to
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.21.0] - 2026-06-29
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **`import-wp-db`** — import WordPress content by reading its MySQL/MariaDB
|
|
11
|
+
database directly, for when the REST API is disabled but you have DB access
|
|
12
|
+
(on the server or via an SSH tunnel). `--prefix` for non-default table
|
|
13
|
+
prefixes (validated against SQL injection); creds via `WP_DB_URL` to keep them
|
|
14
|
+
out of shell history; `mysql2` loaded lazily. Reuses the WXR converter; unit
|
|
15
|
+
tested with an injected connection. Third migration path alongside
|
|
16
|
+
`import-wp` (REST) and `import-wxr` (file).
|
|
17
|
+
|
|
7
18
|
## [0.20.0] - 2026-06-29
|
|
8
19
|
|
|
9
20
|
### Added
|
|
@@ -290,6 +301,7 @@ All notable changes to `create-volt` are documented here. The format follows
|
|
|
290
301
|
watching and full-page hot reload. Supports `--skip-install` and `--force`,
|
|
291
302
|
and auto-detects npm / pnpm / yarn / bun for the install step.
|
|
292
303
|
|
|
304
|
+
[0.21.0]: https://github.com/MIR-2025/volt/releases/tag/v0.21.0
|
|
293
305
|
[0.20.0]: https://github.com/MIR-2025/volt/releases/tag/v0.20.0
|
|
294
306
|
[0.19.0]: https://github.com/MIR-2025/volt/releases/tag/v0.19.0
|
|
295
307
|
[0.18.0]: https://github.com/MIR-2025/volt/releases/tag/v0.18.0
|
package/index.js
CHANGED
|
@@ -63,6 +63,7 @@ let portArg = null;
|
|
|
63
63
|
let templateArg = null;
|
|
64
64
|
let outArg = null;
|
|
65
65
|
let userArg = null;
|
|
66
|
+
let prefixArg = null;
|
|
66
67
|
for (let i = 0; i < argv.length; i++) {
|
|
67
68
|
const a = argv[i];
|
|
68
69
|
if (a === "--port") portArg = argv[++i];
|
|
@@ -73,6 +74,8 @@ for (let i = 0; i < argv.length; i++) {
|
|
|
73
74
|
else if (a.startsWith("--out=")) outArg = a.slice("--out=".length);
|
|
74
75
|
else if (a === "--user") userArg = argv[++i];
|
|
75
76
|
else if (a.startsWith("--user=")) userArg = a.slice("--user=".length);
|
|
77
|
+
else if (a === "--prefix") prefixArg = argv[++i];
|
|
78
|
+
else if (a.startsWith("--prefix=")) prefixArg = a.slice("--prefix=".length);
|
|
76
79
|
else if (a.startsWith("-")) flags.add(a);
|
|
77
80
|
else positionals.push(a);
|
|
78
81
|
}
|
|
@@ -189,6 +192,28 @@ if (positionals[0] === "import-wp") {
|
|
|
189
192
|
process.exit(0);
|
|
190
193
|
}
|
|
191
194
|
|
|
195
|
+
// --- `import-wp-db` subcommand: read a WordPress MySQL database directly ---
|
|
196
|
+
if (positionals[0] === "import-wp-db") {
|
|
197
|
+
const dbUrl = positionals[1] || process.env.WP_DB_URL || process.env.DATABASE_URL;
|
|
198
|
+
if (!dbUrl) {
|
|
199
|
+
die(
|
|
200
|
+
`Usage: ${cyan("create-volt import-wp-db <mysql://user:pass@host/db>")} [--prefix wp_] [--out pages] [--drafts] [--force]\n` +
|
|
201
|
+
` Tip: set ${cyan("WP_DB_URL")} instead of passing the URL, so credentials stay out of shell history.\n` +
|
|
202
|
+
` WordPress DBs are usually firewalled to localhost — run this on the server or over an SSH tunnel. Requires ${cyan("mysql2")} (npm i mysql2).`,
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
const { runImportFromDB } = await import("./lib/import-wp-db.js");
|
|
206
|
+
console.log(dim(`Reading WordPress database (prefix ${prefixArg || "wp_"})…`));
|
|
207
|
+
let result;
|
|
208
|
+
try {
|
|
209
|
+
result = await runImportFromDB(dbUrl, { prefix: prefixArg || "wp_", drafts: flags.has("--drafts") });
|
|
210
|
+
} catch (e) {
|
|
211
|
+
die(e.message);
|
|
212
|
+
}
|
|
213
|
+
emitImported(result.imported, result.stats, path.resolve(outArg || "pages"));
|
|
214
|
+
process.exit(0);
|
|
215
|
+
}
|
|
216
|
+
|
|
192
217
|
// --- `studio` subcommand: ephemeral, localhost-only data browser (server.js --studio) ---
|
|
193
218
|
if (positionals[0] === "studio") {
|
|
194
219
|
const cwd = process.cwd();
|