-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration to the Clean command
- Loading branch information
Showing
4 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Text.Json; | ||
|
||
namespace AbpDevTools.Configuration; | ||
public static class CleanConfiguration | ||
{ | ||
public static string FolderPath => Path.Combine( | ||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), | ||
"abpdev"); | ||
public static string FilePath => Path.Combine(FolderPath, "clean-configuration.json"); | ||
|
||
public static CleanOptions GetOptions() | ||
{ | ||
if (!Directory.Exists(FolderPath)) | ||
Directory.CreateDirectory(FolderPath); | ||
|
||
var options = new CleanOptions(); | ||
if (File.Exists(FilePath)) | ||
{ | ||
options = JsonSerializer.Deserialize<CleanOptions>(File.ReadAllText(FilePath)); | ||
} | ||
else | ||
{ | ||
File.WriteAllText(FilePath, JsonSerializer.Serialize(options, new JsonSerializerOptions | ||
{ | ||
WriteIndented = true | ||
})); | ||
} | ||
|
||
return options; | ||
} | ||
} | ||
|
||
public class CleanOptions | ||
{ | ||
public string[] Folders { get; set; } = new[] | ||
{ | ||
"bin", | ||
"obj", | ||
"node_modules", | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters