| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff 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 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments