From 0eca4a1cf0a600c96c805976988e9269233860a9 Mon Sep 17 00:00:00 2001 From: a145789 <2091927351@qq.com> Date: Sun, 21 Apr 2024 20:19:24 +0800 Subject: [PATCH] feat: ensure commit message path is provided for commit linting --- package.json | 4 ++-- src/commitLint.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ed1cbe4..5d3fc13 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "*.{ts,tsx,js,vue,less}": "prettier --write", "*.{ts,tsx,js,vue}": "eslint --fix" }, - "packageManager": "pnpm@8.7.5", + "packageManager": "pnpm@9.0.1", "engines": { "node": ">=16.0.0", "pnpm": ">=8.0" @@ -76,4 +76,4 @@ "picocolors": "^1.0.0", "semver": "^7.5.4" } -} \ No newline at end of file +} diff --git a/src/commitLint.ts b/src/commitLint.ts index 8641c40..bb8415a 100644 --- a/src/commitLint.ts +++ b/src/commitLint.ts @@ -64,6 +64,11 @@ export function commitLint(options: CommitLintCommandOptions) { warningMessage = WARNING_MESSAGE, } = options + if (!commitMessagePath) { + logger.error('commitMessagePath is required') + process.exit(1) + } + const commitMessage = getCommitMessage(commitMessagePath) const isValidCommitMessage = new RegExp(commitMessageRe).test(commitMessage)