ci: Block execution of npm install (no-changelog) (#4662)

ci: block execution of `npm install` (no-changelog)
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2022-11-21 12:53:11 +01:00 committed by GitHub
parent 60746dc92e
commit 6b52e4b111
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -9,6 +9,7 @@
}, },
"packageManager": "pnpm@7.14.2", "packageManager": "pnpm@7.14.2",
"scripts": { "scripts": {
"preinstall": "node scripts/block-npm-install.js",
"build": "turbo run build", "build": "turbo run build",
"dev": "turbo run dev --parallel", "dev": "turbo run dev --parallel",
"clean": "turbo run clean --parallel", "clean": "turbo run clean --parallel",

View file

@ -0,0 +1,12 @@
const { npm_config_user_agent: UA } = process.env;
const [packageManager] = (UA ?? '').split(' ');
const [name, version] = packageManager.split('/');
if (name !== 'pnpm') {
const suggestion = '\033[1;92mpnpm\033[0;31m';
console.error('\033[0;31m');
console.error('╭───────────────────────────────────────────╮');
console.error(`\tPlease use ${suggestion} instead of ${name} \t`);
console.error('╰───────────────────────────────────────────╯');
console.error('\033[0m');
process.exit(1);
}