Skip to content

feat(schema): auto-discover app loaders via filesystem walk#273

Merged
guitavano merged 1 commit into
mainfrom
refactor/auto-discover-app-loaders
Jun 23, 2026
Merged

feat(schema): auto-discover app loaders via filesystem walk#273
guitavano merged 1 commit into
mainfrom
refactor/auto-discover-app-loaders

Conversation

@guitavano

@guitavano guitavano commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaces the hardcoded APP_LOADERS array in generate-schema.ts with a filesystem walk of node_modules/@decocms/apps/*/loaders/**/*.ts
  • CMS keys are derived from file paths (e.g. vtex/loaders/intelligentSearch/productList.ts), matching the Deno framework convention
  • Skips index/barrel files, test files, and files without a default export
  • Uses realpathSync to de-duplicate re-export alias files (same Props/output type)

Dependencies

Test plan

  • npx tsx scripts/generate-schema.ts --site casaevideo generates correct schema
  • All vtex IS, legacy, top-level alias, blog, shopify, and website loaders appear in output
  • ProductShelf.products anyOf includes vtex loaders
  • Commerce extension wrappers include app loaders in data field

🤖 Generated with Claude Code


Summary by cubic

Auto-discovers app loaders by walking node_modules/@decocms/apps/*/loaders/**/*.ts(x) and replaces the hardcoded APP_LOADERS. Scans only apps installed via src/apps bridges to keep the schema in sync.

  • New Features

    • Detects installed namespaces from src/apps files that re-export @decocms/apps/{namespace}/mod; scans only those apps.
    • Derives CMS keys from file paths; sets loader namespace and adds __resolveType to each schema; sorts results for stable output.
    • Skips index/tests/internal _ files and modules without a default export; de-dupes re-exports via realpathSync; builds JSON Schemas from Props or the default export and registers output types.
  • Dependencies

    • Requires decocms/apps-start#82.

Written for commit 98356ef. Summary will update on new commits.

Review in cubic

@guitavano guitavano requested a review from a team June 23, 2026 04:19
@guitavano guitavano force-pushed the refactor/auto-discover-app-loaders branch 2 times, most recently from fb601b0 to 24459d7 Compare June 23, 2026 13:20
Replace the hardcoded APP_LOADERS array with a walk of
node_modules/@decocms/apps/*/loaders/**/*.ts. CMS keys are derived
from file paths, matching the Deno framework's convention.

Only scans apps installed in src/apps/ — detects namespaces from
bridge files that import from @decocms/apps/{namespace}/mod.

Skips index files, tests, and files without a default export.
Uses realpathSync to de-duplicate re-export alias files.

Depends on: decocms/apps-start#82

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@guitavano guitavano force-pushed the refactor/auto-discover-app-loaders branch from 24459d7 to 98356ef Compare June 23, 2026 13:52
@guitavano guitavano merged commit b9e7616 into main Jun 23, 2026
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 6.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants