ban-yarn
Request that users use npm
instead of yarn
.
If run from yarn
instead of npm
, the process will exit with error code 1
and print an error message.
Install
npm install --save-dev ban-yarn
Use
CLI
For example, in your package.json
:
{
"scripts": {
"preinstall": "ban-yarn"
}
}
Or if you have npx
:
{
"scripts": {
"preinstall": "npx ban-yarn"
}
}
You may provide a custom message via the -m
flag:
{
"scripts": {
"preinstall": "npx ban-yarn -m 'Please use npm!'"
}
}
Or, you may also provide a custom message read from a file via the -f
flag:
{
"scripts": {
"preinstall": "npx ban-yarn -f path/to/customMessage.txt"
}
}
You may disable ban-yarn by setting the DISABLE_USE_NPM
environment variable to true
:
{
"scripts": {
"preinstall": "DISABLE_USE_NPM=true npx ban-yarn"
}
}
API
var useNpm = require('ban-yarn')
useNpm()
useNpm('You should switch back to npm. Version >=5 is really great.');
Acknowledgements
Forked from use-yarn.
MIT © Shannon Moeller