diff --git a/src/CommandsEnum.ts b/src/CommandsEnum.ts index d3667e5..c1e0b14 100644 --- a/src/CommandsEnum.ts +++ b/src/CommandsEnum.ts @@ -1,4 +1,4 @@ export enum COMMANDS { - config = 'config', - hook = 'hook' + hook = 'hook', + config = 'config' } diff --git a/src/commands/config.ts b/src/commands/config.ts index e0a7123..c10ed41 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -29,6 +29,7 @@ const validateConfig = ( outro( `${chalk.red('✖')} Unsupported config key ${key}: ${validationMessage}` ); + process.exit(1); } }; @@ -49,6 +50,7 @@ export const configValidators = { return value; }, + [CONFIG_KEYS.description](value: any) { validateConfig( CONFIG_KEYS.description, @@ -58,6 +60,7 @@ export const configValidators = { return value; }, + [CONFIG_KEYS.emoji](value: any) { validateConfig( CONFIG_KEYS.emoji, @@ -67,6 +70,7 @@ export const configValidators = { return value; }, + [CONFIG_KEYS.language](value: any) { validateConfig( CONFIG_KEYS.language, diff --git a/src/commands/githook.ts b/src/commands/githook.ts index 02ac98e..e6f2dfd 100644 --- a/src/commands/githook.ts +++ b/src/commands/githook.ts @@ -55,18 +55,18 @@ export const hookCommand = command( } if (mode === 'unset') { - intro(`unsetting opencommit as '${HOOK_NAME}' hook`); + intro(`unsetting OpenCommit as '${HOOK_NAME}' hook`); if (!isHookExists) { return outro( - `opencommit wasn't previously set as '${HOOK_NAME}' hook, nothing to remove` + `OpenCommit wasn't previously set as '${HOOK_NAME}' hook, nothing to remove` ); } const realpath = await fs.realpath(SYMLINK_URL); if (realpath !== HOOK_URL) { return outro( - `opencommit wasn't previously set as '${HOOK_NAME}' hook, but different hook was, if you want to remove it — do it manually` + `OpenCommit wasn't previously set as '${HOOK_NAME}' hook, but different hook was, if you want to remove it — do it manually` ); } diff --git a/src/generateCommitMessageFromGitDiff.ts b/src/generateCommitMessageFromGitDiff.ts index d310c01..69100b0 100644 --- a/src/generateCommitMessageFromGitDiff.ts +++ b/src/generateCommitMessageFromGitDiff.ts @@ -8,7 +8,7 @@ import { mergeStrings } from './utils/mergeStrings'; import { i18n, I18nLocals } from './i18n'; const config = getConfig(); -const translation = i18n[config?.language as I18nLocals || 'en'] +const translation = i18n[(config?.language as I18nLocals) || 'en']; const INIT_MESSAGES_PROMPT: Array = [ { @@ -20,7 +20,7 @@ const INIT_MESSAGES_PROMPT: Array = [ }, use the present tense. ${ config?.description ? 'Add a short description of what commit is about after the commit message. Don\'t start it with "This commit", just describe the changes.' - : 'Don\'t add any descriptions to the commit, only commit message.' + : "Don't add any descriptions to the commit, only commit message." } Use ${translation.localLanguage} to answer.` }, {