Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function commitTask(task: CommitTaskDesc): void {
dbg('running commitizen commit');
// use this to get the resolved path to the root of the commitizen directory
const cliPath = require
.resolve('commitizen/package.json')
.replace('package.json', '');
return czBootstrap(
{
cliPath,
config: {
path: task.path,
},
},
// this gets the arguments in the right positions to
// satisfy commitizen, which strips the first two
// (assumes that they're `['node', 'git-cz']`)
[null, ...task.restOptions],
);
}
async function initCommit() {
const {hasFiles: hasStagedFiles} = await getDiffedFiles({checkIfStaged: true})
if (hasStagedFiles === false) {
console.log('No files added to staging! Did you forget to run git add?\n')
const modified = await getDiffedFiles()
if (modified.hasFiles) {
console.log('Showing the files that you could add:')
console.log(modified.files)
}
return
}
bootstrap({
debug: false,
cliPath: path.join(process.cwd(), 'node_modules/commitizen'),
config: {
path: require.resolve('@s-ui/cz')
}
})
}