ts-patch
ts-patch copied to clipboard
Not working on `yarn@v3` (berry)
https://github.com/samchon/ts-patch-yarn-v3/actions/runs/5781547560/job/15666822757#step:5:31
Tried to use ts-patch on yarn berry, but readonly problem be happened.
It does not occur runtime error, but patching be failed, so I think it is a bug.
@samchon try the pnpm or node-modules linker. This works for me with yarn v3.
Hi @samchon! Let me know if AlCalzone's solution works for you, please.
I still haven't worked much with yarn3. We have tests in place but not turned on yet. I know others have said it works with the node modules linker.
If so, we should enable those tests and possibly add something to the readme.
Don't know if this helps at all, but Yarn v3 has a yarn patch command that allows users to apply patches to installed packages locally: https://yarnpkg.com/cli/patch
This Yarn patch command utilizes the @yarnpkg/fslib library to access files stored inside of the installed .zip folders: https://yarnpkg.com/advanced/pnpapi#accessing-the-files
I'm not very familiar with this code base, but here's a potential idea:
- When
ts-patch installis run, detect if Yarn Berry is in use. - If it is in use, then utilize the same API calls that
yarn patchuses to apply a patch to the typescript modules. - Once patch is applied, perform the equivalent of a
yarn patch-committo update thepackage.jsonto resolve typescript to the patched version of typescript.
The yarn patch and yarn patch-commit commands are performed by the plugin-patch plugin.