1k-patch-package-workflow
Installation
SKILL.md
patch-package workflow
Patches live in patches/<pkg>+<version>.patch and auto-apply on install. Never hand-edit a .patch — edit the node_modules/ source, then generate.
Generate
- Edit
node_modules/<pkg>/.... Comment lines out (don't delete) with a// OneKey patch: <why>note above. - Generate — must drop
resolutionsfirst or it fails withCouldn't find any versions for ...:
cp package.json /tmp/pkg.bak
node -e "const fs=require('fs');const p=require('./package.json');delete p.resolutions;fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n')"
npx patch-package <pkg> # npx, not yarn
cp /tmp/pkg.bak package.json # restore byte-exact
Fallback (generate still fails: offline / private dep)
Diff the edited file against the pristine tarball in the Yarn cache: