create-volt 0.18.0 → 0.19.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/index.js +31 -0
  3. 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.19.0] - 2026-06-29
8
+
9
+ ### Added
10
+ - **`import-wxr` — WordPress importer.** `npx create-volt import-wxr <export.xml>`
11
+ converts a WordPress WXR export into markdown pages: published pages + posts →
12
+ `pages/<slug>.md` with front-matter (title, date, tags), Gutenberg block
13
+ comments stripped, body kept as HTML/markdown; drafts + attachments skipped;
14
+ slugs sanitized + de-duplicated. Flags: `--out <dir>`, `--drafts`, `--force`.
15
+ Zero-dep parser (WXR is a consistent format); unit-tested. Lowers the cost of
16
+ moving off WordPress. New `/docs/migrate`.
17
+
7
18
  ## [0.18.0] - 2026-06-29
8
19
 
9
20
  ### Added
@@ -267,6 +278,7 @@ All notable changes to `create-volt` are documented here. The format follows
267
278
  watching and full-page hot reload. Supports `--skip-install` and `--force`,
268
279
  and auto-detects npm / pnpm / yarn / bun for the install step.
269
280
 
281
+ [0.19.0]: https://github.com/MIR-2025/volt/releases/tag/v0.19.0
270
282
  [0.18.0]: https://github.com/MIR-2025/volt/releases/tag/v0.18.0
271
283
  [0.17.0]: https://github.com/MIR-2025/volt/releases/tag/v0.17.0
272
284
  [0.16.0]: https://github.com/MIR-2025/volt/releases/tag/v0.16.0
package/index.js CHANGED
@@ -61,12 +61,15 @@ const flags = new Set();
61
61
  const positionals = [];
62
62
  let portArg = null;
63
63
  let templateArg = null;
64
+ let outArg = null;
64
65
  for (let i = 0; i < argv.length; i++) {
65
66
  const a = argv[i];
66
67
  if (a === "--port") portArg = argv[++i];
67
68
  else if (a.startsWith("--port=")) portArg = a.slice("--port=".length);
68
69
  else if (a === "--template") templateArg = argv[++i];
69
70
  else if (a.startsWith("--template=")) templateArg = a.slice("--template=".length);
71
+ else if (a === "--out") outArg = argv[++i];
72
+ else if (a.startsWith("--out=")) outArg = a.slice("--out=".length);
70
73
  else if (a.startsWith("-")) flags.add(a);
71
74
  else positionals.push(a);
72
75
  }
@@ -132,6 +135,34 @@ if (positionals[0] === "config") {
132
135
  process.exit(res.status ?? 0);
133
136
  }
134
137
 
138
+ // --- `import-wxr` subcommand: import a WordPress export into markdown pages ---
139
+ if (positionals[0] === "import-wxr") {
140
+ const xmlPath = positionals[1];
141
+ if (!xmlPath) die(`Usage: ${cyan("create-volt import-wxr <export.xml>")} [--out pages] [--drafts] [--force]`);
142
+ if (!fs.existsSync(xmlPath)) die(`No such file: ${cyan(xmlPath)}`);
143
+ const outDir = path.resolve(outArg || "pages");
144
+ const { runImport } = await import("./lib/import-wxr.js");
145
+ const { imported, stats } = runImport(fs.readFileSync(xmlPath, "utf8"), { drafts: flags.has("--drafts") });
146
+ fs.mkdirSync(outDir, { recursive: true });
147
+ let written = 0;
148
+ let skippedExisting = 0;
149
+ for (const d of imported) {
150
+ const dest = path.join(outDir, d.filename);
151
+ if (fs.existsSync(dest) && !flags.has("--force")) {
152
+ skippedExisting++;
153
+ continue;
154
+ }
155
+ fs.writeFileSync(dest, d.markdown);
156
+ written++;
157
+ console.log(" " + dim(path.relative(process.cwd(), dest)));
158
+ }
159
+ const types = Object.entries(stats.byType).map(([t, n]) => `${n} ${t}`).join(", ");
160
+ console.log(`\n${cyan(`✓ Imported ${written}`)} page(s) → ${outDir}`);
161
+ console.log(dim(` source: ${stats.total} items (${types}); skipped ${stats.draftsSkipped} draft(s), ${stats.otherTypeSkipped} non-page/post item(s)${skippedExisting ? `, ${skippedExisting} already-present (use --force)` : ""}.`));
162
+ console.log(dim(" Enable the pages add-on to serve them: npm run dev -- --edit"));
163
+ process.exit(0);
164
+ }
165
+
135
166
  // --- `studio` subcommand: ephemeral, localhost-only data browser (server.js --studio) ---
136
167
  if (positionals[0] === "studio") {
137
168
  const cwd = process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-volt",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Scaffold a new Volt app — no-build, signals-based UI with Socket.io hot reload.",
5
5
  "type": "module",
6
6
  "bin": {