check-npm-version.js 354 B

12345678910111213141516
  1. let { execSync } = require('child_process')
  2. let pico = require('picocolors')
  3. try {
  4. let version = parseInt(execSync('npm -v'))
  5. if (version <= 6) {
  6. process.stderr.write(
  7. pico.red(
  8. 'Update npm or call ' +
  9. pico.yellow('npx update-browserslist-db@latest') +
  10. '\n'
  11. )
  12. )
  13. process.exit(1)
  14. }
  15. } catch (e) {}