@tpitre/story-ui 1.1.1 → 1.2.0

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/README.md CHANGED
@@ -547,6 +547,40 @@ For automated releases to work, you need to add an NPM_TOKEN secret to your GitH
547
547
  2. Add it to GitHub: Settings → Secrets → Actions → New repository secret
548
548
  3. Name: `NPM_TOKEN`, Value: your npm token
549
549
 
550
+ ## Troubleshooting
551
+
552
+ ### "The requested module does not provide an export named 'Meta'"
553
+
554
+ This error occurs when Story UI is installed in a Vite-based Storybook project. The issue happens because the template uses `@storybook/react` imports, but Vite projects require `@storybook/react-vite`.
555
+
556
+ **Solution:**
557
+ 1. Update your `src/stories/StoryUI/StoryUIPanel.stories.tsx` file
558
+ 2. Change the import from:
559
+ ```typescript
560
+ import { StoryFn, Meta } from '@storybook/react';
561
+ ```
562
+ To:
563
+ ```typescript
564
+ import type { StoryFn, Meta } from '@storybook/react-vite';
565
+ ```
566
+
567
+ **Note:** This issue has been fixed in Story UI v1.2.0+. The init command now automatically detects your Storybook framework and uses the correct import.
568
+
569
+ ### Configuration validation errors
570
+
571
+ If you see "Components path does not exist" error when using a design system from npm (like Ant Design):
572
+
573
+ **Solution:**
574
+ Add `componentsPath: null` to your `story-ui.config.js`:
575
+ ```javascript
576
+ module.exports = {
577
+ importPath: "antd",
578
+ componentPrefix: "",
579
+ componentsPath: null,
580
+ // ... rest of config
581
+ };
582
+ ```
583
+
550
584
  ## Support
551
585
 
552
586
  - 📖 [Documentation](https://github.com/southleft/story-ui#readme)
package/dist/cli/index.js CHANGED
File without changes
package/dist/cli/setup.js CHANGED
@@ -24,6 +24,23 @@ export async function setupCommand() {
24
24
  console.warn(chalk.yellow('⚠️ Storybook not detected. Story UI works best with Storybook installed.'));
25
25
  console.log('Install Storybook first: npx storybook@latest init\n');
26
26
  }
27
+ // Detect Storybook framework (Vite vs Webpack)
28
+ let storybookFramework = '@storybook/react'; // default
29
+ const devDeps = packageJson.devDependencies || {};
30
+ const deps = packageJson.dependencies || {};
31
+ // Check for Vite-based Storybook
32
+ if (devDeps['@storybook/react-vite'] || deps['@storybook/react-vite']) {
33
+ storybookFramework = '@storybook/react-vite';
34
+ console.log(chalk.green('✅ Detected Vite-based Storybook'));
35
+ }
36
+ else if (devDeps['@storybook/react-webpack5'] || deps['@storybook/react-webpack5']) {
37
+ storybookFramework = '@storybook/react-webpack5';
38
+ console.log(chalk.green('✅ Detected Webpack 5-based Storybook'));
39
+ }
40
+ else if (devDeps['@storybook/nextjs'] || deps['@storybook/nextjs']) {
41
+ storybookFramework = '@storybook/nextjs';
42
+ console.log(chalk.green('✅ Detected Next.js Storybook'));
43
+ }
27
44
  // Auto-detect design system
28
45
  const autoDetected = autoDetectDesignSystem();
29
46
  if (autoDetected) {
@@ -207,7 +224,12 @@ export async function setupCommand() {
207
224
  const sourcePath = path.join(templatesDir, file);
208
225
  const targetPath = path.join(storyUITargetDir, file);
209
226
  if (fs.existsSync(sourcePath)) {
210
- fs.copyFileSync(sourcePath, targetPath);
227
+ let content = fs.readFileSync(sourcePath, 'utf-8');
228
+ // Replace Storybook import based on detected framework
229
+ if (file === 'StoryUIPanel.stories.tsx' && storybookFramework !== '@storybook/react') {
230
+ content = content.replace("import type { StoryFn, Meta } from '@storybook/react';", `import type { StoryFn, Meta } from '${storybookFramework}';`);
231
+ }
232
+ fs.writeFileSync(targetPath, content);
211
233
  console.log(chalk.green(`✅ Copied ${file}`));
212
234
  }
213
235
  else {
@@ -79,8 +79,8 @@ export function validateConfig(config) {
79
79
  }
80
80
  }
81
81
  // Check if components can be discovered
82
- if (!config.componentsPath && !config.componentsMetadataPath) {
83
- errors.push('Either componentsPath or componentsMetadataPath must be specified');
82
+ if (!config.componentsPath && !config.componentsMetadataPath && (!config.components || config.components.length === 0)) {
83
+ errors.push('Either componentsPath, componentsMetadataPath, or a components array must be specified');
84
84
  }
85
85
  if (config.componentsPath && !fs.existsSync(config.componentsPath)) {
86
86
  errors.push(`Components path does not exist: ${config.componentsPath}`);
@@ -0,0 +1,3 @@
1
+ export { Button } from './Button';
2
+ export { Card } from './Card';
3
+ export { Input } from './Input';
@@ -0,0 +1,3 @@
1
+ export { Button } from './Button';
2
+ export { Card } from './Card';
3
+ export { Input } from './Input';
@@ -0,0 +1 @@
1
+ {"root":["../index.ts","../story-ui.config.loader.ts","../story-ui.config.ts","../cli/index.ts","../cli/setup.ts","../mcp-server/index.ts","../mcp-server/routes/claude.ts","../mcp-server/routes/components.ts","../mcp-server/routes/generatestory.ts","../mcp-server/routes/memorystories.ts","../mcp-server/routes/storysync.ts","../story-generator/componentdiscovery.ts","../story-generator/configloader.ts","../story-generator/generatestory.ts","../story-generator/gitignoremanager.ts","../story-generator/inmemorystoryservice.ts","../story-generator/productiongitignoremanager.ts","../story-generator/promptgenerator.ts","../story-generator/storysync.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpitre/story-ui",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "AI-powered Storybook story generator for any React component library",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { StoryFn, Meta } from '@storybook/react';
2
+ import type { StoryFn, Meta } from '@storybook/react';
3
3
  import StoryUIPanel from './StoryUIPanel';
4
4
 
5
5
  export default {