cli add-module --add-to-solution-file option

pull/5654/head
Yunus Emre Kalkan 5 years ago
parent 14281eacb9
commit dc19e4fdcc

@ -180,7 +180,8 @@ abp add-module Volo.Blogging
* `--solution` or `-s`: Specifies the solution (.sln) file path. If not specified, CLI tries to find a .sln file in the current directory.
* `--skip-db-migrations`: For EF Core database provider, it automatically adds a new code first migration (`Add-Migration`) and updates the database (`Update-Database`) if necessary. Specify this option to skip this operation.
* `-sp` or `--startup-project`: Relative path to the project folder of the startup project. Default value is the current folder.
* `--with-source-code`: Add source code of the module instead of NuGet/NPM packages.
* `--with-source-code`: Downloads the source code of the module to your solution folder and uses local project references instead of NuGet/NPM packages.
* `--add-to-solution-file`: Adds the downloaded project to your solution file, so you will also see the projects of the module in your solution when you open it on a IDE. (only available when `--with-source-code` is used.)
### get-source

@ -36,7 +36,8 @@ namespace Volo.Abp.Cli.Commands
);
}
var withSourceCode = commandLineArgs.Options.ContainsKey("with-source-code");
var withSourceCode = commandLineArgs.Options.ContainsKey(Options.SourceCode.Long);
var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file");
var skipDbMigrations = Convert.ToBoolean(
commandLineArgs.Options.GetOrNull(Options.DbMigrations.Skip) ?? "false");
@ -55,7 +56,8 @@ namespace Volo.Abp.Cli.Commands
commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long),
version,
skipDbMigrations,
withSourceCode
withSourceCode,
addSourceCodeToSolutionFile
);
}
@ -71,7 +73,8 @@ namespace Volo.Abp.Cli.Commands
sb.AppendLine(" abp add-module <module-name> [options]");
sb.AppendLine("");
sb.AppendLine("Options:");
sb.AppendLine(" --with-source-code Downloads the source code of the module and adds it to your solution.");
sb.AppendLine(" --with-source-code Downloads the source code of the module to your solution folder.");
sb.AppendLine(" --add-to-solution-file Adds the downloaded project to your solution file. (only available when --with-source-code used)");
sb.AppendLine(" -s|--solution <solution-file> Specify the solution file explicitly.");
sb.AppendLine(" --skip-db-migrations <boolean> Specify if a new migration will be added or not.");
sb.AppendLine(" -sp|--startup-project <startup-project-path> Relative path to the project folder of the startup project. Default value is the current folder.");
@ -158,6 +161,11 @@ namespace Volo.Abp.Cli.Commands
public const string Short = "sp";
public const string Long = "startup-project";
}
public static class SourceCode
{
public const string Long = "with-source-code";
}
}
}
}

@ -68,7 +68,8 @@ namespace Volo.Abp.Cli.ProjectModification
string startupProject,
string version,
bool skipDbMigrations = false,
bool withSourceCode = false)
bool withSourceCode = false,
bool addSourceCodeToSolutionFile = false)
{
Check.NotNull(solutionFile, nameof(solutionFile));
Check.NotNull(moduleName, nameof(moduleName));
@ -85,7 +86,12 @@ namespace Volo.Abp.Cli.ProjectModification
{
var modulesFolderInSolution = Path.Combine(Path.GetDirectoryName(solutionFile), "modules");
await DownloadSourceCodesToSolutionFolder(module, modulesFolderInSolution, version);
await SolutionFileModifier.AddModuleToSolutionFileAsync(module, solutionFile);
if (addSourceCodeToSolutionFile)
{
await SolutionFileModifier.AddModuleToSolutionFileAsync(module, solutionFile);
}
await NugetPackageToLocalReferenceConverter.Convert(module, solutionFile);
await AddAngularSourceCode(modulesFolderInSolution, solutionFile);
}

Loading…
Cancel
Save