@schandlergarcia/sf-web-components 1.9.20 ā 1.9.21
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 +1 -1
- package/scripts/postinstall.mjs +44 -0
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -268,10 +268,54 @@ if (fs.existsSync(packageJsonPath)) {
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
// Migrate any dashboards from old location (src/components/pages/) to new location (src/pages/)
|
|
272
|
+
const oldPagesDir = path.join(cwd, 'src/components/pages');
|
|
273
|
+
const newPagesDir = path.join(cwd, 'src/pages');
|
|
274
|
+
let migratedFiles = 0;
|
|
275
|
+
|
|
276
|
+
if (fs.existsSync(oldPagesDir)) {
|
|
277
|
+
console.log('\nš Migrating dashboards from old location...\n');
|
|
278
|
+
|
|
279
|
+
const oldFiles = fs.readdirSync(oldPagesDir).filter(f =>
|
|
280
|
+
(f.endsWith('.jsx') || f.endsWith('.tsx')) &&
|
|
281
|
+
f.includes('Dashboard') &&
|
|
282
|
+
f !== 'BlankDashboard.jsx' &&
|
|
283
|
+
f !== 'BlankDashboard.tsx'
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
for (const file of oldFiles) {
|
|
287
|
+
const oldPath = path.join(oldPagesDir, file);
|
|
288
|
+
const newFile = file.replace('.jsx', '.tsx'); // Also convert .jsx to .tsx
|
|
289
|
+
const newPath = path.join(newPagesDir, newFile);
|
|
290
|
+
|
|
291
|
+
try {
|
|
292
|
+
fs.renameSync(oldPath, newPath);
|
|
293
|
+
console.log(` ā Migrated ${file} ā src/pages/${newFile}`);
|
|
294
|
+
migratedFiles++;
|
|
295
|
+
} catch (error) {
|
|
296
|
+
console.error(` ā Failed to migrate ${file}: ${error.message}`);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Try to remove old directory if empty
|
|
301
|
+
try {
|
|
302
|
+
const remaining = fs.readdirSync(oldPagesDir);
|
|
303
|
+
if (remaining.length === 0) {
|
|
304
|
+
fs.rmdirSync(oldPagesDir);
|
|
305
|
+
console.log(' ā Removed empty src/components/pages directory');
|
|
306
|
+
}
|
|
307
|
+
} catch {
|
|
308
|
+
// Ignore errors
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
271
312
|
console.log('\nš Summary:');
|
|
272
313
|
console.log(` - Copied ${componentsCopied} UI components`);
|
|
273
314
|
console.log(` - Updated ${filesUpdated} files`);
|
|
274
315
|
console.log(` - Installed ${templatesInstalled} page templates`);
|
|
275
316
|
console.log(` - Installed CommandCenter.tsx for dashboard management`);
|
|
276
317
|
console.log(` - Added "npm run reset:command-center" script`);
|
|
318
|
+
if (migratedFiles > 0) {
|
|
319
|
+
console.log(` - Migrated ${migratedFiles} dashboard files to correct location`);
|
|
320
|
+
}
|
|
277
321
|
console.log('\nā
Setup complete! UI components are now local for optimal Tailwind scanning\n');
|