Skip to content

Commit

Permalink
Merge pull request #844 from colinin/flutter-cli
Browse files Browse the repository at this point in the history
feat(cli): add flutter rest api generator commands
  • Loading branch information
colinin authored Jul 11, 2023
2 parents f5323af + 6a66e85 commit b619547
Show file tree
Hide file tree
Showing 22 changed files with 915 additions and 4 deletions.
12 changes: 11 additions & 1 deletion aspnet-core/LINGYUN.MicroService.All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.EntityChange.Ap
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.EntityChange.Application", "modules\entity-change\LINGYUN.Abp.EntityChange.Application\LINGYUN.Abp.EntityChange.Application.csproj", "{AC41F335-E240-47E0-B409-AFAD1400E626}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.EntityChange.HttpApi", "modules\entity-change\LINGYUN.Abp.EntityChange.HttpApi\LINGYUN.Abp.EntityChange.HttpApi.csproj", "{1D420BA6-2155-4E0D-AAAF-EECC0330A38C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.EntityChange.HttpApi", "modules\entity-change\LINGYUN.Abp.EntityChange.HttpApi\LINGYUN.Abp.EntityChange.HttpApi.csproj", "{1D420BA6-2155-4E0D-AAAF-EECC0330A38C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cli", "cli", "{59627844-A66A-46AC-B882-E8F302D0EC24}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Cli", "modules\cli\LINGYUN.Abp.Cli\LINGYUN.Abp.Cli.csproj", "{2F49E870-DAE2-4D89-98CA-46BBD91C68E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -1643,6 +1647,10 @@ Global
{1D420BA6-2155-4E0D-AAAF-EECC0330A38C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D420BA6-2155-4E0D-AAAF-EECC0330A38C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D420BA6-2155-4E0D-AAAF-EECC0330A38C}.Release|Any CPU.Build.0 = Release|Any CPU
{2F49E870-DAE2-4D89-98CA-46BBD91C68E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F49E870-DAE2-4D89-98CA-46BBD91C68E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F49E870-DAE2-4D89-98CA-46BBD91C68E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F49E870-DAE2-4D89-98CA-46BBD91C68E2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1953,6 +1961,8 @@ Global
{7779D9BD-5928-49A2-965F-537967004238} = {DD1B10ED-73E2-41BE-928A-46501050FE2A}
{AC41F335-E240-47E0-B409-AFAD1400E626} = {DD1B10ED-73E2-41BE-928A-46501050FE2A}
{1D420BA6-2155-4E0D-AAAF-EECC0330A38C} = {DD1B10ED-73E2-41BE-928A-46501050FE2A}
{59627844-A66A-46AC-B882-E8F302D0EC24} = {C5CAD011-DF84-4914-939C-0C029DCEF26F}
{2F49E870-DAE2-4D89-98CA-46BBD91C68E2} = {59627844-A66A-46AC-B882-E8F302D0EC24}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<None Include="README.md" Pack="true" PackagePath="\" />
<None Remove="LINGYUN\Abp\Cli\UI\Vben\Templates\*.tpl" />
<EmbeddedResource Include="LINGYUN\Abp\Cli\UI\Vben\Templates\*.tpl" />
<None Remove="LINGYUN\Abp\Cli\UI\Flutter\GetX\Templates\*.tpl" />
<EmbeddedResource Include="LINGYUN\Abp\Cli\UI\Flutter\GetX\Templates\*.tpl" />
<EmbeddedResource Include="README.md" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using LINGYUN.Abp.Cli.Commands;
using LINGYUN.Abp.Cli.ServiceProxying.CSharp;
using LINGYUN.Abp.Cli.ServiceProxying.Flutter;
using LINGYUN.Abp.Cli.ServiceProxying.TypeScript;
using LINGYUN.Abp.Cli.UI;
using LINGYUN.Abp.Cli.UI.Flutter.GetX;
using LINGYUN.Abp.Cli.UI.Vben;
using Volo.Abp.Autofac;
using Volo.Abp.Cli;
Expand Down Expand Up @@ -39,6 +41,7 @@ public override void ConfigureServices(ServiceConfigurationContext context)
{
options.Generators[TypeScriptServiceProxyGenerator.Name] = typeof(TypeScriptServiceProxyGenerator);
options.Generators[CSharpServiceProxyGenerator.Name] = typeof(CSharpServiceProxyGenerator);
options.Generators[FlutterServiceProxyGenerator.Name] = typeof(FlutterServiceProxyGenerator);
});

Configure<TypeScriptServiceProxyOptions>(options =>
Expand All @@ -49,9 +52,15 @@ public override void ConfigureServices(ServiceConfigurationContext context)
options.ScriptGenerators[UniAppAxiosHttpApiScriptGenerator.Name] = new UniAppAxiosHttpApiScriptGenerator();
});

Configure<FlutterServiceProxyOptions>(options =>
{
options.ScriptGenerators[RestServiceScriptGenerator.Name] = new RestServiceScriptGenerator();
});

Configure<AbpCliViewGeneratorOptions>(options =>
{
options.Generators[VbenViewGenerator.Name] = typeof(VbenViewGenerator);
options.Generators[FlutterViewGenerator.Name] = typeof(FlutterViewGenerator);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ public string GetUsageInfo()
sb.AppendLine(" ts");
sb.AppendLine(" -asp|--api-script-proxy <api-script-proxy> The generated api proxy type(axios, vben-axios, vben-dynamic). default: vben-dynamic.");
sb.AppendLine(" -o|--output <output-name> TypeScript file path or folder to place generated code in.");
sb.AppendLine(" flutter");
sb.AppendLine(" -asp|--api-script-proxy <api-script-proxy> The generated api proxy type(dio, rest-service). default: rest-service.");
sb.AppendLine(" -o|--output <output-name> Flutter script file path or folder to place generated code in.");

sb.AppendLine("-p|--provider <client-proxy-provider> The client proxy provider(http, dapr).");
sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI");

Expand All @@ -133,6 +137,7 @@ public string GetUsageInfo()
sb.AppendLine(" labp generate-proxy --folder MyProxies/InnerFolder -url https://localhost:44302/");
sb.AppendLine(" labp generate-proxy -t ts -m identity -o api/identity -url https://localhost:44302/");
sb.AppendLine(" labp generate-proxy -t ts -asp vben-dynamic -m identity -o api/identity -url https://localhost:44302/");
sb.AppendLine(" labp generate-proxy -t flutter -asp rest-service -m identity -o api/identity -url https://localhost:44302/");

return sb.ToString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@ public string GetUsageInfo()
sb.AppendLine("-t|--type <type> The name of generate type (vben-view).");
sb.AppendLine(" vben-view");
sb.AppendLine(" -o|--output <output-name> js/vue file path or folder to place generated code in.");
sb.AppendLine(" flutter-view");
sb.AppendLine(" -o|--output <output-name> flutter file path or folder to place generated code in.");
sb.AppendLine("-u|--url <url> API definition URL from.");
sb.AppendLine("-m|--module <module-name> (default: 'app') The name of the backend module you wish to generate proxies for.");
sb.AppendLine("");
sb.AppendLine("Examples:");
sb.AppendLine("");

sb.AppendLine(" labp generate-proxy -t vben-view -m identity -o api/identity -url https://localhost:44302/");
sb.AppendLine(" labp generate-proxy -t flutter-view -m identity -o api/identity -url https://localhost:44302/");

return sb.ToString();
}
Expand Down
Loading

0 comments on commit b619547

Please sign in to comment.