( rootDir: vscode.Uri, depsToInstall: string[], devDepsToInstall?: string[] )
| 216 | } |
| 217 | |
| 218 | export const askInstallDependenciesPrompt = async ( |
| 219 | rootDir: vscode.Uri, |
| 220 | depsToInstall: string[], |
| 221 | devDepsToInstall?: string[] |
| 222 | ) => { |
| 223 | const deps = await getDependenciesArray(rootDir); |
| 224 | const devDeps = await getDevDependenciesArray(rootDir); |
| 225 | // No package.json found |
| 226 | if (!deps) { |
| 227 | return; |
| 228 | } |
| 229 | const filteredDepsToInstall = depsToInstall.filter((dep) => !deps.includes(dep)); |
| 230 | const filteredDevDepsToInstall = devDepsToInstall?.filter((dep) => !devDeps?.includes(dep)) ?? []; |
| 231 | // No dependencies to install |
| 232 | if (filteredDepsToInstall.length === 0 && filteredDevDepsToInstall.length === 0) { |
| 233 | return; |
| 234 | } |
| 235 | const message = |
| 236 | "Remix Forge has generated code that uses dependencies you do not have in the project. Would you like to install these dependencies?"; |
| 237 | const options = ["Yes", "No"]; |
| 238 | |
| 239 | vscode.window.showInformationMessage(message, ...options).then(async (selectedOption) => { |
| 240 | if (selectedOption === "Yes") { |
| 241 | if (filteredDepsToInstall.length > 0) { |
| 242 | // Install dependencies logic |
| 243 | await installDependencies(rootDir, filteredDepsToInstall); |
| 244 | } |
| 245 | if (filteredDevDepsToInstall.length > 0) { |
| 246 | await installDevDependencies(rootDir, filteredDevDepsToInstall); |
| 247 | } |
| 248 | // Execute the logic to install dependencies here |
| 249 | } else if (selectedOption === "No") { |
| 250 | // User chose not to install dependencies |
| 251 | // vscode.window.showInformationMessage("Skipping dependency installation."); |
| 252 | } |
| 253 | }); |
| 254 | }; |
| 255 | |
| 256 | export const showError = (error: string) => vscode.window.showErrorMessage(`${error}`); |
| 257 |
no test coverage detected