Pipeline to covert manual JS reviews to code file (#3897)

This commit is contained in:
praveenkuttappan 2022-08-17 16:00:34 -04:00 коммит произвёл GitHub
Родитель 16392fd791
Коммит e1b57dbce6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 72 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,55 @@
pr: none
trigger: none
pool:
name: azsdk-pool-mms-ubuntu-2004-general
vmImage: MMSUbuntu20.04
parameters:
- name: Reviews
type: string
default: '[{"ReviewID":"<reviewid>","RevisionID":"<revisionId>","FileID":"<fileid>","FileName":"<fileName>"}]'
- name: APIViewURL
type: string
default: 'https://apiview.dev'
- name: StorageContainerUrl
type: string
default: ''
variables:
TypeScriptGeneratorDirectory: 'src/ts/ts-genapi'
NodeVersion: '16.x'
jobs:
- job: CreateJSReviewCodeFile
displayName: 'Create JavaScript API review token file'
variables:
- template: /eng/pipelines/templates/variables/globals.yml
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NodeVersion)
displayName: "Use Node $(NodeVersion)"
- script: |
npm install -g npm@8.16.0
displayName: "Install npm 8.16.0"
- script: |
npm install
workingDirectory: $(TypeScriptGeneratorDirectory)
displayName: "Install npm packages typescript generator"
- script: |
npm run-script build
workingDirectory: $(TypeScriptGeneratorDirectory)
displayName: "Build typescript generator"
- template: /eng/pipelines/templates/steps/apiview-review-gen.yml
parameters:
Reviews: ${{ parameters.Reviews }}
APIViewURL: ${{ parameters.APIViewURL }}
StorageContainerUrl: ${{ parameters.StorageContainerUrl }}
ApiviewGenScript: './Create-Apiview-Token-Javascript.ps1'

Просмотреть файл

@ -0,0 +1,17 @@
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]$SourcePath,
[Parameter(Mandatory = $true)]
[string]$OutPath
)
Write-Host "Generating API review token file: $($SourcePath)"
$installedPath = npm ls @azure-tools/ts-genapi -p
$parserPath = Join-Path -Path $installedPath "export.js"
$FileName = Split-Path -Leaf $SourcePath
$OutFileName = $FileName -replace ".api.json", "_js.json"
$OutFilePath = Join-Path -Path $OutPath $OutFileName
Write-Host "Converting api-extractor file $($SourcePath) to APIview code file $($OutFilePath)"
node $parserPath $SourcePath $OutFilePath