From c9fb2f6061fd471a79b8e0b1149c2d44ddb516e4 Mon Sep 17 00:00:00 2001 From: muhammedaltug Date: Tue, 26 Apr 2022 11:35:55 +0300 Subject: [PATCH 1/2] support url param in abp generate-proxy command --- docs/en/CLI.md | 8 +++++--- .../Angular/AngularServiceProxyGenerator.cs | 7 ++++++- .../schematics/src/commands/proxy-add/schema.json | 9 +++++++++ .../schematics/src/commands/proxy-refresh/schema.json | 9 +++++++++ .../schematics/src/commands/proxy-remove/schema.json | 9 +++++++++ .../schematics/src/models/generate-proxy-schema.ts | 5 +++++ npm/ng-packs/packages/schematics/src/utils/source.ts | 5 ++++- 7 files changed, 47 insertions(+), 5 deletions(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index d381290508..491ebee401 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -298,7 +298,7 @@ abp generate-proxy -t [options] Examples: ````bash -abp generate-proxy -t ng +abp generate-proxy -t ng -url https://localhost:44302/ abp generate-proxy -t js -url https://localhost:44302/ abp generate-proxy -t csharp -url https://localhost:44302/ ```` @@ -312,12 +312,13 @@ abp generate-proxy -t csharp -url https://localhost:44302/ * `--api-name` or `-a`: The name of the API endpoint defined in the `/src/environments/environment.ts`. Default value: `default`. * `--source` or `-s`: Specifies the Angular project name to resolve the root namespace & API definition URL from. Default value: `defaultProject`. * `--target`: Specifies the Angular project name to place generated code in. Default value: `defaultProject`. + * `--url`: Specifies api definition url. Default value is API Name's url in environment file. * `--prompt` or `-p`: Asks the options from the command line prompt (for the unspecified options). * `js`: JavaScript. work in the `*.Web` project directory. There are some additional options for this client: * `--output` or `-o`: JavaScript file path or folder to place generated code in. * `--module` or `-m`: Specifies the name of the backend module you wish to generate proxies for. Default value: `app`. * `--working-directory` or `-wd`: Execution directory. For `csharp` and `js` client types. -* `--url` or `-u`: API definition URL from. For `csharp` and `js` client types. +* `--url` or `-u`: API definition URL from. > See the [Angular Service Proxies document](UI/Angular/Service-Proxies.md) for more. @@ -350,12 +351,13 @@ abp remove-proxy -t csharp --folder MyProxies/InnerFolder * `--api-name` or `-a`: The name of the API endpoint defined in the `/src/environments/environment.ts`. Default value: `default`. * `--source` or `-s`: Specifies the Angular project name to resolve the root namespace & API definition URL from. Default value: `defaultProject`. * `--target`: Specifies the Angular project name to place generated code in. Default value: `defaultProject`. + * `--url`: Specifies api definition url. Default value is API Name's url in environment file. * `--prompt` or `-p`: Asks the options from the command line prompt (for the unspecified options). * `js`: JavaScript. work in the `*.Web` project directory. There are some additional options for this client: * `--output` or `-o`: JavaScript file path or folder to place generated code in. * `--module` or `-m`: Specifies the name of the backend module you wish to generate proxies for. Default value: `app`. * `--working-directory` or `-wd`: Execution directory. For `csharp` and `js` client types. -* `--url` or `-u`: API definition URL from. For `csharp` and `js` client types. +* `--url` or `-u`: API definition URL from. > See the [Angular Service Proxies document](UI/Angular/Service-Proxies.md) for more. diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs index e6069981da..8c8a6cdbd0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs @@ -48,7 +48,7 @@ public class AngularServiceProxyGenerator : ServiceProxyGeneratorBase { const source = await resolveProject(host, params.source!); - const sourceUrl = getSourceUrl(host, source, apiName); + if (!sourceUrl) { + sourceUrl = getSourceUrl(host, source, apiName); + } return await getApiDefinition(sourceUrl); }; } From a1d6c4d5e05fb5199c37d4fd66e1d67a533dd701 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 26 Apr 2022 13:07:36 +0300 Subject: [PATCH 2/2] Update framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs Co-authored-by: Enis Necipoglu --- .../Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs index 8c8a6cdbd0..7e30a9a6bf 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs @@ -48,7 +48,7 @@ public class AngularServiceProxyGenerator : ServiceProxyGeneratorBase