UNPKG

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