1 | #!/usr/bin/env node
|
2 | 'use strict'
|
3 |
|
4 | const cp = require('child_process')
|
5 | const path = require('path')
|
6 |
|
7 | const isGitRepository = (cwd) => {
|
8 | const { status, stdout } = cp.spawnSync('git', ['rev-parse', '--is-inside-work-tree'], { cwd })
|
9 | return status !== 0 ? false : !!stdout
|
10 | }
|
11 |
|
12 | if (!isGitRepository(process.cwd()))
|
13 | throw new Error('fatal: not a git repository (or any of the parent directories): .git')
|
14 |
|
15 | const { bootstrap } = require('commitizen/dist/cli/git-cz')
|
16 | const cliPath = require.resolve('commitizen')
|
17 | bootstrap({
|
18 | cliPath: path.resolve(cliPath, '../../'),
|
19 | config: {
|
20 | path: require.resolve('cz-customizable'),
|
21 | },
|
22 | })
|