From 44bd14d2c52a24fbff0fd92f813ac5e6cc5eddd2 Mon Sep 17 00:00:00 2001 From: Jethro Yu Date: Mon, 17 Mar 2025 11:42:54 +0800 Subject: [PATCH] feat(commitlint): add additional search path for @commitlint This change allows opencommit to locate commitlint installed globally (with opencommit), which is useful for project that does not use node.js environment or dose not have opencommit and @commitlint installed locally. --- src/modules/commitlint/pwd-commitlint.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/commitlint/pwd-commitlint.ts b/src/modules/commitlint/pwd-commitlint.ts index 02d58556..e01a4a68 100644 --- a/src/modules/commitlint/pwd-commitlint.ts +++ b/src/modules/commitlint/pwd-commitlint.ts @@ -4,7 +4,8 @@ import path from 'path'; const findModulePath = (moduleName: string) => { const searchPaths = [ path.join('node_modules', moduleName), - path.join('node_modules', '.pnpm') + path.join('node_modules', '.pnpm'), + path.resolve(__dirname, '../..') ]; for (const basePath of searchPaths) {