3 ms·
Leaving aside the comedic factor, albeit problem-solving, if you want a sane alternative check out pnpm. It will not only make the installation of deps faster b
by andreineculau 9y ago
Leaving aside the comedic factor, albeit problem-solving, if you want a sane alternative check out pnpm. It will not only make the installation of deps faster but it will also allow you to override a dependency on any n-level e.g. a dependency of a dependency.
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 https://github.com/pnpm/pnpm/blob/master/README.md#hooks
- zkochan 9y agoActually, 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-systems-b8125d8b3dc7 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
- exogen 9y agoThat’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-resolutions/ 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.
- andreineculau 9y agoCorrect. 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.