Files
metabuilder/storybook/LUA_REMOVAL_SUMMARY.md
johndoe6345789 7b0df71e89 refactor: remove LuaCodeEditor and LuaPackages stories, update package discovery system
- 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.
2026-01-02 20:48:17 +00:00

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 LuaComponentPropsComponentProps
  • Removed LuaScriptViewer component
  • 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

  1. No Runtime Dependencies - No Lua engine (fengari) needed
  2. Simpler Architecture - Pure data loading, no code execution
  3. Better Validation - JSON Schema validation for all files
  4. Type Safety - Full TypeScript support
  5. Faster Loading - Direct JSON parsing
  6. Easier Testing - No Lua execution environment needed
  7. 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)

  1. Convert Lua component definitions to JSON
  2. Create package.json with metadata
  3. Move components to components/ui.json
  4. Move permissions to permissions/roles.json
  5. Add $schema references to all JSON files
  6. 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

  1. Verify - Ensure all packages are JSON-only
  2. Test - Run Storybook and test all stories
  3. Document - Update any package-specific docs
  4. Clean - Remove any remaining Lua files in /packages
  5. Validate - Run schema validation on all JSON files

Status

COMPLETE - Storybook is now 100% JSON-only with no Lua dependencies