feat: ported xml-namespace-loader

This commit is contained in:
Igor Randjelovic
2020-11-28 21:26:16 +01:00
parent 803958266d
commit 5b182c0d5f
7 changed files with 699 additions and 9 deletions

View File

@ -1,6 +1,7 @@
import { getPackageJson, getProjectRootPath } from './project';
import path from 'path';
// todo: memoize
export function getAllDependencies(): string[] {
const packageJSON = getPackageJson();
@ -10,6 +11,12 @@ export function getAllDependencies(): string[] {
];
}
// todo: memoize
export function hasDependency(dependencyName: string) {
return getAllDependencies().includes(dependencyName);
}
// todo: memoize
export function getDependencyPath(dependencyName: string): string | null {
try {
const resolvedPath = require.resolve(`${dependencyName}/package.json`, {