Skip to content

Convert deep relative imports to #/ aliases across the in-repo apps + examples #556

@vivek7405

Description

@vivek7405

Problem

Deep relative imports (../../../lib/..., ../../components/...) are ugly and brittle across the in-repo apps and examples. Once #555 ships the #/* path alias (native package.json "imports""#/*": "./*"), convert these to the clean root-relative form, e.g. ../../../lib/db/connection.server.ts becomes #/lib/db/connection.server.ts.

Depends on #555. The #/ alias must resolve (the resolveImport + importmap changes in #555) before any import can be converted to it.

Scope

IN scope (a mechanical codemod, ideally a pure-rename PR):

  • The in-repo CONTENT/EXAMPLE apps that consume webjs: examples/blog, website, docs, packages/ui/packages/website. Convert app-internal deep relatives to #/....
  • examples/* generally.
  • Scaffold template files under packages/cli/templates/ AND the files create.js / saas-template.js emit: convert their deep-relative imports to #/... so a freshly scaffolded app ships with #/ imports and demonstrates the feature. (The scaffold's "imports" BLOCK itself is generated by Implement # path-alias imports (package.json imports + resolveImport alias expansion) #555; this converts the template FILE contents.)

OUT of scope:

  • Framework packages/*: published libraries with their own module resolution; #/* → app-root is an APP convention, not a library one. Do NOT touch packages/ source.

Implementation notes (for the implementing agent)

Acceptance criteria

  • The 4 in-repo apps + examples use #/... for app-internal imports (no remaining intra-app ../../...).
  • No import that escapes the app root was wrongly converted to #/.
  • All 4 apps still boot and serve on Node AND Bun; webjs check passes for each.
  • A .server.ts imported via #/... into a shipping module still trips the server-only boundary check (spot-check, relies on Implement # path-alias imports (package.json imports + resolveImport alias expansion) #555).
  • Docs/CONVENTIONS note (optional) recommending #/ for app-internal imports.

Depends on #555 (the #/* alias mechanism).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions