Add preinstall step to check node version (#2507)

This commit is contained in:
Opender Singh authored and GitHub committed 2020-08-13 09:12:31 +12:00
1 parent 61b27ae3c4
commit 2b74221549
2 files changed
+19 -1

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
const fs = require('fs');
const foundNodeVersion = process.versions.node;
const expectedNodeVersion = fs
.readFileSync('.nvmrc')
.toString()
.trim();
if (foundNodeVersion !== expectedNodeVersion) {
console.log(`Current node version: ${foundNodeVersion}`);
console.log(`Expected node version: ${expectedNodeVersion}`);
console.log(
`Remember to 'npm run clean && npm run bootstrap' after installing the expected version.`,
);
console.log();
process.exit(1);
}