Skip to content

Commit 05b5ed6

Browse files
author
Rishi Raj Jain
authored
Update update.ts
1 parent 859425f commit 05b5ed6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/cli/src/commands/update.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface YarnListOutput {
1515

1616
function getInstalledVersion(packageName: string, packageManager: string, projectPath: string) {
1717
let installedVersion = null;
18-
if (packageManager === "npm" || packageManager === "pnpm") {
18+
if (packageManager === "npm") {
1919
const { stdout } = spawnSync(packageManager, ["list", packageName, "--json", "--depth=0"], {
2020
cwd: projectPath,
2121
});
@@ -32,6 +32,12 @@ function getInstalledVersion(packageName: string, packageManager: string, projec
3232
}
3333
}
3434
}
35+
else {
36+
const { stdout } = spawnSync(packageManager, ["list", packageName, "--json", "--depth=0"], {
37+
cwd: projectPath,
38+
});
39+
installedVersion = JSON.parse(stdout.toString())[0].dependencies[packageName].version;
40+
}
3541
return installedVersion;
3642
}
3743

0 commit comments

Comments
 (0)