@tpitre/story-ui 4.9.0 → 4.9.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/README.md +15 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +3 -1
- package/dist/story-generator/configLoader.d.ts.map +1 -1
- package/dist/story-generator/configLoader.js +35 -1
- package/dist/story-generator/enhancedComponentDiscovery.d.ts.map +1 -1
- package/dist/story-generator/enhancedComponentDiscovery.js +17 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -481,6 +481,21 @@ claude mcp add --transport http story-ui https://your-app-name.up.railway.app/mc
|
|
|
481
481
|
|
|
482
482
|
Or add it to Claude Desktop via **Settings** → **Connectors** → **Add custom connector**.
|
|
483
483
|
|
|
484
|
+
**Important for Storybook Live Mode Deployments:**
|
|
485
|
+
|
|
486
|
+
If deploying Storybook with Story UI integrated (where users can generate stories in the deployed app), ensure the StoryUI panel files are committed to git:
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
# Check if StoryUI is incorrectly gitignored
|
|
490
|
+
grep "StoryUI" .gitignore
|
|
491
|
+
|
|
492
|
+
# If found, remove from .gitignore and commit the panel
|
|
493
|
+
git add src/stories/StoryUI/
|
|
494
|
+
git commit -m "Add StoryUI panel for production"
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
> **Note**: Story UI versions prior to 4.10.0 incorrectly added `src/stories/StoryUI/` to `.gitignore`. See [DEPLOYMENT.md](DEPLOYMENT.md#storybook-live-mode-deployment) for full instructions.
|
|
498
|
+
|
|
484
499
|
See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed deployment instructions and troubleshooting.
|
|
485
500
|
|
|
486
501
|
---
|
package/dist/cli/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../cli/setup.ts"],"names":[],"mappings":"AAmDA;;GAEG;AACH,wBAAgB,iCAAiC,SA8ChD;AAiWD,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC7C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,YAAY,CAAC,OAAO,GAAE,YAAiB,
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../cli/setup.ts"],"names":[],"mappings":"AAmDA;;GAEG;AACH,wBAAgB,iCAAiC,SA8ChD;AAiWD,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC7C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,YAAY,CAAC,OAAO,GAAE,YAAiB,iBA85B5D"}
|
package/dist/cli/setup.js
CHANGED
|
@@ -1153,10 +1153,12 @@ VITE_STORY_UI_PORT=${answers.mcpPort || '4001'}
|
|
|
1153
1153
|
const gitignorePath = path.join(process.cwd(), '.gitignore');
|
|
1154
1154
|
if (fs.existsSync(gitignorePath)) {
|
|
1155
1155
|
const gitignoreContent = fs.readFileSync(gitignorePath, 'utf-8');
|
|
1156
|
+
// NOTE: Do NOT add StoryUI/ to gitignore - it must be committed for production deployments
|
|
1157
|
+
// The StoryUI panel component needs to be deployed to Railway/production environments
|
|
1156
1158
|
const patterns = [
|
|
1157
1159
|
'.env',
|
|
1158
1160
|
path.relative(process.cwd(), config.generatedStoriesPath),
|
|
1159
|
-
|
|
1161
|
+
'.story-ui-history/'
|
|
1160
1162
|
];
|
|
1161
1163
|
let gitignoreUpdated = false;
|
|
1162
1164
|
for (const pattern of patterns) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configLoader.d.ts","sourceRoot":"","sources":["../../story-generator/configLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAuC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"configLoader.d.ts","sourceRoot":"","sources":["../../story-generator/configLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAuC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAsH9G;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,aAAa,CAmI9C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAsD5F;AA0DD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,GAAE,MAAsB,GAAG;IAC3E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAkGA;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAWrF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAqEtE;AAgPD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAkCzF"}
|
|
@@ -73,6 +73,36 @@ const require = createRequire(import.meta.url);
|
|
|
73
73
|
let cachedConfig = null;
|
|
74
74
|
let configLoadTime = 0;
|
|
75
75
|
const CONFIG_CACHE_TTL = 30000; // 30 seconds
|
|
76
|
+
/**
|
|
77
|
+
* Normalize relative paths in config to absolute paths based on config file location.
|
|
78
|
+
* This fixes the issue where paths like './src/components' fail when process.cwd()
|
|
79
|
+
* differs from the config file location (e.g., when running via MCP or symlinks).
|
|
80
|
+
*/
|
|
81
|
+
function normalizeConfigPaths(config, configFileDir) {
|
|
82
|
+
const resolvePath = (p) => {
|
|
83
|
+
if (!p)
|
|
84
|
+
return p;
|
|
85
|
+
// If already absolute, return as-is
|
|
86
|
+
if (path.isAbsolute(p))
|
|
87
|
+
return p;
|
|
88
|
+
// Resolve relative path against config file directory
|
|
89
|
+
return path.resolve(configFileDir, p);
|
|
90
|
+
};
|
|
91
|
+
// Normalize all path-related config fields
|
|
92
|
+
if (config.generatedStoriesPath) {
|
|
93
|
+
config.generatedStoriesPath = resolvePath(config.generatedStoriesPath);
|
|
94
|
+
}
|
|
95
|
+
if (config.componentsPath) {
|
|
96
|
+
config.componentsPath = resolvePath(config.componentsPath);
|
|
97
|
+
}
|
|
98
|
+
if (config.componentsMetadataPath) {
|
|
99
|
+
config.componentsMetadataPath = resolvePath(config.componentsMetadataPath);
|
|
100
|
+
}
|
|
101
|
+
if (config.considerationsPath) {
|
|
102
|
+
config.considerationsPath = resolvePath(config.considerationsPath);
|
|
103
|
+
}
|
|
104
|
+
return config;
|
|
105
|
+
}
|
|
76
106
|
/**
|
|
77
107
|
* Loads Story UI configuration from the user's project
|
|
78
108
|
* Looks for story-ui.config.js in the current working directory
|
|
@@ -139,7 +169,11 @@ export function loadUserConfig() {
|
|
|
139
169
|
throw requireError; // Re-throw if we can't parse it
|
|
140
170
|
}
|
|
141
171
|
}
|
|
142
|
-
|
|
172
|
+
let config = createStoryUIConfig(userConfig);
|
|
173
|
+
// CRITICAL: Normalize relative paths to absolute paths based on config file location
|
|
174
|
+
// This ensures paths work regardless of process.cwd() (important for MCP servers and symlinks)
|
|
175
|
+
const configFileDir = path.dirname(configPath);
|
|
176
|
+
config = normalizeConfigPaths(config, configFileDir);
|
|
143
177
|
// Detect Storybook framework if not already specified
|
|
144
178
|
if (!config.storybookFramework) {
|
|
145
179
|
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enhancedComponentDiscovery.d.ts","sourceRoot":"","sources":["../../story-generator/enhancedComponentDiscovery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAY,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAWtD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,iBAAiB,GAAG,YAAY,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC5D,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,qBAAa,0BAA0B;IACrC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,oBAAoB,CAA6C;IACzE,OAAO,CAAC,2BAA2B,CAA0B;IAC7D,OAAO,CAAC,gBAAgB,CAAuB;gBAEnC,MAAM,EAAE,aAAa;IAKjC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA2CjD;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAyCjC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAWvB;;GAED;IACH,OAAO,CAAC,cAAc;IAmBtB;;OAEG;IACH,OAAO,CAAC,eAAe;
|
|
1
|
+
{"version":3,"file":"enhancedComponentDiscovery.d.ts","sourceRoot":"","sources":["../../story-generator/enhancedComponentDiscovery.ts"],"names":[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B3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA6B1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAmC7B;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAyD5B;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAkChC;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IA2EjC;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IA2LrC;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IAkErC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA+C/B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAiB5B;;OAEG;IACH,OAAO,CAAC,YAAY;IAiBpB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAkC3B;;OAEG;YACW,0BAA0B;IAmCxC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAcnC;;OAEG;YACW,sBAAsB;IAMpC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA4CjC;;OAEG;IACG,sBAAsB,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC9D,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC;IAwCF;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwC5B;;OAEG;IACH,0BAA0B,IAAI,MAAM,EAAE;CAMvC"}
|
|
@@ -186,15 +186,24 @@ export class EnhancedComponentDiscovery {
|
|
|
186
186
|
}
|
|
187
187
|
// Check for local component directories
|
|
188
188
|
// 1. Manually configured componentsPath (highest priority)
|
|
189
|
-
if (this.config.componentsPath
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
if (this.config.componentsPath) {
|
|
190
|
+
const componentsPathExists = fs.existsSync(this.config.componentsPath);
|
|
191
|
+
if (componentsPathExists) {
|
|
192
|
+
logger.log(`✅ Found local components at: ${this.config.componentsPath}`);
|
|
193
|
+
sources.push({
|
|
194
|
+
type: 'local',
|
|
195
|
+
path: this.config.componentsPath,
|
|
196
|
+
patterns: ['*.tsx', '*.jsx', '*.ts', '*.js']
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
// Log warning for debugging - path was configured but doesn't exist
|
|
201
|
+
logger.log(`⚠️ Configured componentsPath does not exist: ${this.config.componentsPath}`);
|
|
202
|
+
}
|
|
195
203
|
}
|
|
196
204
|
// 2. Auto-discover common React component directories from project root
|
|
197
205
|
const projectRoot = this.getProjectRoot();
|
|
206
|
+
logger.log(`📁 Project root detected: ${projectRoot}`);
|
|
198
207
|
const commonComponentDirs = [
|
|
199
208
|
'src/components',
|
|
200
209
|
'src/ui',
|
|
@@ -632,8 +641,10 @@ export class EnhancedComponentDiscovery {
|
|
|
632
641
|
*/
|
|
633
642
|
async discoverFromLocalFiles(source) {
|
|
634
643
|
if (!fs.existsSync(source.path)) {
|
|
644
|
+
logger.log(`⚠️ Local source path does not exist (skipping): ${source.path}`);
|
|
635
645
|
return;
|
|
636
646
|
}
|
|
647
|
+
logger.log(`🔍 Scanning local components at: ${source.path}`);
|
|
637
648
|
// Use adapter's file patterns if source doesn't specify patterns
|
|
638
649
|
const defaultPatterns = this.frameworkAdapter.getComponentFilePatterns()
|
|
639
650
|
.map(p => p.replace('**/', '')); // Convert glob to simpler patterns
|