Sometimes you might want to force users to use a certain package manager like Yarn or NPM to prevent conflicting lockfiles from being created. A nice way of doing this is to use the only-allow package. $endexcerpt
Sometimes you might want to force users to use a certain package manager like Yarn or NPM to prevent conflicting lockfiles from being created. A nice way of doing this is to use the only-allow package.
Installation
Add a preinstall
script to your project's package.json
.
If you want to force npm, add:
{
"scripts": {
"preinstall": "npx only-allow npm"
}
}
If you want to force pnpm, add:
{
"scripts": {
"preinstall": "npx only-allow pnpm"
}
}
If you want to force yarn, add:
{
"scripts": {
"preinstall": "npx only-allow yarn"
}
}