(moduleName: string)
| 2 | import path from 'path'; |
| 3 | |
| 4 | const findModulePath = (moduleName: string) => { |
| 5 | const searchPaths = [ |
| 6 | path.join('node_modules', moduleName), |
| 7 | path.join('node_modules', '.pnpm'), |
| 8 | path.resolve(__dirname, '../..') |
| 9 | ]; |
| 10 | |
| 11 | for (const basePath of searchPaths) { |
| 12 | try { |
| 13 | const resolvedPath = require.resolve(moduleName, { paths: [basePath] }); |
| 14 | return resolvedPath; |
| 15 | } catch { |
| 16 | // Continue to the next search path if the module is not found |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | throw new Error(`Cannot find module ${moduleName}`); |
| 21 | }; |
| 22 | |
| 23 | const getCommitLintModuleType = async (): Promise<'cjs' | 'esm'> => { |
| 24 | const packageFile = '@commitlint/load/package.json'; |
no outgoing calls
no test coverage detected
searching dependent graphs…