Skip to content

Yarn 4 replaces patched typescript on every install #166

@AlCalzone

Description

@AlCalzone

I recently noticed that ts-patch was uninstalled often, after upgrading to Yarn 4. I'm often switching branches with different dependencies and therefore invoking yarn install often. It seems that every time I do this, the modifications to TypeScript get undone:

dominic@X1:~/Repositories/node-zwave-js$ yarn
➤ YN0000: · Yarn 4.3.1
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Post-resolution validation
➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 2s 537ms
➤ YN0000: · Done with warnings in 2s 874ms


dominic@X1:~/Repositories/node-zwave-js$ yarn ts-patch check
Checking TypeScript v5.5.3 installation in /home/dominic/Repositories/node-zwave-js/node_modules/typescript

[-] tsc.js is not patched.
[-] tsserver.js is not patched.
[-] tsserverlibrary.js is not patched.
[-] typescript.js is not patched.


dominic@X1:~/Repositories/node-zwave-js$ yarn ts-patch install
[+] ts-patch installed!


dominic@X1:~/Repositories/node-zwave-js$ yarn
➤ YN0000: · Yarn 4.3.1
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Post-resolution validation
➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 2s 509ms
➤ YN0000: · Done with warnings in 2s 857ms


dominic@X1:~/Repositories/node-zwave-js$ yarn ts-patch check
Checking TypeScript v5.5.3 installation in /home/dominic/Repositories/node-zwave-js/node_modules/typescript

[-] tsc.js is not patched.
[-] tsserver.js is not patched.
[-] tsserverlibrary.js is not patched.
[-] typescript.js is not patched.

I'm using the pnpm linker setting in Yarn, but I don't think this makes a difference. My postinstall script contains ts-patch install -s, but it seems this isn't executed every time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions