FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

post merge hook · devhttps/frontend@7aaa63e · GitHub

Commit 7aaa63e

Browse files
committed
post merge hook
1 parent 4f8d163 commit 7aaa63e

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎git-hooks/post-merge‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env node
2+
/* eslint-disable no-console */
3+
4+
const execa = require('execa');
5+
const chalk = require('chalk');
6+
const fs = require('fs');
7+
8+
execa.shell('git diff-tree -r --name-only --no-commit-id HEAD@{1} HEAD')
9+
.then(result => {
10+
const changedFiles = result.stdout.split(',');
11+
12+
if (changedFiles.includes('.nvmrc')) {
13+
const nodeVersion = fs.readFileSync('.nvmrc');
14+
15+
console.log(`${chalk.red(`This application now uses Node.js v${nodeVersion}. Switch to the latest version using \`nvm use\` or download from nodejs.org. Then run \`make reinstall\``)}`);
16+
} else if (changedFiles.includes('yarn.lock')) {
17+
console.log(`${chalk.red('This application has new dependencies. Running \`make install\`')}`);
18+
19+
return execa('make', ['install'], {
20+
stdio: 'inherit',
21+
});
22+
}
23+
})
24+
.catch(e => {
25+
console.log(`\n${e}\n`);
26+
process.exit(1);
27+
});

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL