Skip to content

Instantly share code, notes, and snippets.

@abhisekp
Last active May 23, 2019 06:18
Show Gist options
  • Save abhisekp/0194e499d265e6b536fa737cb70b3eb1 to your computer and use it in GitHub Desktop.
Save abhisekp/0194e499d265e6b536fa737cb70b3eb1 to your computer and use it in GitHub Desktop.
No Yarn Check
#!/usr/bin/env node
const errorMessage = `
❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌
👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇
Use yarn. It is blazingly faster ⚡⚡⚡
Install yarn - https://yarnpkg.com/en/docs/install
- yarn add [package] # Install a package as dependency
- yarn add [package] --dev # Install a package as dev dependency
👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆
❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌
`;
// Check if npm_execpath ends with yarn.js i.e. yarn is used
if (!/yarn\.js$/.test(process.env.npm_execpath)) {
console.log(errorMessage);
process.exit(1);
}
#!/usr/bin/env node
const errorMessage = `
❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌
👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇
Use npm please although yarn is blazingly faster ⚡⚡⚡
- npm install --save [package] # Install a package as dependency
- npm install --save-dev [package] # Install a package as dev dependency
👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆👆
❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌
`;
// Check if npm_execpath ends with yarn.js i.e. yarn is used
if (!/npm(-cli)?\.js$/.test(process.env.npm_execpath)) {
console.log(errorMessage);
process.exit(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment