@schandlergarcia/sf-web-components 1.1.0 → 1.1.2
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/package.json +2 -1
- package/scripts/postinstall.mjs +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schandlergarcia/sf-web-components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Reusable Salesforce web components library with Tailwind CSS v4 and shadcn/ui",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"world-atlas": "^2.0.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
+
"@schandlergarcia/sf-web-components": "^1.1.1",
|
|
62
63
|
"class-variance-authority": "^0.7.1",
|
|
63
64
|
"clsx": "^2.1.1",
|
|
64
65
|
"glob": "^11.0.0",
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -39,6 +39,13 @@ const files = glob.sync('src/**/*.{ts,tsx,js,jsx}', {
|
|
|
39
39
|
|
|
40
40
|
console.log(`Found ${files.length} source files to check\n`);
|
|
41
41
|
|
|
42
|
+
// Shadcn component replacements - map shadcn names to library names
|
|
43
|
+
const componentReplacements = {
|
|
44
|
+
'Button': 'UIButton',
|
|
45
|
+
'Input': 'UIInput',
|
|
46
|
+
// Keep other components as-is if they're not in the library
|
|
47
|
+
};
|
|
48
|
+
|
|
42
49
|
// Update imports in each file
|
|
43
50
|
for (const file of files) {
|
|
44
51
|
try {
|
|
@@ -70,6 +77,22 @@ for (const file of files) {
|
|
|
70
77
|
updates.push('utils import');
|
|
71
78
|
}
|
|
72
79
|
|
|
80
|
+
// Replace shadcn component names with library equivalents in imports from package
|
|
81
|
+
for (const [shadcnName, libraryName] of Object.entries(componentReplacements)) {
|
|
82
|
+
// Pattern: import { Button } from '@schandlergarcia/sf-web-components';
|
|
83
|
+
// Replace with: import { UIButton as Button } from '@schandlergarcia/sf-web-components';
|
|
84
|
+
const packageImportRegex = new RegExp(
|
|
85
|
+
`(import\\s*\\{[^}]*?)\\b${shadcnName}\\b([^}]*?\\}\\s*from\\s*['"]${PACKAGE_NAME}['"])`,
|
|
86
|
+
'g'
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
if (packageImportRegex.test(content)) {
|
|
90
|
+
content = content.replace(packageImportRegex, `$1${libraryName} as ${shadcnName}$2`);
|
|
91
|
+
modified = true;
|
|
92
|
+
updates.push(`aliased ${shadcnName} to ${libraryName}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
73
96
|
if (modified) {
|
|
74
97
|
fs.writeFileSync(file, content, 'utf-8');
|
|
75
98
|
filesUpdated++;
|