@betterstart/cli 0.1.51 → 0.1.52
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/cli.js +42 -16
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2539,13 +2539,18 @@ ${selectItems}
|
|
|
2539
2539
|
return ` <div className="space-y-4">
|
|
2540
2540
|
<FormLabel className="text-sm font-medium leading-none">${label}${requiredStar}</FormLabel>${hintJSX}
|
|
2541
2541
|
{${name}FieldArray.fields.map((item, index) => (
|
|
2542
|
-
<div key={item.id} className="
|
|
2543
|
-
<
|
|
2542
|
+
<div key={item.id} className="relative rounded-lg border p-4">
|
|
2543
|
+
<button
|
|
2544
|
+
type="button"
|
|
2545
|
+
onClick={() => ${name}FieldArray.remove(index)}
|
|
2546
|
+
className="absolute right-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive"
|
|
2547
|
+
>
|
|
2548
|
+
<Trash2 className="h-4 w-4" />
|
|
2549
|
+
<span className="sr-only">Remove</span>
|
|
2550
|
+
</button>
|
|
2551
|
+
<div className="space-y-4 pr-8">
|
|
2544
2552
|
${nestedFieldsJSX}
|
|
2545
2553
|
</div>
|
|
2546
|
-
<Button type="button" variant="ghost" size="sm" onClick={() => ${name}FieldArray.remove(index)}>
|
|
2547
|
-
Remove
|
|
2548
|
-
</Button>
|
|
2549
2554
|
</div>
|
|
2550
2555
|
))}
|
|
2551
2556
|
<Button
|
|
@@ -2575,10 +2580,10 @@ function generateMultiStepForm(schema, cwd, cmsDir, options) {
|
|
|
2575
2580
|
const zodFields = buildZodFields(allFields);
|
|
2576
2581
|
const defaults = buildDefaultValues(allFields);
|
|
2577
2582
|
const listFields = getListFields(allFields);
|
|
2578
|
-
const
|
|
2583
|
+
const hasListFields2 = listFields.length > 0;
|
|
2579
2584
|
const { setup: watchSetup } = buildWatchDecls(allFields);
|
|
2580
|
-
const rhfImport =
|
|
2581
|
-
const fieldArraySetup =
|
|
2585
|
+
const rhfImport = hasListFields2 ? `import { useFieldArray, useForm } from 'react-hook-form'` : `import { useForm } from 'react-hook-form'`;
|
|
2586
|
+
const fieldArraySetup = hasListFields2 ? `
|
|
2582
2587
|
${buildFieldArrayDecls(listFields)}
|
|
2583
2588
|
` : "";
|
|
2584
2589
|
const stepsConst = buildStepsConstant(steps, schema);
|
|
@@ -2661,7 +2666,7 @@ export function ${p7.pascal}Form() {
|
|
|
2661
2666
|
return `'use client'
|
|
2662
2667
|
|
|
2663
2668
|
import { zodResolver } from '@hookform/resolvers/zod'
|
|
2664
|
-
import { Check, ChevronLeft, ChevronRight } from 'lucide-react'
|
|
2669
|
+
import { Check, ChevronLeft, ChevronRight${hasListFields ? ", Trash2" : ""} } from 'lucide-react'
|
|
2665
2670
|
import { parseAsInteger, parseAsArrayOf, useQueryState } from 'nuqs'
|
|
2666
2671
|
import { useState } from 'react'
|
|
2667
2672
|
${p7.rhfImport}
|
|
@@ -2868,14 +2873,14 @@ function generateSingleStepForm(schema, cwd, cmsDir, options) {
|
|
|
2868
2873
|
const zodFields = buildZodFields(fields);
|
|
2869
2874
|
const defaults = buildDefaultValues(fields);
|
|
2870
2875
|
const listFields = getListFields(fields);
|
|
2871
|
-
const
|
|
2876
|
+
const hasListFields2 = listFields.length > 0;
|
|
2872
2877
|
const { setup: watchSetup } = buildWatchDecls(fields);
|
|
2873
2878
|
const rawFields = schema.fields || [];
|
|
2874
2879
|
const fieldJSX = renderFieldsJSX(rawFields);
|
|
2875
2880
|
const submitText = schema.submitButtonText || "Submit";
|
|
2876
2881
|
const successMessage = escapeJsx(schema.successMessage || "Form submitted successfully!");
|
|
2877
|
-
const rhfImport =
|
|
2878
|
-
const fieldArraySetup =
|
|
2882
|
+
const rhfImport = hasListFields2 ? `import { useFieldArray, useForm } from 'react-hook-form'` : `import { useForm } from 'react-hook-form'`;
|
|
2883
|
+
const fieldArraySetup = hasListFields2 ? `
|
|
2879
2884
|
${buildFieldArrayDecls(listFields)}
|
|
2880
2885
|
` : "";
|
|
2881
2886
|
const hasRadio = fields.some((f) => f.type === "radio");
|
|
@@ -2902,9 +2907,11 @@ export function ${pascal}Form() {
|
|
|
2902
2907
|
)
|
|
2903
2908
|
}
|
|
2904
2909
|
` : "";
|
|
2910
|
+
const lucideImport = hasListFields2 ? `
|
|
2911
|
+
import { Trash2 } from 'lucide-react'` : "";
|
|
2905
2912
|
const content = `'use client'
|
|
2906
2913
|
|
|
2907
|
-
import { zodResolver } from '@hookform/resolvers/zod'
|
|
2914
|
+
import { zodResolver } from '@hookform/resolvers/zod'${lucideImport}
|
|
2908
2915
|
import { useState } from 'react'
|
|
2909
2916
|
${rhfImport}
|
|
2910
2917
|
import { z } from 'zod/v3'${queryClientImport}
|
|
@@ -15605,9 +15612,28 @@ var updateComponentCommand = new Command7("update-component").description("Updat
|
|
|
15605
15612
|
const all = getAllComponentNames();
|
|
15606
15613
|
clack2.intro("Available components");
|
|
15607
15614
|
const uiComponents = getStaticUiComponents();
|
|
15608
|
-
|
|
15609
|
-
|
|
15610
|
-
|
|
15615
|
+
const templateKeys = Object.keys(TEMPLATE_REGISTRY).sort();
|
|
15616
|
+
console.log();
|
|
15617
|
+
console.log(` UI Components (${uiComponents.length})`);
|
|
15618
|
+
console.log(` ${"\u2500".repeat(50)}`);
|
|
15619
|
+
console.log(` ${"Name".padEnd(28)} ${"Path"}`);
|
|
15620
|
+
console.log(` ${"\u2500".repeat(50)}`);
|
|
15621
|
+
for (const name of uiComponents) {
|
|
15622
|
+
console.log(` ${name.padEnd(28)} components/ui/${name}.tsx`);
|
|
15623
|
+
}
|
|
15624
|
+
console.log();
|
|
15625
|
+
console.log(` Template Components (${templateKeys.length})`);
|
|
15626
|
+
console.log(` ${"\u2500".repeat(56)}`);
|
|
15627
|
+
console.log(` ${"Name".padEnd(28)} ${"Path"}`);
|
|
15628
|
+
console.log(` ${"\u2500".repeat(56)}`);
|
|
15629
|
+
for (const name of templateKeys) {
|
|
15630
|
+
console.log(` ${name.padEnd(28)} ${TEMPLATE_REGISTRY[name].relPath}`);
|
|
15631
|
+
}
|
|
15632
|
+
console.log();
|
|
15633
|
+
console.log(` Special`);
|
|
15634
|
+
console.log(` ${"\u2500".repeat(56)}`);
|
|
15635
|
+
console.log(` ${"tiptap".padEnd(28)} components/ui/tiptap/ (all files)`);
|
|
15636
|
+
console.log();
|
|
15611
15637
|
clack2.outro(`${all.length} components available`);
|
|
15612
15638
|
return;
|
|
15613
15639
|
}
|