Improve handling of apiclient generator

1. Replace the separate stable/unstable scripts with a single script and
handle the difference with argument parsing.
2. Unify the calls and pass the Azure arguments in on the CLI.
This commit is contained in:
Joshua M. Boniface 2020-10-04 19:03:39 -04:00
parent d11adeb85e
commit fc28ffea53
4 changed files with 21 additions and 20 deletions

View File

@ -34,7 +34,7 @@ jobs:
displayName: 'Build unstable typescript axios client' displayName: 'Build unstable typescript axios client'
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master') condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
inputs: inputs:
script: 'bash ./apiclient/templates/typescript/axios/unstable.sh' script: "bash ./apiclient/templates/typescript/axios/generate.sh $(System.ArtifactsDirectory) $(Build.BuildNumber)"
- task: Npm@1 - task: Npm@1
displayName: 'Publish unstable typescript axios client' displayName: 'Publish unstable typescript axios client'
@ -50,7 +50,7 @@ jobs:
displayName: 'Build stable typescript axios client' displayName: 'Build stable typescript axios client'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
inputs: inputs:
script: 'bash ./apiclient/templates/typescript/axios/stable.sh' script: "bash ./apiclient/templates/typescript/axios/generate.sh $(System.ArtifactsDirectory)"
- task: Npm@1 - task: Npm@1
displayName: 'Publish stable typescript axios client' displayName: 'Publish stable typescript axios client'

View File

@ -0,0 +1,19 @@
#!/bin/bash
artifactsDirectory="${1}"
buildNumber="${2}"
if [[ -n ${buildNumber} ]]; then
# Unstable build
additionalProperties=",snapshotVersion=\"-SNAPSHOT.${buildNumber}\",npmRepository=\"https://pkgs.dev.azure.com/jellyfin-project/jellyfin/_packaging/unstable/npm/registry/\""
else
# Stable build
additionalProperties=""
fi
java -jar openapi-generator-cli.jar generate \
--input-spec ${artifactsDirectory}/openapispec/openapi.json \
--generator-name typescript-axios \
--output ./apiclient/generated/typescript/axios \
--template-dir ./apiclient/templates/typescript/axios \
--ignore-file-override ./apiclient/.openapi-generator-ignore \
--additional-properties=useSingleRequestParameter="true",withSeparateModelsAndApi="true",npmName="axios"${additionalProperties}

View File

@ -1,9 +0,0 @@
#!/bin/bash
java -jar openapi-generator-cli.jar generate \
--input-spec $(System.ArtifactsDirectory)/openapispec/openapi.json \
--generator-name typescript-axios \
--output ./apiclient/generated/typescript/axios \
--template-dir ./apiclient/templates/typescript/axios \
--ignore-file-override ./apiclient/.openapi-generator-ignore \
--additional-properties=useSingleRequestParameter="true",withSeparateModelsAndApi="true",npmName="axios"

View File

@ -1,9 +0,0 @@
#!/bin/bash
java -jar openapi-generator-cli.jar generate \
--input-spec $(System.ArtifactsDirectory)/openapispec/openapi.json \
--generator-name typescript-axios \
--output ./apiclient/generated/typescript/axios \
--template-dir ./apiclient/templates/typescript/axios \
--ignore-file-override ./apiclient/.openapi-generator-ignore \
--additional-properties=useSingleRequestParameter="true",withSeparateModelsAndApi="true",npmName="axios",snapshotVersion="-SNAPSHOT.$(Build.BuildNumber)",npmRepository="https://pkgs.dev.azure.com/jellyfin-project/jellyfin/_packaging/unstable/npm/registry/"