Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust ProjectNpmPackageAdder & Add npm package info to web projects #18351

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions common.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<Pack>true</Pack>
<PackagePath>content\</PackagePath>
</Content>
</ItemGroup>
<ItemGroup>
<None Remove="*.abppkg" />
<Content Include="*.abppkg">
<Pack>true</Pack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/blogging": {
"version": ""
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/cms-kit.admin": {
"version": ""
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/cms-kit.public": {
"version": ""
}
}
}
7 changes: 6 additions & 1 deletion modules/cms-kit/src/Volo.CmsKit.Web/Volo.CmsKit.Web.abppkg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/cms-kit": {
"version": ""
}
}
}
7 changes: 6 additions & 1 deletion modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.abppkg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"role": "lib.mvc"
"role": "lib.mvc",
"npmDependencies": {
"@abp/docs": {
"version": ""
}
}
}