@paroicms/converter 0.1.0 → 0.2.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/converter.js CHANGED
@@ -19,11 +19,13 @@ function convertRow(row) {
19
19
  inlineFormats: {
20
20
  size: (value) => ({ type: "textSize", attrs: { value } }),
21
21
  obfuscate: (value) => ({ type: "obfuscate", attrs: { asALink: value } }),
22
- "internal-link-plugin": (value) => ({
23
- type: "internalLinkPlugin",
22
+ underline: (value) => (value ? { type: "italic" } : undefined),
23
+ },
24
+ inlineNodes: {
25
+ "internal-link": (value) => ({
26
+ type: "internalLink",
24
27
  attrs: { documentId: value },
25
28
  }),
26
- underline: (value) => (value ? { type: "italic" } : undefined),
27
29
  },
28
30
  embeds: {
29
31
  media: (value) => {
@@ -37,7 +39,13 @@ function convertRow(row) {
37
39
  return { type: "media", attrs };
38
40
  },
39
41
  "html-snippet": (value) => ({ type: "htmlSnippet", attrs: { html: value } }),
40
- "video-plugin": (value) => ({ type: "videoPlugin", attrs: { videoId: value } }),
42
+ "platform-video": (value) => ({
43
+ type: "platformVideo",
44
+ attrs: {
45
+ videoId: value.videoId,
46
+ platform: value.platform,
47
+ },
48
+ }),
41
49
  },
42
50
  },
43
51
  };
package/dist/index.js CHANGED
@@ -4,33 +4,24 @@ import { access } from "node:fs/promises";
4
4
  import { parseCliArguments } from "./cli.js";
5
5
  import { createBackup, getFieldRows, processRows } from "./converter.js";
6
6
  import { createMultisiteResult, discoverDatabases } from "./multisite.js";
7
- async function processSingleDatabase(dbPath, isDryRun, doBackup) {
8
- if (doBackup && !isDryRun) {
9
- await createBackup(dbPath);
10
- }
11
- const cn = knex({
12
- client: "sqlite3",
13
- connection: {
14
- filename: dbPath,
15
- },
16
- useNullAsDefault: true,
17
- });
7
+ main().catch((error) => {
8
+ console.error("Unhandled error:", error);
9
+ process.exit(1);
10
+ });
11
+ async function main() {
18
12
  try {
19
- const rows = await getFieldRows(cn);
20
- console.log(`Found ${rows.length} rows to process\n`);
21
- if (rows.length === 0) {
22
- return {
23
- totalRows: 0,
24
- converted: 0,
25
- errors: 0,
26
- errorDetails: [],
27
- };
13
+ const options = parseCliArguments(process.argv.slice(2));
14
+ if (options.kind === "singleDatabase") {
15
+ await runSingleDatabaseMode();
16
+ }
17
+ else {
18
+ await runMultisiteMode();
28
19
  }
29
- console.log(`Processing ${rows.length} rows...`);
30
- return await processRows(cn, rows, isDryRun);
31
20
  }
32
- finally {
33
- await cn.destroy();
21
+ catch (error) {
22
+ const errorMessage = error instanceof Error ? error.message : String(error);
23
+ console.error(`Error: ${errorMessage}`);
24
+ process.exit(1);
34
25
  }
35
26
  }
36
27
  async function runSingleDatabaseMode() {
@@ -110,7 +101,7 @@ async function runMultisiteMode() {
110
101
  if (!options.force) {
111
102
  console.log("=".repeat(80));
112
103
  console.log("DRY-RUN PASS - Checking all databases");
113
- console.log("=".repeat(80) + "\n");
104
+ console.log(`${"=".repeat(80)}\n`);
114
105
  for (const db of existingDatabases) {
115
106
  console.log(`\n--- ${db.siteName} ---`);
116
107
  console.log(`Database: ${db.dbPath}`);
@@ -147,7 +138,7 @@ async function runMultisiteMode() {
147
138
  // Second pass: actual conversion on all databases
148
139
  console.log("=".repeat(80));
149
140
  console.log("CONVERSION PASS - Converting all databases");
150
- console.log("=".repeat(80) + "\n");
141
+ console.log(`${"=".repeat(80)}\n`);
151
142
  for (const db of existingDatabases) {
152
143
  console.log(`\n--- ${db.siteName} ---`);
153
144
  console.log(`Database: ${db.dbPath}`);
@@ -162,7 +153,7 @@ async function runMultisiteMode() {
162
153
  }
163
154
  const multisiteResult = createMultisiteResult(existingDatabases);
164
155
  const totalTimeInSeconds = ((Date.now() - startTime) / 1000).toFixed(1);
165
- console.log("\n" + "=".repeat(80));
156
+ console.log(`\n${"=".repeat(80)}`);
166
157
  console.log("FINAL SUMMARY");
167
158
  console.log("=".repeat(80));
168
159
  console.log(`Total databases: ${multisiteResult.totalDatabases}`);
@@ -176,23 +167,32 @@ async function runMultisiteMode() {
176
167
  console.log("Exit code: 0");
177
168
  process.exit(0);
178
169
  }
179
- async function main() {
170
+ async function processSingleDatabase(dbPath, isDryRun, doBackup) {
171
+ if (doBackup && !isDryRun) {
172
+ await createBackup(dbPath);
173
+ }
174
+ const cn = knex({
175
+ client: "sqlite3",
176
+ connection: {
177
+ filename: dbPath,
178
+ },
179
+ useNullAsDefault: true,
180
+ });
180
181
  try {
181
- const options = parseCliArguments(process.argv.slice(2));
182
- if (options.kind === "singleDatabase") {
183
- await runSingleDatabaseMode();
184
- }
185
- else {
186
- await runMultisiteMode();
182
+ const rows = await getFieldRows(cn);
183
+ console.log(`Found ${rows.length} rows to process\n`);
184
+ if (rows.length === 0) {
185
+ return {
186
+ totalRows: 0,
187
+ converted: 0,
188
+ errors: 0,
189
+ errorDetails: [],
190
+ };
187
191
  }
192
+ console.log(`Processing ${rows.length} rows...`);
193
+ return await processRows(cn, rows, isDryRun);
188
194
  }
189
- catch (error) {
190
- const errorMessage = error instanceof Error ? error.message : String(error);
191
- console.error(`Error: ${errorMessage}`);
192
- process.exit(1);
195
+ finally {
196
+ await cn.destroy();
193
197
  }
194
198
  }
195
- main().catch((error) => {
196
- console.error("Unhandled error:", error);
197
- process.exit(1);
198
- });
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@paroicms/converter",
3
- "version": "0.1.0",
4
- "description": "CLI tool to migrate field data from Quill to Tiptap format",
3
+ "version": "0.2.0",
4
+ "description": "CLI tool to migrate field data from Quill to Tiptap format in ParoiCMS databases",
5
5
  "type": "module",
6
6
  "bin": {
7
- "paroicms-converter": "./dist/index.js"
7
+ "paroicms-converter": "dist/index.js"
8
8
  },
9
9
  "scripts": {
10
10
  "build": "tsc",
@@ -15,7 +15,7 @@
15
15
  "dependencies": {
16
16
  "knex": "~3.1.0",
17
17
  "sqlite3": "~5.1.7",
18
- "@paroicms/quill-delta-to-tiptap-json": "0.1.0"
18
+ "@paroicms/quill-delta-to-tiptap-json": "0.2.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "~24.8.1",