@foundrykit/cli 2.0.8 → 2.0.9
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 +8 -0
- package/dist/cli.js +12 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/add.ts +14 -11
- package/tests/dependency-resolution.test.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foundrykit/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"glob": "^10.3.10",
|
|
26
26
|
"inquirer": "^9.2.15",
|
|
27
27
|
"node-fetch": "^3.3.0",
|
|
28
|
-
"@foundrykit/types": "2.0.
|
|
28
|
+
"@foundrykit/types": "2.0.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^20.19.9",
|
package/src/commands/add.ts
CHANGED
|
@@ -731,19 +731,22 @@ function transformRegistryBarrelImports(
|
|
|
731
731
|
'g'
|
|
732
732
|
);
|
|
733
733
|
|
|
734
|
-
return content.replace(
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
734
|
+
return content.replace(
|
|
735
|
+
importPattern,
|
|
736
|
+
(match, imports: string, source: string) => {
|
|
737
|
+
if (isPackageImportSpecifier(destinationBasePath)) {
|
|
738
|
+
return match.replace(source, destinationBasePath);
|
|
739
|
+
}
|
|
738
740
|
|
|
739
|
-
|
|
741
|
+
const groupedImports = groupImportsByComponent(imports, config, category);
|
|
740
742
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
743
|
+
return Array.from(groupedImports.entries())
|
|
744
|
+
.map(([componentPath, specifiers]) => {
|
|
745
|
+
return `import { ${specifiers.join(', ')} } from "${destinationBasePath}/${componentPath}";`;
|
|
746
|
+
})
|
|
747
|
+
.join('\n');
|
|
748
|
+
}
|
|
749
|
+
);
|
|
747
750
|
}
|
|
748
751
|
|
|
749
752
|
function groupImportsByComponent(
|
|
@@ -451,7 +451,7 @@ import { cn } from "@foundrykit/utils";`;
|
|
|
451
451
|
const source = `import {
|
|
452
452
|
useAdvancedSearch,
|
|
453
453
|
SearchContext,
|
|
454
|
-
type
|
|
454
|
+
type EmptyStateBehavior,
|
|
455
455
|
} from '@foundrykit/hooks';`;
|
|
456
456
|
|
|
457
457
|
const transformed = transformImportsForConfig(
|
|
@@ -462,7 +462,7 @@ import { cn } from "@foundrykit/utils";`;
|
|
|
462
462
|
expect(transformed).toBe(source);
|
|
463
463
|
expect(transformed).not.toContain('@/hooks/use-advanced-search');
|
|
464
464
|
expect(transformed).not.toContain('@/hooks/search-context');
|
|
465
|
-
expect(transformed).not.toContain('@/hooks/empty-state-
|
|
465
|
+
expect(transformed).not.toContain('@/hooks/empty-state-behavior');
|
|
466
466
|
});
|
|
467
467
|
});
|
|
468
468
|
});
|