c-frame / aframe-physics-system

community-maintained fork of n5ro's aframe-physics-system
https://c-frame.github.io/aframe-physics-system/
MIT License
43 stars 11 forks source link

Failing at patch-package when using pnpm #33

Open aaweb opened 1 year ago

aaweb commented 1 year ago

Hey there

Great project! I'm trying to get the latest version running on our project building on GitHub Actions CI which uses pnpm.

{
"time":1680695309474,
"hostname":"fv-az357-761",
"pid":1765,
"level":"error",
"name":"pnpm",
"code":"ELIFECYCLE",
"errno":1,
"pkgid":"@c-frame/aframe-physics-system@4.2.2",
"stage":"postinstall",
"script":"patch-package",
"pkgname":"@c-frame/aframe-physics-system",
"name":"pnpm",
"err":{
  "name":"pnpm",
  "message":"@c-frame/aframe-physics-system@4.2.2 postinstall: `patch-package`\n
      Exit status 1",
   "code":"ELIFECYCLE",
   "stack":"pnpm: @c-frame/aframe-physics-system@4.2.2 postinstall: `patch-package`\n
     Exit status 1\n
    at EventEmitter.<anonymous> (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@7.31.0/node_modules/pnpm/dist/pnpm.cjs:99647:17)\n
     at EventEmitter.emit (node:events:513:28)\n
     at ChildProcess.<anonymous> (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@7.31.0/node_modules/pnpm/dist/pnpm.cjs:83505:18)\n    
     at ChildProcess.emit (node:events:513:28)\n    
     at maybeClose (node:internal/child_process:1091:16)\n    
     at Socket.<anonymous> (node:internal/child_process:449:11)\n    
     at Socket.emit (node:events:513:28)\n    
     at Pipe.<anonymous> (node:net:322:12)"
     }}

Reading the docs at https://www.npmjs.com/package/patch-package it seems like the patch-package would not be needed if using pnpm. Is this something this package can support or do you have any advice on how to best get it running?

Thank you very much.

vincentfretin commented 1 year ago

Hi, I'm not familiar with pnpm. You can try to fork the package and remove https://github.com/c-frame/aframe-physics-system/blob/04d7af4a2a8e900c0d0abbc42ce2ddc0119de2ff/package.json#L18 you can also remove the dependency https://github.com/c-frame/aframe-physics-system/blob/04d7af4a2a8e900c0d0abbc42ce2ddc0119de2ff/package.json#L49 but not mandatory.

Then apply the two patches from https://github.com/c-frame/aframe-physics-system/tree/master/patches From https://pnpm.io/cli/patch it seems you can the patchedDependencies field.

Then use your fork in your package.json with

"@c-frame/aframe-physics-system": "username/aframe-physics-system#commithash"

Let us know what work.

uvesten commented 1 year ago

Hi, it was actually easier than this for us. Since we don't use the ammo package, we simply used pnpm patch to patch out the patch-package dependency and postinstall step from your package, and that seems to work fine!

diarmidmackenzie commented 1 year ago

Now we are at three-to-ammo 1.0.1, I believe we can move to ammo-debug-drawer 1.0.1 as well, and we won't need any patches any more.