()
| 46 | */ |
| 47 | export 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 | }; |
no test coverage detected
searching dependent graphs…