@foundrykit/cli 2.0.5 → 2.0.7
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/CHANGELOG.md +16 -0
- package/dist/cli.js +241 -63
- package/dist/cli.js.map +1 -1
- package/dist/index.js +241 -63
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/commands/add.ts +153 -16
- package/src/commands/init.ts +13 -0
- package/src/commands/list.ts +10 -13
- package/src/commands/update.ts +1 -1
- package/src/lib/constants.ts +26 -0
- package/src/lib/registry.ts +99 -39
- package/tests/dependency-resolution.test.ts +33 -11
|
@@ -328,22 +328,24 @@ import { cn } from "@foundrykit/utils";`;
|
|
|
328
328
|
const transformed = transformImportsForConfig(source, marketingConfig);
|
|
329
329
|
|
|
330
330
|
expect(transformed).toContain(
|
|
331
|
-
'import { Input } from "@/components/primitives/input";'
|
|
331
|
+
'import { Input } from "@/components/marketing/primitives/input";'
|
|
332
332
|
);
|
|
333
333
|
expect(transformed).toContain(
|
|
334
|
-
'import { Button } from "@/components/primitives/button";'
|
|
334
|
+
'import { Button } from "@/components/marketing/primitives/button";'
|
|
335
335
|
);
|
|
336
336
|
expect(transformed).toContain(
|
|
337
|
-
'import { Separator } from "@/components/primitives/separator";'
|
|
337
|
+
'import { Separator } from "@/components/marketing/primitives/separator";'
|
|
338
338
|
);
|
|
339
339
|
expect(transformed).toContain(
|
|
340
|
-
'import { Badge } from "@/components/primitives/badge";'
|
|
340
|
+
'import { Badge } from "@/components/marketing/primitives/badge";'
|
|
341
341
|
);
|
|
342
342
|
expect(transformed).toContain(
|
|
343
|
-
'import { ScrollArea } from "@/components/primitives/scroll-area";'
|
|
343
|
+
'import { ScrollArea } from "@/components/marketing/primitives/scroll-area";'
|
|
344
344
|
);
|
|
345
345
|
expect(transformed).toContain('import { cn } from "@/lib/utils";');
|
|
346
|
-
expect(transformed).not.toContain(
|
|
346
|
+
expect(transformed).not.toContain(
|
|
347
|
+
'@/components/marketing/primitives/scrollarea'
|
|
348
|
+
);
|
|
347
349
|
expect(transformed).not.toContain('@/src/components');
|
|
348
350
|
});
|
|
349
351
|
|
|
@@ -354,8 +356,8 @@ import { cn } from "@foundrykit/utils";`;
|
|
|
354
356
|
const transformed = transformImportsForConfig(source, marketingConfig);
|
|
355
357
|
|
|
356
358
|
expect(transformed).toBe(
|
|
357
|
-
'import { Button, buttonVariants } from "@/components/primitives/button";\n' +
|
|
358
|
-
'import { Sheet, SheetContent } from "@/components/primitives/sheet";'
|
|
359
|
+
'import { Button, buttonVariants } from "@/components/marketing/primitives/button";\n' +
|
|
360
|
+
'import { Sheet, SheetContent } from "@/components/marketing/primitives/sheet";'
|
|
359
361
|
);
|
|
360
362
|
});
|
|
361
363
|
|
|
@@ -389,11 +391,11 @@ import { cn } from "@foundrykit/utils";`;
|
|
|
389
391
|
);
|
|
390
392
|
|
|
391
393
|
expect(transformed).toBe(
|
|
392
|
-
'import { FancyPickerItem, fancyPickerVariants } from "@/components/primitives/fancy-picker";'
|
|
394
|
+
'import { FancyPickerItem, fancyPickerVariants } from "@/components/marketing/primitives/fancy-picker";'
|
|
393
395
|
);
|
|
394
396
|
});
|
|
395
397
|
|
|
396
|
-
it('should build usage imports from the component
|
|
398
|
+
it('should build usage imports from the configured component path, not index.tsx', () => {
|
|
397
399
|
const componentData: ComponentData = {
|
|
398
400
|
id: 'advanced-search-bar',
|
|
399
401
|
name: 'Advanced Search Bar',
|
|
@@ -409,7 +411,27 @@ import { cn } from "@foundrykit/utils";`;
|
|
|
409
411
|
};
|
|
410
412
|
|
|
411
413
|
expect(getImportPath(componentData, marketingConfig)).toBe(
|
|
412
|
-
'@/components/ui/advanced-search-bar'
|
|
414
|
+
'@/components/marketing/ui/advanced-search-bar'
|
|
415
|
+
);
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
it('should build primitive usage imports from the configured primitive path', () => {
|
|
419
|
+
const componentData: ComponentData = {
|
|
420
|
+
id: 'input-group',
|
|
421
|
+
name: 'Input Group',
|
|
422
|
+
category: 'primitives',
|
|
423
|
+
description: 'Input group primitive',
|
|
424
|
+
files: [
|
|
425
|
+
{
|
|
426
|
+
path: 'components/primitives/input-group/index.tsx',
|
|
427
|
+
type: 'component',
|
|
428
|
+
content: '',
|
|
429
|
+
},
|
|
430
|
+
],
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
expect(getImportPath(componentData, marketingConfig)).toBe(
|
|
434
|
+
'@/components/marketing/primitives/input-group'
|
|
413
435
|
);
|
|
414
436
|
});
|
|
415
437
|
});
|