|
|
|
@ -147,6 +147,34 @@ public class ProjectNpmPackageAdder : ITransientDependency |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async Task RemoveMvcPackageAsync(string directory, NpmPackageInfo npmPackage, |
|
|
|
bool skipInstallingLibs = false) |
|
|
|
{ |
|
|
|
var packageJsonFilePath = Path.Combine(directory, "package.json"); |
|
|
|
if (!File.Exists(packageJsonFilePath) || |
|
|
|
!File.ReadAllText(packageJsonFilePath).Contains($"\"{npmPackage.Name}\"")) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
Logger.LogInformation($"Removing '{npmPackage.Name}' package from the project '{packageJsonFilePath}'..."); |
|
|
|
|
|
|
|
|
|
|
|
using (DirectoryHelper.ChangeCurrentDirectory(directory)) |
|
|
|
{ |
|
|
|
Logger.LogInformation("yarn remove " + npmPackage.Name); |
|
|
|
CmdHelper.RunCmd("yarn remove " + npmPackage.Name); |
|
|
|
|
|
|
|
if (skipInstallingLibs) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
Logger.LogInformation("Installing client-side packages..."); |
|
|
|
await InstallLibsService.InstallLibsAsync(directory); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private string DetectAbpVersionOrNull(string packageJsonFile) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(packageJsonFile) || |
|
|
|
|