Skip to content

refactor(vtex): move inline-loaders to CMS key paths#82

Merged
guitavano merged 1 commit into
mainfrom
refactor/move-inline-loaders-to-cms-key-paths
Jun 23, 2026
Merged

refactor(vtex): move inline-loaders to CMS key paths#82
guitavano merged 1 commit into
mainfrom
refactor/move-inline-loaders-to-cms-key-paths

Conversation

@guitavano

@guitavano guitavano commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Moves vtex/inline-loaders/ into vtex/loaders/ subdirectories matching CMS keys (intelligentSearch/, legacy/, workflow/)
  • Enables filesystem-based auto-discovery in the schema generator (companion PR in deco-start) instead of a hardcoded loader mapping
  • Creates re-export files for alias CMS keys (e.g. legacy/productList.tsintelligentSearch/productList)
  • Keeps backward-compat inline-loaders/* entries in package.json exports pointing to new paths

Test plan

  • npx tsc --noEmit passes (no new errors)
  • vitest tests pass (moved test file)
  • Sites using @decocms/apps/vtex/inline-loaders/* imports still resolve via package.json exports
  • Schema generation discovers all vtex loaders via filesystem walk (tested with casaevideo-tanstack)

🤖 Generated with Claude Code


Summary by cubic

Refactored VTEX loaders to match CMS key paths and enable filesystem auto‑discovery in the schema generator. Backward compatible via package.json exports.

  • Refactors

    • Moved vtex/inline-loaders/* to vtex/loaders/intelligentSearch/*, legacy/*, and workflow/*, and added vtex/loaders/Product{DetailsPage,ListingPage,List}.ts re-exports for discovery.
    • Updated package.json exports to redirect old inline-loaders/* to new paths, including productListproductListFull, productListShelfintelligentSearch/productList, relatedProductslegacy/relatedProductsLoader, workflowProductsworkflow/products, and minicart.
    • Switched internal imports (e.g., vtex/commerceLoaders.ts) and renamed tests to the new locations.
    • Updated knip.json globs for the new directories.
  • Migration

    • No action needed. Existing @decocms/apps/vtex/inline-loaders/* imports keep working via exports. Prefer @decocms/apps/vtex/loaders/... for new code.

Written for commit d89dae1. Summary will update on new commits.

Review in cubic

@guitavano guitavano requested a review from a team June 23, 2026 04:18
guitavano added a commit to decocms/blocks that referenced this pull request Jun 23, 2026
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 added a commit to decocms/blocks that referenced this pull request Jun 23, 2026
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 added a commit to decocms/blocks that referenced this pull request Jun 23, 2026
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>
Move vtex/inline-loaders/ into vtex/loaders/ subdirectories that match
CMS keys (e.g. intelligentSearch/productList.ts, legacy/*, workflow/*).
This enables filesystem-based auto-discovery in the schema generator
instead of a hardcoded mapping.

Re-export files preserve backward compat for alias CMS keys.
package.json exports keep old inline-loaders paths pointing to new locations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@guitavano guitavano force-pushed the refactor/move-inline-loaders-to-cms-key-paths branch from 5006cad to d89dae1 Compare June 23, 2026 13:57
@guitavano guitavano merged commit b5a013a into main Jun 23, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 5.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

guitavano added a commit to decocms/blocks that referenced this pull request Jun 23, 2026
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>
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