monaco-languageclient: Pnpm and other hard cache based managers cannot work with patch

Hi! As you may remember we had a discuss about pnpm and patching here.

I know the reason of this error:

. postinstall$ monaco-treemending
. postinstall: Error: Unable to apply patch on 

Inside of pnpm we have hard package cache and three-awesome collecting all packages in to the one flat store without dependencies (symlinks used inside of internal packages deps folder) for example:

monaco-language-client depends from monaco-editor

dependencies": {
    "monaco-editor": "~0.37.1",
...  },
  "peerDependencies": {
    "vscode": "npm:@codingame/monaco-vscode-api@~1.78.6",
    ...

pnpm will extract this packages and create single for monaco-language-client and root package.json of main project. That mean if monaco-langauge-client contains postinstall script, the patch will be applied to symlinked package. Then second call postinstall in project root inside package.json gonna be fall.

Possible solutions:

Remove postinstall from monaco-languageclient and move out from package main packgage.json to examples or something other dir

Also we need to fix treemending script patch already installed detection and show the info, “Already patched”, in case when patch really installed

Patch listing

diff --git a/package.json b/package.json
index 88c2d0ac8cac849a09c7bb534e52669323e1d7f1..dc881bc2bc5034b532429947780accd498bb7002 100644
--- a/package.json
+++ b/package.json
@@ -66,7 +66,6 @@
     }
   },
   "scripts": {
-    "postinstall": "monaco-treemending",
     "clean": "npx shx rm -fr lib *.tsbuildinfo",
     "compile": "tsc --build tsconfig.src.json",
     "build:msg": "echo Building monaco-languageclient:",

UPD: Patch didnt works for me :C

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20

Most upvoted comments

Please no apologies, this is an open source project.

If none of the options I suggested are suitable, I think that this is normal, because I am not familiar with many of the nuances in your project.

Thanks, I’ll be waiting for the merge. Perhaps I will contribute to this project later.

I create my own patch by using pnpm patch cli, that works pretty. pnpm patch ist like patch-package, but out of the box. I dont know why u guys didn’t use that patch software, but i see you calculates hashes manually, why? Patch-packgage already works with all corner cases inside of patch applying mechanism