You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
Mechanical: for each app, rewrite a relative specifier to #/<path-from-app-root> based on the file's location. Keep the explicit extension (.ts/.server.ts).
LANDMINE, do not convert an import that ESCAPES the app root. #/ maps to the app root only, so a ../../../ that reaches a SIBLING package in the monorepo (e.g. an app importing from another workspace package by relative path) must stay relative or use the package specifier, NOT #/. Only convert relatives that resolve WITHIN the app's own tree.
This is a CONVENTION (deep relatives are ugly, not wrong), so it is NOT enforced by a webjs check rule. Optionally add a one-line note to each app's CONVENTIONS.md / the scaffold CONVENTIONS.md recommending #/ for app-internal imports.
Problem
Deep relative imports (
../../../lib/...,../../components/...) are ugly and brittle across the in-repo apps and examples. Once #555 ships the#/*path alias (nativepackage.json "imports"→"#/*": "./*"), convert these to the clean root-relative form, e.g.../../../lib/db/connection.server.tsbecomes#/lib/db/connection.server.ts.Depends on #555. The
#/alias must resolve (theresolveImport+ importmap changes in #555) before any import can be converted to it.Scope
IN scope (a mechanical codemod, ideally a pure-rename PR):
examples/blog,website,docs,packages/ui/packages/website. Convert app-internal deep relatives to#/....examples/*generally.packages/cli/templates/AND the filescreate.js/saas-template.jsemit: 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:
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)
#/<path-from-app-root>based on the file's location. Keep the explicit extension (.ts/.server.ts).#/maps to the app root only, so a../../../that reaches a SIBLING package in the monorepo (e.g. an app importing from another workspace package by relative path) must stay relative or use the package specifier, NOT#/. Only convert relatives that resolve WITHIN the app's own tree..server.tsboundary must still fire after conversion: a#/lib/x.server.tsimport from a shipping browser module must still tripno-server-import-in-browser-module(Implement # path-alias imports (package.json imports + resolveImport alias expansion) #555 guarantees this viaresolveImportalias expansion, this PR relies on it). Add/keep a spot-check.webjs checkrule. Optionally add a one-line note to each app's CONVENTIONS.md / the scaffold CONVENTIONS.md recommending#/for app-internal imports.db/imports get converted here too (#/db/connection.server.tsstyle); if not, Switch default ORM from Prisma to Drizzle across scaffolds, webjs db, docs, blog #551 ships relative and this sweep catches it later.Acceptance criteria
#/...for app-internal imports (no remaining intra-app../../...).#/.webjs checkpasses for each..server.tsimported 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).#/for app-internal imports.Depends on #555 (the
#/*alias mechanism).