forked from mrsone40/vets-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprebuild.js
More file actions
24 lines (21 loc) · 826 Bytes
/
prebuild.js
File metadata and controls
24 lines (21 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const semver = require('semver');
const fs = require('fs');
const path = require('path');
const nodeVersion = path.join(__dirname, '../.nvmrc');
const minimumNodeVersion = fs.readFileSync(nodeVersion).toString();
if (process.env.INSTALL_HOOKS !== 'no') {
// Make sure git pre-commit hooks are installed
['pre-commit'].forEach(hook => {
const src = path.join(__dirname, `hooks/${hook}`);
const dest = path.join(__dirname, `../.git/hooks/${hook}`);
if (fs.existsSync(src) && !fs.existsSync(dest)) {
// Install hooks
fs.linkSync(src, dest);
}
});
}
if (semver.compare(process.version, minimumNodeVersion) === -1) {
process.stdout.write(`Node.js version (minimum): v${minimumNodeVersion}\n`);
process.stdout.write(`Node.js version (installed): ${process.version}\n`);
process.exit(1);
}