@decocms/start 0.36.3 → 0.36.4
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/package.json
CHANGED
|
@@ -72,6 +72,24 @@ export function transform(ctx: MigrationContext): void {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
// Flag files with HTMX patterns for manual React migration
|
|
76
|
+
if (/\bhx-(?:get|post|put|delete|trigger|target|swap|on|indicator|sync|select)\b/.test(result.content)) {
|
|
77
|
+
ctx.manualReviewItems.push({
|
|
78
|
+
file: targetPath,
|
|
79
|
+
reason: "HTMX attributes (hx-*) found — needs manual migration to React state/effects. HTMX server-side rendering (hx-get/hx-post with useSection) must be converted to React components with useState/useEffect or server functions.",
|
|
80
|
+
severity: "warning",
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Flag files with hx-on:click that use useScript (simpler pattern)
|
|
85
|
+
if (/hx-on:click=\{useScript/.test(result.content)) {
|
|
86
|
+
ctx.manualReviewItems.push({
|
|
87
|
+
file: targetPath,
|
|
88
|
+
reason: "hx-on:click with useScript found — convert to onClick with React event handler. The useScript serialization won't work as onClick value.",
|
|
89
|
+
severity: "warning",
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
75
93
|
if (ctx.dryRun) {
|
|
76
94
|
if (result.changed) {
|
|
77
95
|
log(ctx, `[DRY] Would transform: ${record.path} → ${targetPath}`);
|
|
@@ -325,6 +325,20 @@ const checks: Check[] = [
|
|
|
325
325
|
return true;
|
|
326
326
|
},
|
|
327
327
|
},
|
|
328
|
+
{
|
|
329
|
+
name: "No HTMX attributes (hx-*) in components",
|
|
330
|
+
severity: "warning",
|
|
331
|
+
fn: (ctx) => {
|
|
332
|
+
const srcDir = path.join(ctx.sourceDir, "src");
|
|
333
|
+
if (!fs.existsSync(srcDir)) return true;
|
|
334
|
+
const bad = findFilesWithPattern(srcDir, /\bhx-(?:get|post|put|delete|patch|trigger|target|swap|on|indicator|sync|select)\b/);
|
|
335
|
+
if (bad.length > 0) {
|
|
336
|
+
console.log(` HTMX attributes found (needs manual React migration): ${bad.join(", ")}`);
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
return true;
|
|
340
|
+
},
|
|
341
|
+
},
|
|
328
342
|
];
|
|
329
343
|
|
|
330
344
|
function findFilesWithPattern(
|
|
@@ -38,6 +38,13 @@ export function transformDenoIsms(content: string): TransformResult {
|
|
|
38
38
|
notes.push("Removed npm: prefix from imports");
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// @ts-ignore → @ts-expect-error (TypeScript 5+ prefers @ts-expect-error)
|
|
42
|
+
if (/@ts-ignore/.test(result)) {
|
|
43
|
+
result = result.replace(/@ts-ignore/g, "@ts-expect-error");
|
|
44
|
+
changed = true;
|
|
45
|
+
notes.push("Replaced @ts-ignore with @ts-expect-error");
|
|
46
|
+
}
|
|
47
|
+
|
|
41
48
|
// Remove Deno.* API usages — flag for manual review
|
|
42
49
|
if (result.includes("Deno.")) {
|
|
43
50
|
notes.push("MANUAL: Deno.* API usage found — needs Node.js equivalent");
|