Merge pull request #18352 from abpframework/ProjectNpmPackageAdder-removemvcpackage-2

Adjust ProjectNpmPackageAdder & Add npm package info to web projects
pull/18353/head
Yunus Emre Kalkan 1 year ago committed by GitHub
commit 5be072aed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,6 +29,8 @@
<Pack>true</Pack>
<PackagePath>content\</PackagePath>
</Content>
</ItemGroup>
<ItemGroup>
<None Remove="*.abppkg" />
<Content Include="*.abppkg">
<Pack>true</Pack>

@ -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) ||

@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/blogging": {
"version": ""
}
}
}

@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/cms-kit.admin": {
"version": ""
}
}
}

@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/cms-kit.public": {
"version": ""
}
}
}

@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/cms-kit": {
"version": ""
}
}
}

@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/docs": {
"version": ""
}
}
}
Loading…
Cancel
Save