install.js 647 B

12345678910111213141516171819202122232425
  1. 'use strict'
  2. // Run when package is installed
  3. const path = require('path')
  4. const isCI = require('is-ci')
  5. const installFrom = require('../src/install')
  6. if (isCI && !process.env.HUSKY_IGNORE_CI && !process.env.YORKIE_IGNORE_CI) {
  7. console.log('CI detected, skipping Git hooks installation')
  8. process.exit(0)
  9. }
  10. if (process.env.HUSKY_SKIP_INSTALL || process.env.YORKIE_SKIP_INSTALL) {
  11. console.log(
  12. `env variable HUSKY_SKIP_INSTALL is set to ${process.env
  13. .HUSKY_SKIP_INSTALL}, skipping Git hooks installation`
  14. )
  15. process.exit(0)
  16. }
  17. console.log('setting up Git hooks')
  18. const depDir = path.join(__dirname, '..')
  19. installFrom(depDir)