@foundrykit/cli 2.0.6 → 2.0.8

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.
@@ -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('@/components/primitives/scrollarea');
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 directory, not index.tsx', () => {
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,8 +411,58 @@ 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'
413
415
  );
414
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'
435
+ );
436
+ });
437
+
438
+ it('should preserve package imports when hooks are configured as a package', () => {
439
+ const packageHooksConfig = {
440
+ ...marketingConfig,
441
+ paths: {
442
+ ...marketingConfig.paths,
443
+ hooks: '@foundrykit/hooks',
444
+ },
445
+ aliases: {
446
+ ...marketingConfig.aliases,
447
+ '@/hooks': '@foundrykit/hooks',
448
+ },
449
+ };
450
+
451
+ const source = `import {
452
+ useAdvancedSearch,
453
+ SearchContext,
454
+ type EmptyStateBehaviour,
455
+ } from '@foundrykit/hooks';`;
456
+
457
+ const transformed = transformImportsForConfig(
458
+ source,
459
+ packageHooksConfig
460
+ );
461
+
462
+ expect(transformed).toBe(source);
463
+ expect(transformed).not.toContain('@/hooks/use-advanced-search');
464
+ expect(transformed).not.toContain('@/hooks/search-context');
465
+ expect(transformed).not.toContain('@/hooks/empty-state-behaviour');
466
+ });
415
467
  });
416
468
  });