MCPcopy
hub / github.com/di-sukharev/opencommit / getCommitLintPWDConfig

Function getCommitLintPWDConfig

src/modules/commitlint/pwd-commitlint.ts:48–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 */
47export const getCommitLintPWDConfig =
48 async (): Promise<QualifiedConfigOnAnyVersion | null> => {
49 let load: Function, modulePath: string;
50 switch (await getCommitLintModuleType()) {
51 case 'cjs':
52 /**
53 * CommonJS (<= commitlint@v18.x.x.)
54 */
55 modulePath = findModulePath('@commitlint/load');
56 load = require(modulePath).default;
57 break;
58 case 'esm':
59 /**
60 * ES Module (commitlint@v19.x.x. <= )
61 * Directory import is not supported in ES Module resolution, so import the file directly
62 */
63 modulePath = findModulePath('@commitlint/load/lib/load.js');
64 load = (await import(modulePath)).default;
65 break;
66 }
67
68 if (load && typeof load === 'function') {
69 return await load();
70 }
71
72 // @commitlint/load is not a function
73 return null;
74 };

Callers 1

Calls 3

loadFunction · 0.85
getCommitLintModuleTypeFunction · 0.70
findModulePathFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…