-
Notifications
You must be signed in to change notification settings - Fork 6
feat: pnpm codemod for patch convert #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@btea Thank you for the contribution, but I noticed you have used the legacy/deprecated Codemod toolkit/workflow engine. May I ask how that happened? (I want to make sure we don't have deprecated docs or links that encourage people to use that.) We have a much better toolkit now, and you can find the docs here: https://docs.codemod.com/cli/cli-reference Given you have fresh context for this codemod, would you be able to recreate it in the new system? Sorry about that. If you need help, feel free to ping me in the Codemod community to quickly answer your questions if you get blocked on something. |
alexbit-codemod
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Codemod's latest toolkit.
|
@alexbit-codemod Thank you for your review. I'm not familiar with Codemod, I simply added functionality based on existing repository code. I will modify it according to the documentation you provided as soon as possible. Thank you for your guidance. |
|
thank you so much for your flexibility and understanding. so looking forward to your contribution. and again, if you have any questions, feel free to ping me on slack: https://go.codemod.com/community |
Co-authored-by: alexbit-codemod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new codemod to migrate patch files from patch-package format to pnpm's native patch format. The codemod converts patch filenames, removes node_modules/ prefixes from patch content, and updates configuration files (package.json and pnpm-workspace.yaml) accordingly.
Key Changes
- New
patchworkspace package with complete codemod implementation including transformers, scanners, and utilities - Workspace configuration updates to include the new patch package
- Automated migration workflow that handles
.patchfiles,package.json, andpnpm-workspace.yaml
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Added patch to workspace packages |
| pnpm-lock.yaml | Added dependencies for the patch codemod package |
| patch/workflow.yaml | Defines the transformation workflow for converting patches |
| patch/tsconfig.json | TypeScript configuration for the codemod |
| patch/package.json | Package definition with scripts and dependencies |
| patch/codemod.yaml | Codemod metadata and configuration |
| patch/README.md | Documentation for using the codemod |
| patch/LICENSE | MIT license for the codemod |
| patch/.gitignore | Ignore patterns for the package |
| patch/src/codemod.ts | Main entry point that routes files to appropriate transformers |
| patch/src/types.ts | TypeScript type definitions for the codemod |
| patch/src/constants.ts | Constants for file patterns and separators |
| patch/src/utils/path.ts | Path normalization and workspace detection utilities |
| patch/src/utils/patch-filename.ts | Filename conversion utilities for patch files |
| patch/src/utils/errors.ts | Error detection helpers |
| patch/src/transforms/patch-file.ts | Transforms patch file content and filenames |
| patch/src/transforms/package-json.ts | Updates package.json with patched dependencies |
| patch/src/transforms/workspace-yaml.ts | Updates pnpm-workspace.yaml configuration |
| patch/src/scanners/patch-scanner.ts | Scans and identifies patch files in the workspace |
| package.json | Added convenience script to run the patch codemod |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 19 out of 20 changed files in this pull request and generated 14 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
No description provided.