please-use-npm
v2.0.0
Published
Request that users use npm instead of yarn.
Downloads
552
Readme
please-use-npm
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 please-use-npm
Use
CLI
For example, in your package.json
:
{
"scripts": {
"preinstall": "npm i -D --ignore-scripts please-use-npm && use-npm"
}
}
Or if you have npx
:
{
"scripts": {
"preinstall": "npx please-use-npm"
}
}
You may provide a custom message as an argument:
{
"scripts": {
"preinstall": "npx please-use-npm 'Please use npm!'"
}
}
You may disable please-use-npm by setting the DISABLE_USE_NPM
environment variable to true
:
{
"scripts": {
"preinstall": "DISABLE_USE_NPM=true npx please-use-npm"
}
}
API
var useNpm = require('please-use-npm');
useNpm();
// or a custom message
useNpm('You should switch back to npm. Version >=5 is really great.');
Acknowledgements
Forked from use-yarn.
MIT