Skip to content

Commit aad2605

Browse files
fix: searching for aws-cdk-lim npm module
1 parent 3a52f55 commit aad2605

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/utils/findNpmPath.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,13 @@ export async function findNpmPath(dir: string, moduleName: string) {
3030
* @returns
3131
*/
3232
async function checkModuleInPackageJson(dir: string, moduleName: string) {
33-
const packageJsonPath = path.join(dir, "package.json");
34-
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
35-
const dependencies = packageJson.dependencies || {};
36-
const devDependencies = packageJson.devDependencies || {};
37-
if (dependencies[moduleName] || devDependencies[moduleName]) {
38-
const modulePath = path.join(dir, "node_modules", moduleName);
33+
const modulePath = path.join(dir, "node_modules", moduleName);
3934

40-
try {
41-
await fs.access(modulePath);
42-
} catch {
43-
return undefined;
44-
}
45-
46-
return modulePath;
35+
try {
36+
await fs.access(modulePath);
37+
} catch {
38+
return undefined;
4739
}
48-
return undefined;
40+
41+
return modulePath;
4942
}

0 commit comments

Comments
 (0)