feat(dev-infra): Allow local user ng-dev configuration to disable commit message wizard (#38701)

As not all users, particularly contributors consistently contributing with a deep
understanding of our commit message guidelines, will not want to rely on the
commit message wizard, we allow a user to opt out of using this wizard during
commit message creation.

PR Close #38701
This commit is contained in:
Joey Perrott
2020-09-03 13:54:31 -07:00
committed by atscott
parent 18d911d807
commit 7669bd856f
2 changed files with 11 additions and 5 deletions

View File

@ -7,7 +7,8 @@
*/
import {writeFileSync} from 'fs';
import {info} from '../utils/console';
import {getUserConfig} from '../utils/config';
import {debug, info} from '../utils/console';
import {buildCommitMessage} from './builder';
@ -25,10 +26,15 @@ const defaultCommitMessage = `<type>(<scope>): <summary>
export async function runWizard(
args: {filePath: string, source?: PrepareCommitMsgHookSource, commitSha?: string}) {
// TODO(josephperrott): Add support for skipping wizard with local untracked config file
if (getUserConfig().commitMessage?.disableWizard) {
debug('Skipping commit message wizard due to enabled `commitMessage.disableWizard` option in');
debug('user config.');
process.exitCode = 0;
return;
}
if (args.source !== undefined) {
info(`Skipping commit message wizard due because the commit was created via '${
info(`Skipping commit message wizard because the commit was created via '${
args.source}' source`);
process.exitCode = 0;
return;