mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-03 18:24:53 +00:00
7.2 KiB
7.2 KiB
Next.js to Lua Conversion TODO
Table of Contents
TODOs by Phase
Phase 0 – Foundation
- Audit all
frontends/nextjs/src/entry points (pages, components, hooks, lib). Determine what goes to Lua. - Define the Lua boundary. List metadata, static, and seed assets plus their API surface.
Phase 1 – Mapping
- Map reusable TypeScript helpers to single-function Lua targets (one file, one function) and describe their inputs/outputs for future porting.
- Categorize each file as “port to Lua”, “adapter only”, or “keep in TypeScript”.
Phase 2 – Framework Bridge
- Extend the core framework only where gaps remain (data loading, metadata resolution, routing) with tiny TypeScript adapters to Lua if needed.
- Align metadata/seed folder structure with the requirements (consider
lua/orpackages/static_content) and add placeholder files.
Phase 3 – Pilot Conversion
- Pilot a TypeScript → Lua helper conversion (choose one small helper, wrap it with an adapter, and keep the rest of the build intact).
- Ensure the pilot is wired into the Next.js app without breaking the current build or tests.
Phase 4 – Stabilize
- Update documentation/tests to reflect the new Lua metadata focus and ensure existing CI steps continue to pass with the new structure.
- Iterate with feedback—confirm the team agrees on the folder layout, metadata ownership, and which TypeScript files stay as adapters.
Prep Checklist
- Confirm tooling (Lua runtime,
luacheck, etc.) is installed if needed before creating helpers. - Backup critical TypeScript files via comments or notes before starting ports.
- Share the plan with the team and gather quick approvals for folder names (
lua/,packages/static_content). - Identify one “safe” helper to convert first, ideally small and well-tested.
Audit Results
App surface
frontends/nextjs/src/apphas 40+ routes.- Each route needs metadata.
- Key files:
page.tsxlayout.tsxlevelstree- auth/dashboards
providers.tsxand theme hookspackages/[...path]/route.ts
- API handlers touch auth, users, packages, levels, power-transfers, GitHub actions, screenshot, and health.
- They depend on helpers under
frontends/nextjs/src/lib/api,lib/packages/loader,db, anddbal.
UI components
frontends/nextjs/src/componentsholds ~60 React files.- Builders:
BuilderLevel1,Level2,Level3,Level4,Level5NerdModeIDE
- Editors:
LuaEditorLuaBlocksEditorCodeEditorJsonEditorSchemaEditors
- Management views:
PackageManagerDatabaseManagerComponentCatalogWorkflowEditor
- Integrations and tools:
GitHubActionsFetcherIRCWebchatvariantsDBALDemoUnifiedLogin
- Atoms, molecules, and organisms live in nested folders. We will tag each file in Phase 1.
Hooks & libraries
- Hooks:
useAuthuseAutoRefreshuseKVuseLevelRoutinguseDBALuseFileTreeuseCodeEditoruseResolvedUseruseGitHubFetcheruse-mobilehooks/authstorehooks/use-dbalhelpers (blob storage, kv store, cached data)
- Libraries cover:
- auth and security (
lib/auth,lib/security) - database and DBAL helpers
- package, seed, and metadata tooling (
lib/packages,lib/seed) - Lua engine and functions
- workflow and rendering helpers
- API helpers and schema utilities
- GitHub and general utilities (
lib/utils,lib/prisma)
- auth and security (
- Phase 1 will tag each file as “adapter” or “port”.
Supporting assets
frontends/nextjs/src/seed-datahas JSON seeds for packages and baseline data. These can move to metadata.- Tests live in
app/api/*/*.test.tsx,lib/**/*test.ts,components/get-component-icon.test.tsx, andhooks/*.test.ts. We will decide which tests follow Lua stubbed logic or stay with TypeScript.
Quick File References
frontends/nextjs/src/app: each route, page, provider, and API handler needs metadata or a Lua adapter.frontends/nextjs/src/components: move builders, editors, and managers to metadata-driven definitions.frontends/nextjs/src/hooks: turn each hook into a Lua micro-function.frontends/nextjs/src/lib: catalogue auth, security, db/DBAL, packages, Lua, workflow, API, schema, GitHub, and utility modules.- Supporting assets: seed JSONs, README docs, and tests must align with the Lua transition.
Next Steps
- Create the companion metadata folder (e.g.,
lua/orpackages/static_content) with placeholder single-function files that mirror the above references. - Run the audit across the identified folders. Mark each file as “port to Lua”, “adapter only”, or “leave in TypeScript” before editing.
Phase Deliverables
- Phase 0: Audit spreadsheet/list with tags for each entry. Lua boundary doc with endpoints and metadata goals.
- Phase 1: Mapping sheet (spreadsheet or Markdown) documenting TypeScript helper → Lua micro-function mapping and file categorization.
- Phase 2: Adapter interface stubs plus placeholder Lua files under the new metadata folder.
- Phase 3: One working Lua helper wired through an adapter, with updated unit test coverage or manual verification notes.
- Phase 4: Documentation updates, test run results, and a summary of which files moved versus stayed.
Support Notes
-
Risks: The Next.js frontend is large; do not remove TypeScript pages until their Lua replacements exist. Keep unit/e2e tests running in TypeScript during transition.
-
Owner: Track who updates each phase and keep a note in this doc or comments for accountability.
-
Validation tips: After a Lua helper is added, run
npm run lintandnpm run test:unitfromfrontends/nextjs/. Keep logs of failing tests if you defer them. -
Documentation: Update READMEs in
components/,hooks/, andlib/with pointers to the new Lua package once core content moves. -
Checkpoint: Before Phase 3, ensure adapter interfaces exist for data access and that seed data has been migrated to the metadata folder.
-
Toolbelt
npm run lint(infrontends/nextjs/)npm run test:unitnpm run test:e2e(only after Lua helpers are wired)npm run buildto verify core app still compiles
-
Folder sketch
lua/metadata/– metadata + seed descriptors per packagelua/functions/– single-function files (one helper per file)lua/adapters/– TypeScript adapters that relay calls into Lua micro-functionspackages/static_content/– optional storage for JSON seeds already living in the frontend
Tracking & Templates
- Audit table:
- File path
- Current role (page, API, hook, lib)
- Port target (Lua, adapter, stay TS)
- Notes/risks
- Owner/ETA
- Mapping sheet:
- Helper name
- Inputs/outputs
- Proposed Lua file path
- Adapter needed (yes/no)
- Test expectations
- Documentation reminders: keep the doc updated with any new folder names, helper descriptions, or decisions so new contributors can follow the trail.