ts-patch icon indicating copy to clipboard operation
ts-patch copied to clipboard

Not working on `yarn@v3` (berry)

Open samchon opened this issue 1 year ago • 3 comments

image

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 avatar Aug 07 '23 06:08 samchon

@samchon try the pnpm or node-modules linker. This works for me with yarn v3.

AlCalzone avatar Aug 09 '23 14:08 AlCalzone

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.

nonara avatar Aug 11 '23 02:08 nonara

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:

  1. When ts-patch install is run, detect if Yarn Berry is in use.
  2. If it is in use, then utilize the same API calls that yarn patch uses to apply a patch to the typescript modules.
  3. Once patch is applied, perform the equivalent of a yarn patch-commit to update the package.json to resolve typescript to the patched version of typescript.

The yarn patch and yarn patch-commit commands are performed by the plugin-patch plugin.

tsengia avatar Sep 17 '23 22:09 tsengia