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