Skip to content

Commit 447ac3b

Browse files
authored
Merge pull request #25991 from abpframework/auto-merge/rel-10-7/4772
Merge branch dev with rel-10.7
2 parents 33ed5a9 + 14cb610 commit 447ac3b

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageJsonFileFinder.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ protected virtual bool IsWithProjectFile(string path)
3333

3434
return
3535
Directory.GetFiles(directory, "*.csproj", searchOption: SearchOption.TopDirectoryOnly).Any() ||
36-
File.Exists(Path.Combine(directory, "angular.json"));
36+
File.Exists(Path.Combine(directory, "angular.json")) ||
37+
File.Exists(Path.Combine(directory, "vite.config.ts")) ||
38+
File.Exists(Path.Combine(directory, "next.config.ts"));
3739
}
3840
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.IO;
3+
using Shouldly;
4+
using Volo.Abp.Cli.ProjectModification;
5+
using Xunit;
6+
7+
namespace Volo.Abp.Cli;
8+
9+
public class PackageJsonFileFinder_Tests
10+
{
11+
[Theory]
12+
[InlineData("Test.csproj", true)]
13+
[InlineData("angular.json", true)]
14+
[InlineData("vite.config.ts", true)]
15+
[InlineData("next.config.ts", true)]
16+
[InlineData("", false)]
17+
public void Should_Find_Package_Json_For_Supported_Project_Types(string projectFileName, bool expected)
18+
{
19+
var testDirectory = Path.Combine(Path.GetTempPath(), "abp-cli-tests", Guid.NewGuid().ToString("N"));
20+
Directory.CreateDirectory(testDirectory);
21+
22+
try
23+
{
24+
var packageJsonPath = Path.Combine(testDirectory, "package.json");
25+
File.WriteAllText(packageJsonPath, "{}");
26+
27+
if (!projectFileName.IsNullOrEmpty())
28+
{
29+
File.WriteAllText(Path.Combine(testDirectory, projectFileName), string.Empty);
30+
}
31+
32+
var result = new PackageJsonFileFinder().Find(testDirectory);
33+
34+
result.Contains(packageJsonPath).ShouldBe(expected);
35+
}
36+
finally
37+
{
38+
Directory.Delete(testDirectory, recursive: true);
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)