From a55fbfd0d094a717f59f7693feb24aa75815af2f Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 1 Dec 2023 14:15:29 +0300 Subject: [PATCH 1/3] Added RemoveMvcPackageAsync method to ProjectNpmPackageAdder --- .../ProjectNpmPackageAdder.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs index f16435ad10..d3d2c834ab 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs @@ -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) || From 9e6470d1fc03c5c246fd12d1b13841bc3c3e2d07 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 1 Dec 2023 15:09:35 +0300 Subject: [PATCH 2/3] Adjust abppkg files of mvc packages --- .../src/Volo.Blogging.Web/Volo.Blogging.Web.abppkg | 7 ++++++- .../src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.abppkg | 7 ++++++- .../Volo.CmsKit.Public.Web/Volo.CmsKit.Public.Web.abppkg | 7 ++++++- modules/cms-kit/src/Volo.CmsKit.Web/Volo.CmsKit.Web.abppkg | 7 ++++++- modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.abppkg | 7 ++++++- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.abppkg b/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.abppkg index 930c4018b3..8e2d30d272 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.abppkg +++ b/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.abppkg @@ -1,3 +1,8 @@ { - "role": "lib.mvc" + "role": "lib.mvc", + "npmDependencies": { + "@abp/blogging": { + "version": "" + } + } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.abppkg b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.abppkg index 930c4018b3..33a45483d7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.abppkg +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.abppkg @@ -1,3 +1,8 @@ { - "role": "lib.mvc" + "role": "lib.mvc", + "npmDependencies": { + "@abp/cms-kit.admin": { + "version": "" + } + } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Volo.CmsKit.Public.Web.abppkg b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Volo.CmsKit.Public.Web.abppkg index 930c4018b3..1fe9750915 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Volo.CmsKit.Public.Web.abppkg +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Volo.CmsKit.Public.Web.abppkg @@ -1,3 +1,8 @@ { - "role": "lib.mvc" + "role": "lib.mvc", + "npmDependencies": { + "@abp/cms-kit.public": { + "version": "" + } + } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Web/Volo.CmsKit.Web.abppkg b/modules/cms-kit/src/Volo.CmsKit.Web/Volo.CmsKit.Web.abppkg index 930c4018b3..4e7da6d7d7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Web/Volo.CmsKit.Web.abppkg +++ b/modules/cms-kit/src/Volo.CmsKit.Web/Volo.CmsKit.Web.abppkg @@ -1,3 +1,8 @@ { - "role": "lib.mvc" + "role": "lib.mvc", + "npmDependencies": { + "@abp/cms-kit": { + "version": "" + } + } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.abppkg b/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.abppkg index 930c4018b3..8f16736603 100644 --- a/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.abppkg +++ b/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.abppkg @@ -1,3 +1,8 @@ { - "role": "lib.mvc" + "role": "lib.mvc", + "npmDependencies": { + "@abp/docs": { + "version": "" + } + } } \ No newline at end of file From 0db741cf29f16068150d4b6271aff0bb2b574382 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 1 Dec 2023 17:40:12 +0300 Subject: [PATCH 3/3] Update common.props --- common.props | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common.props b/common.props index 291a64e0b0..bbb6e34805 100644 --- a/common.props +++ b/common.props @@ -29,6 +29,8 @@ true content\ + + true