Skip to content

fix(ts-parser): normalize monorepo package paths - #203

Open
dajiaohuang wants to merge 1 commit into
cloudwego:mainfrom
dajiaohuang:fix/typescript-monorepo-paths
Open

fix(ts-parser): normalize monorepo package paths#203
dajiaohuang wants to merge 1 commit into
cloudwego:mainfrom
dajiaohuang:fix/typescript-monorepo-paths

Conversation

@dajiaohuang

Copy link
Copy Markdown

What type of PR is this?

fix

Check the PR title.

  • This PR title matches the format: <type>(optional scope): <description>
  • The description is user-oriented and clear enough to understand.
  • No user-documentation update is required; this makes the implementation match the documented cross-platform path format.

(Optional) Translate the PR title into Chinese.

fix(ts-parser): 统一 monorepo 包路径分隔符

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:

MonorepoUtils previously copied path.relative() directly into MonorepoPackage.path. On Windows that produces backslashes, so the existing Eden and pnpm monorepo tests received packages\core instead of the portable packages/core value used by the TypeScript UniAST mapping.

This change normalizes only the relative package identity to forward slashes, matching the parser's existing path utilities. absolutePath remains unchanged for host-native filesystem access, so filesystem behavior and public interfaces are preserved.

The existing focused tests already cover the expected portable value and reproduced the defect on Windows.

Validation on Windows:

  • npx jest src/utils/test/monorepo.test.ts --runInBand --no-cache — 8/8 passed after the fix (2 failures before it)
  • npm run build — passed
  • npm run typecheck — passed
  • npx eslint src/utils/monorepo.ts — passed
  • npm test -- --runInBand — 9/10 suites and 174/175 tests passed; the sole remaining failure is the pre-existing integration expectation that counts two packages although merged PR fix: no record packagejson in project root path #160 intentionally added the root package, and is unrelated to path separators

Tradeoff: serialized package identities are now platform-independent while absolute paths intentionally retain native separators.

zh(optional):

将 monorepo 的相对包标识统一为正斜杠,同时保留用于文件系统访问的原生绝对路径。

(Optional) Which issue(s) this PR fixes:

Fixes #202

(optional) The PR that updates user documentation:

N/A

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript monorepo package paths use backslashes on Windows

1 participant