turbo
e6bfdeb2 - fix: Stop `add-package-names` codemod from silently renaming existing packages (#12332)

Commit
50 days ago
fix: Stop `add-package-names` codemod from silently renaming existing packages (#12332) ## Summary Fixes #8312. The `add-package-names` codemod was silently renaming workspace packages when it detected duplicate `name` fields. When a workspace package shared its name with the root `package.json` (common in monorepos where the root is named after the primary library), the codemod renamed the workspace package to `{dirName}-{originalName}`, breaking builds. The codemod's job is to **add** names to packages that lack them — not to rename existing ones. It can't know which duplicate is the "right" one, so it shouldn't guess. ## What changed - **Duplicate names now abort the transform** with an actionable error listing exactly which packages share which names, so the user can fix them manually. - **Packages that already have names are never modified.** - Missing names are still generated from the directory name, same as before. ## How to test Run the new and updated tests: ```sh npx jest --config jest.config.ts --testPathPatterns "add-package-names.test" --no-coverage ```
Author
Parents
Loading