(dependencyName: string)
| 80 | * @param dependencyName |
| 81 | */ |
| 82 | export function getDependencyPath(dependencyName: string): string | null { |
| 83 | try { |
| 84 | const resolvedPath = require.resolve(`${dependencyName}/package.json`, { |
| 85 | paths: [getProjectRootPath()], |
| 86 | }); |
| 87 | |
| 88 | return path.dirname(resolvedPath); |
| 89 | } catch (err) { |
| 90 | return null; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Get the version of a dependency from package.json |
no test coverage detected