mirror of
https://github.com/ProtonMail/WebClients.git
synced 2026-01-16 23:12:49 +00:00
| .. | ||
| src | ||
| .gitignore | ||
| eslint.config.mjs | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsconfig.transform.json | ||
Codeshift
This package uses jscodeshift to transform code. It can help with large refactors.
Example
Check for example move-coupons. This file changes the COUPON_CODE to @proton/payments package.
How to create a new codemod
-
Create a new folder in the src directory. Put transform.ts and files.txt in it. In my case, I compiled the list of files manually by running
yarn check-typesin affected pacakges and then pasting to files.txt and editing the result. -
Add new script to package.json, see
move:couponsan example. Seeyarn jscodeshift --helpfor available options. In particular, you might find--dryand--printhelpful during development of the command. -
Run the command, e.g.
yarn move:coupons. See if it's applied correctly, repeat until done.