I am looking for a way to support optional dependencies installation. I manage a npm package and want to provide users with the option to include supported "plugins" but not include them in the main package installation code.
Imagine my package name is my-package, when others install it they run pnpm install my-package. I want to provide an option for them to run pnpm install my-package --plugin my-plugin and then based on that provided plugin install my-plugin dependency.
Obviously I will handle the check of whether the dependency has been installed or not in my code base.
I was looking at
optionalDependenciesbut this is not the functionality I am looking for.preinstallscript but since I am usingpnpmthis script runs after the dependencies have been installed. Also it does not seem to run when installing a package but only when installing the dependencies in a package.pnpm hooks.readPackagesame aspreinstall