mirror of
https://github.com/longbridge/developers.git
synced 2026-09-19 03:34:09 +08:00
0e2dcb4c81
Sprint 2 §S5: move src/lib/{slug,region,navigation,i18n}.ts + tests
into a new bun workspace `packages/utils` published as
`@longbridge/openapi-utils`. Consumers import from the package name
instead of relative paths or `@lib/*` aliases.
Files moved (git mv preserves history):
- src/lib/slug{,.test}.ts → packages/utils/src/
- src/lib/region{,.test}.ts → packages/utils/src/
- src/lib/navigation{,.test}.ts → packages/utils/src/
- src/lib/i18n.ts → packages/utils/src/
New package skeleton:
- packages/utils/package.json (private workspace, "@longbridge/openapi-utils")
- packages/utils/tsconfig.json (extends root, includes .astro types
so `astro:content` resolves in isolated TS server)
- packages/utils/src/index.ts (barrel re-exports)
Consumer updates (22 files): shell components, layouts, [...slug]
routes on all 3 locales, llms.txt endpoints, md endpoint — all import
from `@longbridge/openapi-utils` now.
tsconfig.json — removed `@lib/*` alias (dead after the move); other
aliases (`@/*`, `@components/*`, `@styles/*`, `@data/*`) intact.
Two slug.test.ts expectations updated to reflect the T3 semantics
locked in during Sprint 1.5:
- absolute slug in `en/docs/**` → `/docs/{slug}` (was `/{slug}`)
- absolute slug in `zh-CN/docs/**` → `/zh-CN/docs/{slug}` (was `/zh-CN/{slug}`)
- new coverage: absolute slug for `en/{marketing}.mdx` still site-absolute
The test file was carrying pre-T3 expectations; §S5 is when
they had to move regardless, so the correction lands here.
Verified:
- astro check: 0 errors (81 files)
- vitest: 23/23 pass
- 8 canonical URLs: all 200
- zero residual `../lib/*` / `@lib/*` import paths anywhere in
src/ or packages/
Known deferred:
- `packages/utils/src/i18n.ts` still reads locale data via
`../../../src/data/locale.*` (cross-boundary). Acceptable for §S5
scope; §S10 may relocate locale data into the utils package.
Closes Sprint 2 §S5.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
17 lines
383 B
JSON
17 lines
383 B
JSON
{
|
|
"extends": "astro/tsconfigs/strict",
|
|
"include": [".astro/types.d.ts", "**/*"],
|
|
"exclude": ["dist", ".legacy"],
|
|
"compilerOptions": {
|
|
"jsx": "react-jsx",
|
|
"jsxImportSource": "react",
|
|
"baseUrl": ".",
|
|
"paths": {
|
|
"@/*": ["src/*"],
|
|
"@components/*": ["src/components/*"],
|
|
"@styles/*": ["src/styles/*"],
|
|
"@data/*": ["src/data/*"]
|
|
}
|
|
}
|
|
}
|