Re:Show HN: Quickfix, the best stupid idea for fixing proble...
by exogen on Friday November 17, 2017 @10:57AM
(#15723016)
That’s an interesting approach to it (modifying how the package.json is processed).
If anyone is wondering if their current package manager supports this, it does if you are using Yarn. Yarn has a `resolutions` field to override subdeps (either globally or in a targeted way): https://yarnpkg.com/lang/en/docs/selective-version-resolutio...
It’s not as low-level and flexible as pnpm’s approach, but is perfect for the use case described here.
Re:Show HN: Quickfix, the best stupid idea for fixing proble...
by andreineculau on Friday November 17, 2017 @02:21PM
(#15725143)
Correct. The pnpm approach is more versatile. You can do anything to a dependency's package.json . I have recently used it to debug and then monkey patch "scripts" (property) invocations without even forking the dependency.
Re:Show HN: Quickfix, the best stupid idea for fixing proble...
by zkochan on Friday November 17, 2017 @02:20PM
(#15725138)
Actually, I have written an article about this when the feature was added to pnpm: Why package managers need hook systems (https://medium.com/pnpm/why-package-managers-need-hook-syste...).
Also, soon pnpm will support aliases and that will make the hook system even more powerful
A dependency published a patch version with a breaking change and the author is on vacation? No problem, you can lock it within your project to the previous version.
Did you fork a dependency and you want to use your version? You can do that too. In all of your dependency chain. You can even change the version specifier to a git url so no need to publish your fork to the npm registry.
I whole heatedly recommend anyone to have a look at pnpm. As a unix dev, there's so much in there that is well thought and kept simple this fast.
https://github.com/pnpm/pnpm/blob/master/README.md#hooks