(rootDir: vscode.Uri)
| 92 | } |
| 93 | |
| 94 | export const getPackageManager = async (rootDir: vscode.Uri) => { |
| 95 | const packageJsonPathNPM = vscode.Uri.joinPath(vscode.Uri.file(rootDir?.fsPath), "package-lock.json").fsPath; |
| 96 | const packageJsonPathYarn = vscode.Uri.joinPath(vscode.Uri.file(rootDir?.fsPath), "yarn.lock").fsPath; |
| 97 | const packageJsonPathPNPM = vscode.Uri.joinPath(vscode.Uri.file(rootDir?.fsPath), "pnpm-lock.yaml").fsPath; |
| 98 | try { |
| 99 | const packageLockNPM = await vscode.workspace.fs.readFile(vscode.Uri.file(packageJsonPathNPM)); |
| 100 | if (packageLockNPM) { |
| 101 | return "npm"; |
| 102 | } |
| 103 | } catch (e) {} |
| 104 | try { |
| 105 | const packageLockYarn = await vscode.workspace.fs.readFile(vscode.Uri.file(packageJsonPathYarn)); |
| 106 | if (packageLockYarn) { |
| 107 | return "yarn"; |
| 108 | } |
| 109 | } catch (e) {} |
| 110 | try { |
| 111 | const packageLockPNPM = await vscode.workspace.fs.readFile(vscode.Uri.file(packageJsonPathPNPM)); |
| 112 | if (packageLockPNPM) { |
| 113 | return "pnpm"; |
| 114 | } |
| 115 | } catch (e) {} |
| 116 | |
| 117 | return "npm"; |
| 118 | }; |
| 119 | |
| 120 | export const installDependencies = async (rootDir: vscode.Uri, depsToInstall: string[]) => { |
| 121 | const pkg = getPackageJson(rootDir); |
no outgoing calls
no test coverage detected