Skip to content

Commit 5c26b3a

Browse files
committed
fix - code-rabbit review issues
1 parent ad4d0b4 commit 5c26b3a

8 files changed

Lines changed: 66 additions & 13 deletions

File tree

apps/www/config/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,7 @@ const componentDefinitions = [
17021702
"usageCode": "import { LimelightNav } from \"@/components/ui/limelight-nav\";\nimport { Home, Bookmark, PlusCircle, User, Settings } from \"lucide-react\";\n\nexport default function Example() {\n return (\n <div className=\"flex items-center justify-center p-12 h-[300px] w-full bg-neutral-950 rounded-xl border border-neutral-800\">\n <LimelightNav \n limelightColor=\"#06b6d4\"\n className=\"bg-neutral-900/50\"\n items={[\n { id: '1', icon: <Home />, label: 'Home' },\n { id: '2', icon: <Bookmark />, label: 'Bookmarks' },\n { id: '3', icon: <PlusCircle />, label: 'Add' },\n { id: '4', icon: <User />, label: 'Profile' },\n { id: '5', icon: <Settings />, label: 'Settings' }\n ]}\n />\n </div>\n );\n}"
17031703
}
17041704
],
1705-
"usageCode": "\"use client\";\nimport { LimelightNav } from \"@/components/ui/limelight-nav\";\n\nconst HomeIcon = (props) => (\n <svg {...props} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <path d=\"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\" />\n </svg>\n);\nconst SearchIcon = (props) => (\n <svg {...props} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <circle cx=\"11\" cy=\"11\" r=\"8\" /><path d=\"m21 21-4.3-4.3\" />\n </svg>\n);\nconst UserIcon = (props) => (\n <svg {...props} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <path d=\"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2\" /><circle cx=\"12\" cy=\"7\" r=\"4\" />\n </svg>\n);\n\nexport default function Example() {\n return (\n <div className=\"flex items-center justify-center p-20\">\n <LimelightNav\n items={[\n { id: 1, icon: <HomeIcon className=\"w-6 h-6 text-white\" />, label: \"Home\" },\n { id: 2, icon: <SearchIcon className=\"w-6 h-6 text-white\" />, label: \"Search\" },\n { id: 3, icon: <UserIcon className=\"w-6 h-6 text-white\" />, label: \"Profile\" },\n ]}\n />\n </div>\n );\n}"
1705+
"usageCode": "\"use client\";\nimport type { SVGProps } from \"react\";\nimport { LimelightNav } from \"@/components/ui/limelight-nav\";\n\nconst HomeIcon = (props: SVGProps<SVGSVGElement>) => (\n <svg {...props} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <path d=\"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\" />\n </svg>\n);\nconst SearchIcon = (props: SVGProps<SVGSVGElement>) => (\n <svg {...props} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <circle cx=\"11\" cy=\"11\" r=\"8\" /><path d=\"m21 21-4.3-4.3\" />\n </svg>\n);\nconst UserIcon = (props: SVGProps<SVGSVGElement>) => (\n <svg {...props} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <path d=\"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2\" /><circle cx=\"12\" cy=\"7\" r=\"4\" />\n </svg>\n);\n\nexport default function Example() {\n return (\n <div className=\"flex items-center justify-center p-20\">\n <LimelightNav\n items={[\n { id: 1, icon: <HomeIcon className=\"w-6 h-6 text-white\" />, label: \"Home\" },\n { id: 2, icon: <SearchIcon className=\"w-6 h-6 text-white\" />, label: \"Search\" },\n { id: 3, icon: <UserIcon className=\"w-6 h-6 text-white\" />, label: \"Profile\" },\n ]}\n />\n </div>\n );\n}"
17061706
},
17071707
{
17081708
"slug": "data-table",

apps/www/config/docs-scenarios.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,13 @@ export const docsScenarios: Record<string, ComponentDocs> = {
291291
"meteors-card": {
292292
"slug": "meteors-card",
293293
"overview": "MeteorsCard wraps content in a card with animated meteor streaks flying across it. The custom Tailwind animation is installed automatically via `uniqueui add`.",
294-
"scenarios": []
294+
"scenarios": [
295+
{
296+
"title": "Hero spotlight card",
297+
"description": "Use a single MeteorsCard as a dark hero panel with a short headline and supporting line so the meteor field reads behind the copy.",
298+
"code": "import { MeteorsCard } from \"@/components/ui/meteors-card\";\n\nexport default function MeteorHero() {\n return (\n <div className=\"min-h-[280px] flex items-center justify-center p-10 bg-neutral-950\">\n <MeteorsCard className=\"max-w-lg w-full border border-neutral-800 bg-neutral-900/80 p-8 rounded-2xl\">\n <h2 className=\"text-2xl font-bold text-white mb-2\">Ship faster</h2>\n <p className=\"text-neutral-400 text-sm\">\n Animated meteors add motion without distracting from your CTA.\n </p>\n </MeteorsCard>\n </div>\n );\n}"
299+
}
300+
]
295301
},
296302
"flip-card": {
297303
"slug": "flip-card",
@@ -587,7 +593,7 @@ export const docsScenarios: Record<string, ComponentDocs> = {
587593
{
588594
"title": "Mobile bottom navigation bar",
589595
"description": "Replace a static bottom nav with an animated limelight bar to signal the active route.",
590-
"code": "\"use client\";\nimport { LimelightNav } from \"@/components/ui/limelight-nav\";\nimport { useState } from \"react\";\n\nconst HomeIcon = (p) => <svg {...p} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\" /></svg>;\nconst SearchIcon = (p) => <svg {...p} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><circle cx=\"11\" cy=\"11\" r=\"8\" /><path d=\"m21 21-4.3-4.3\" /></svg>;\nconst BellIcon = (p) => <svg {...p} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9\" /><path d=\"M10.3 21a1.94 1.94 0 0 0 3.4 0\" /></svg>;\nconst UserIcon = (p) => <svg {...p} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2\" /><circle cx=\"12\" cy=\"7\" r=\"4\" /></svg>;\n\nexport default function BottomNav() {\n const [active, setActive] = useState(0);\n return (\n <div className=\"flex items-center justify-center p-16\">\n <LimelightNav\n items={[\n { id: 1, icon: <HomeIcon className=\"w-6 h-6 text-white\" />, label: \"Home\" },\n { id: 2, icon: <SearchIcon className=\"w-6 h-6 text-white\" />, label: \"Search\" },\n { id: 3, icon: <BellIcon className=\"w-6 h-6 text-white\" />, label: \"Notifications\" },\n { id: 4, icon: <UserIcon className=\"w-6 h-6 text-white\" />, label: \"Profile\" },\n ]}\n defaultActiveIndex={active}\n onTabChange={setActive}\n limelightColor=\"#6366f1\"\n />\n </div>\n );\n}"
596+
"code": "\"use client\";\nimport type { SVGProps } from \"react\";\nimport { LimelightNav } from \"@/components/ui/limelight-nav\";\nimport { useState } from \"react\";\n\nconst HomeIcon = (p: SVGProps<SVGSVGElement>) => <svg {...p} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\" /></svg>;\nconst SearchIcon = (p: SVGProps<SVGSVGElement>) => <svg {...p} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><circle cx=\"11\" cy=\"11\" r=\"8\" /><path d=\"m21 21-4.3-4.3\" /></svg>;\nconst BellIcon = (p: SVGProps<SVGSVGElement>) => <svg {...p} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9\" /><path d=\"M10.3 21a1.94 1.94 0 0 0 3.4 0\" /></svg>;\nconst UserIcon = (p: SVGProps<SVGSVGElement>) => <svg {...p} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2\" /><circle cx=\"12\" cy=\"7\" r=\"4\" /></svg>;\n\nexport default function BottomNav() {\n const [active, setActive] = useState(0);\n return (\n <div className=\"flex items-center justify-center p-16\">\n <LimelightNav\n items={[\n { id: 1, icon: <HomeIcon className=\"w-6 h-6 text-white\" />, label: \"Home\" },\n { id: 2, icon: <SearchIcon className=\"w-6 h-6 text-white\" />, label: \"Search\" },\n { id: 3, icon: <BellIcon className=\"w-6 h-6 text-white\" />, label: \"Notifications\" },\n { id: 4, icon: <UserIcon className=\"w-6 h-6 text-white\" />, label: \"Profile\" },\n ]}\n defaultActiveIndex={active}\n onTabChange={setActive}\n limelightColor=\"#6366f1\"\n />\n </div>\n );\n}"
591597
},
592598
{
593599
"title": "Desktop section tab strip",

packages/cli/src/commands/add-tailwind.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,31 @@ describe('updateTailwindConfig', () => {
212212
expect(result).toContain('"slide-in"');
213213
expect(result).toContain('slideIn 0.3s ease');
214214
});
215+
216+
// Test 9: export default config when config uses satisfies (create-next-app style)
217+
it('handles export default identifier with satisfies object initializer', async () => {
218+
const configPath = path.join(tmpDir, 'tailwind.config.ts');
219+
await fs.writeFile(
220+
configPath,
221+
[
222+
"import type { Config } from 'tailwindcss';",
223+
'',
224+
'const config = {',
225+
' content: [],',
226+
' theme: {},',
227+
' plugins: [],',
228+
'} satisfies Config;',
229+
'',
230+
'export default config;',
231+
].join('\n'),
232+
);
233+
234+
await updateTailwindConfig(configPath, {
235+
theme: { extend: { animation: { meteor: 'meteor 5s linear infinite' } } },
236+
});
237+
238+
const result = await fs.readFile(configPath, 'utf-8');
239+
expect(result).toContain('"meteor"');
240+
expect(result).toContain('meteor 5s linear infinite');
241+
});
215242
});

packages/cli/src/commands/add.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,17 @@ export async function updateTailwindConfig(configPath: string, newConfig: any) {
534534
// handle: const config = { ... }; export default config;
535535
// (the pattern create-next-app generates)
536536
const varDecl = sourceFile.getVariableDeclaration(expr.getText());
537-
objectLiteral = varDecl?.getInitializer()?.asKind(SyntaxKind.ObjectLiteralExpression);
537+
const initializer = varDecl?.getInitializer();
538+
objectLiteral =
539+
initializer?.asKind(SyntaxKind.ObjectLiteralExpression) ??
540+
initializer
541+
?.asKind(SyntaxKind.SatisfiesExpression)
542+
?.getExpression()
543+
.asKind(SyntaxKind.ObjectLiteralExpression) ??
544+
initializer
545+
?.asKind(SyntaxKind.AsExpression)
546+
?.getExpression()
547+
.asKind(SyntaxKind.ObjectLiteralExpression);
538548
}
539549
} else {
540550
// try module.exports

packages/cli/src/commands/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export async function init(options: InitOptions = {}) {
5151
{
5252
type: "text",
5353
name: "tailwindConfig",
54-
message: "Where is your tailwind.config.js located?",
54+
message: "Where is your Tailwind config located?",
5555
initial: options.tailwindConfig ?? DEFAULTS.tailwindConfig,
5656
},
5757
]);

packages/cli/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ program
1919
.description("Configure your project for UniqueUI")
2020
.option("-y, --yes", "Skip prompts and use defaults")
2121
.option("--dir <path>", "Components install directory")
22-
.option("--typescript", "Use TypeScript (default: true)")
22+
.option("--typescript", "Use TypeScript", true)
23+
.option("--no-typescript", "Generate JavaScript config instead of TypeScript")
2324
.action((opts) => init({ yes: opts.yes, dir: opts.dir, typescript: opts.typescript }));
2425

2526
program

0 commit comments

Comments
 (0)