mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
- Deleted LuaCodeEditor stories and related components to streamline the codebase. - Removed LuaPackages stories that demonstrated Lua UI packages. - Eliminated fengari and lua-types type declarations as they are no longer needed. - Introduced a new JSON Component Renderer to handle rendering of components defined in JSON format. - Revamped the package discovery system to load package metadata, components, permissions, and styles in a new pure JSON format. - Enhanced package discovery functions to include permissions and storybook configurations.
3.7 KiB
3.7 KiB
Lua Removal Summary
Task Completed
Successfully removed all Lua support from Storybook, converting it to a JSON-only package system.
Files Removed
Directories
/src/lua/- Complete Lua execution engine/src/discovery/- Lua-specific package discovery system
Individual Files
/src/stories/LuaPackages.stories.tsx/src/stories/LuaCodeEditor.stories.tsx/src/components/LuaPackageRenderer.tsx/src/mocks/lua-engine.ts/src/mocks/auto-loader.ts/src/types/fengari.d.ts/src/types/lua-types.ts
Files Modified
/src/components/registry.tsx
- Renamed
LuaComponentProps→ComponentProps - Removed
LuaScriptViewercomponent - Removed
pushTable(),tableToJs(),parseLuaAnnotations()helper functions - Updated component registry comments
/.storybook/main.ts
- Updated comment: "Serve Lua packages" → "Serve JSON packages"
- Added schemas directory to staticDirs
- Removed Lua references
Documentation
- Updated
JSON_PACKAGES.md- Removed Lua migration section - Updated
REFACTORING_SUMMARY.md- Changed to JSON-only focus - Created
JSON_ONLY.md- New JSON-only guide - Created
LUA_REMOVAL_SUMMARY.md- This file
New JSON-Only System
Core Files
/src/utils/packageDiscovery.ts- Discovers JSON packages/src/utils/jsonComponentRenderer.tsx- Renders JSON components/src/stories/AutoDiscovered.stories.tsx- Package/component/permission browsers/src/stories/JSONComponents.stories.tsx- Interactive component viewer
Package Format
packages/my_package/
├── package.json # Metadata
├── components/ui.json # Components
├── permissions/roles.json # Permissions
└── styles/index.json # Styles
Schema References
All JSON files include $schema property:
{
"$schema": "https://metabuilder.dev/schemas/[schema-name].schema.json",
...
}
Benefits
- No Runtime Dependencies - No Lua engine (fengari) needed
- Simpler Architecture - Pure data loading, no code execution
- Better Validation - JSON Schema validation for all files
- Type Safety - Full TypeScript support
- Faster Loading - Direct JSON parsing
- Easier Testing - No Lua execution environment needed
- Better IDE Support - Autocomplete and validation via schemas
Breaking Changes
For Package Authors
- Cannot use Lua code in packages
- Must convert components to JSON format
- Must use declarative templates instead of imperative code
For Developers
- No
loadLuaUIPackage()function - Use
loadPackage()from packageDiscovery instead - No Lua component renderer
- Use
renderJsonComponent()instead
Migration Path (for any remaining Lua packages)
- Convert Lua component definitions to JSON
- Create
package.jsonwith metadata - Move components to
components/ui.json - Move permissions to
permissions/roles.json - Add
$schemareferences to all JSON files - Test in Storybook
Testing
Run Storybook and verify:
- ✅ Package Browser displays all packages
- ✅ Components Browser shows all components
- ✅ Permissions Browser lists all permissions
- ✅ Component Viewer allows interactive testing
- ✅ No console errors about missing Lua files
- ✅ No TypeScript errors
Command
cd storybook
npm run storybook
Next Steps
- Verify - Ensure all packages are JSON-only
- Test - Run Storybook and test all stories
- Document - Update any package-specific docs
- Clean - Remove any remaining Lua files in
/packages - Validate - Run schema validation on all JSON files
Status
✅ COMPLETE - Storybook is now 100% JSON-only with no Lua dependencies