@tpitre/story-ui 2.1.2 → 2.1.4
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 +22 -4
- 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
|
}
|
|
@@ -332,9 +337,9 @@ export async function setupCommand() {
|
|
|
332
337
|
message: 'Which design system are you using?',
|
|
333
338
|
choices: [
|
|
334
339
|
{ name: '🤖 Auto-detect from package.json', value: 'auto' },
|
|
335
|
-
{ name: '🐜 Ant Design (antd) - Install & Configure', value: 'antd' },
|
|
336
|
-
{ name: '🎯 Mantine (@mantine/core) - Install & Configure', value: 'mantine' },
|
|
337
|
-
{ name: '⚡ Chakra UI (@chakra-ui/react) - Install & Configure', value: 'chakra' },
|
|
340
|
+
{ name: '🐜 Ant Design (antd) - Automatic Install & Configure', value: 'antd' },
|
|
341
|
+
{ name: '🎯 Mantine (@mantine/core) - Automatic Install & Configure', value: 'mantine' },
|
|
342
|
+
{ name: '⚡ Chakra UI (@chakra-ui/react) - Automatic Install & Configure', value: 'chakra' },
|
|
338
343
|
{ name: '🔧 Custom/Other', value: 'custom' }
|
|
339
344
|
],
|
|
340
345
|
default: autoDetected ? 'auto' : 'custom'
|
|
@@ -346,7 +351,8 @@ 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
|
-
|
|
354
|
+
const config = DESIGN_SYSTEM_CONFIGS[answers.designSystem];
|
|
355
|
+
return `🚨 IMPORTANT: Would you like to install ${systemName} packages now?\n Required packages: ${config.packages.join(', ')}\n (Without these packages, Story UI and Storybook will not work properly)`;
|
|
350
356
|
},
|
|
351
357
|
when: (answers) => ['antd', 'mantine', 'chakra'].includes(answers.designSystem),
|
|
352
358
|
default: true
|
|
@@ -417,6 +423,12 @@ export async function setupCommand() {
|
|
|
417
423
|
console.log(chalk.yellow('Please install manually and run setup again:'));
|
|
418
424
|
const config = DESIGN_SYSTEM_CONFIGS[answers.designSystem];
|
|
419
425
|
console.log(chalk.cyan(`npm install ${config.packages.join(' ')}`));
|
|
426
|
+
// Clean up any existing preview.tsx that might cause issues
|
|
427
|
+
const previewTsxPath = path.join(process.cwd(), '.storybook', 'preview.tsx');
|
|
428
|
+
if (fs.existsSync(previewTsxPath)) {
|
|
429
|
+
fs.unlinkSync(previewTsxPath);
|
|
430
|
+
console.log(chalk.yellow('⚠️ Removed preview.tsx to prevent import errors'));
|
|
431
|
+
}
|
|
420
432
|
process.exit(1);
|
|
421
433
|
}
|
|
422
434
|
// Set up Storybook preview file after successful installation
|
|
@@ -434,6 +446,12 @@ export async function setupCommand() {
|
|
|
434
446
|
console.log(chalk.red('❌ Required dependencies missing:'), missingDeps.join(', '));
|
|
435
447
|
console.log(chalk.yellow('Please install them manually:'));
|
|
436
448
|
console.log(chalk.cyan(`npm install ${missingDeps.join(' ')}`));
|
|
449
|
+
// Clean up any existing preview.tsx that might cause issues
|
|
450
|
+
const previewTsxPath = path.join(process.cwd(), '.storybook', 'preview.tsx');
|
|
451
|
+
if (fs.existsSync(previewTsxPath)) {
|
|
452
|
+
fs.unlinkSync(previewTsxPath);
|
|
453
|
+
console.log(chalk.yellow('⚠️ Removed preview.tsx to prevent import errors'));
|
|
454
|
+
}
|
|
437
455
|
process.exit(1);
|
|
438
456
|
}
|
|
439
457
|
else {
|