@tpitre/story-ui 2.1.2 → 2.1.3
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/dist/cli/setup.js +18 -1
- package/package.json +1 -1
package/dist/cli/setup.js
CHANGED
|
@@ -98,6 +98,11 @@ function setupStorybookPreview(designSystem) {
|
|
|
98
98
|
if (missingDeps.length > 0) {
|
|
99
99
|
console.log(chalk.red(`❌ Cannot create preview.tsx - missing dependencies: ${missingDeps.join(', ')}`));
|
|
100
100
|
console.log(chalk.yellow(`Please install them first: npm install ${missingDeps.join(' ')}`));
|
|
101
|
+
// Clean up existing preview.tsx if it has broken imports
|
|
102
|
+
if (fs.existsSync(previewTsxPath)) {
|
|
103
|
+
fs.unlinkSync(previewTsxPath);
|
|
104
|
+
console.log(chalk.yellow('⚠️ Removed existing preview.tsx with broken imports'));
|
|
105
|
+
}
|
|
101
106
|
return;
|
|
102
107
|
}
|
|
103
108
|
}
|
|
@@ -346,7 +351,7 @@ export async function setupCommand() {
|
|
|
346
351
|
const systemName = answers.designSystem === 'antd' ? 'Ant Design' :
|
|
347
352
|
answers.designSystem === 'mantine' ? 'Mantine' :
|
|
348
353
|
answers.designSystem === 'chakra' ? 'Chakra UI' : 'the design system';
|
|
349
|
-
return
|
|
354
|
+
return `🚨 IMPORTANT: Would you like to install ${systemName} packages now?\n (Required for Storybook to work properly)`;
|
|
350
355
|
},
|
|
351
356
|
when: (answers) => ['antd', 'mantine', 'chakra'].includes(answers.designSystem),
|
|
352
357
|
default: true
|
|
@@ -417,6 +422,12 @@ export async function setupCommand() {
|
|
|
417
422
|
console.log(chalk.yellow('Please install manually and run setup again:'));
|
|
418
423
|
const config = DESIGN_SYSTEM_CONFIGS[answers.designSystem];
|
|
419
424
|
console.log(chalk.cyan(`npm install ${config.packages.join(' ')}`));
|
|
425
|
+
// Clean up any existing preview.tsx that might cause issues
|
|
426
|
+
const previewTsxPath = path.join(process.cwd(), '.storybook', 'preview.tsx');
|
|
427
|
+
if (fs.existsSync(previewTsxPath)) {
|
|
428
|
+
fs.unlinkSync(previewTsxPath);
|
|
429
|
+
console.log(chalk.yellow('⚠️ Removed preview.tsx to prevent import errors'));
|
|
430
|
+
}
|
|
420
431
|
process.exit(1);
|
|
421
432
|
}
|
|
422
433
|
// Set up Storybook preview file after successful installation
|
|
@@ -434,6 +445,12 @@ export async function setupCommand() {
|
|
|
434
445
|
console.log(chalk.red('❌ Required dependencies missing:'), missingDeps.join(', '));
|
|
435
446
|
console.log(chalk.yellow('Please install them manually:'));
|
|
436
447
|
console.log(chalk.cyan(`npm install ${missingDeps.join(' ')}`));
|
|
448
|
+
// Clean up any existing preview.tsx that might cause issues
|
|
449
|
+
const previewTsxPath = path.join(process.cwd(), '.storybook', 'preview.tsx');
|
|
450
|
+
if (fs.existsSync(previewTsxPath)) {
|
|
451
|
+
fs.unlinkSync(previewTsxPath);
|
|
452
|
+
console.log(chalk.yellow('⚠️ Removed preview.tsx to prevent import errors'));
|
|
453
|
+
}
|
|
437
454
|
process.exit(1);
|
|
438
455
|
}
|
|
439
456
|
else {
|