diff --git a/.azure-pipelines/apiview.yml b/.azure-pipelines/apiview.yml
index e7ca5a87fe6..8a72d3bb23d 100644
--- a/.azure-pipelines/apiview.yml
+++ b/.azure-pipelines/apiview.yml
@@ -11,7 +11,7 @@ trigger:
- src/dotnet/APIView
- src/java/apiview-java-processor
- src/swift
- - src/ts/ts-genapi
+ - tools/apiview/parsers/js-api-parser
pr:
branches:
@@ -26,7 +26,7 @@ pr:
- src/dotnet/APIView
- src/java/apiview-java-processor
- src/swift
- - src/ts/ts-genapi
+ - tools/apiview/parsers/js-api-parser
variables:
DotNetRuntimeVersion: '3.1.x'
@@ -36,7 +36,7 @@ variables:
TestProjectPath: 'src/dotnet/APIView/**/*Tests.csproj'
NodeVersion: '12.x'
BuildConfiguration: 'Release'
- TypeScriptGeneratorDirectory: 'src/ts/ts-genapi'
+ TypeScriptGeneratorDirectory: 'tools/apiview/parsers/js-api-parser'
GoParserPackagePath: 'src/go'
GoVersion: '1.18'
NugetSecurityAnalysisWarningLevel: 'none'
diff --git a/src/dotnet/APIView/APIViewWeb/APIViewWeb.csproj b/src/dotnet/APIView/APIViewWeb/APIViewWeb.csproj
index 78df1bb4d22..e2acfdb8ad3 100644
--- a/src/dotnet/APIView/APIViewWeb/APIViewWeb.csproj
+++ b/src/dotnet/APIView/APIViewWeb/APIViewWeb.csproj
@@ -10,7 +10,7 @@
..\..\..\java\apiview-java-processor\target\apiview-java-processor-1.27.0.jar
..\..\..\..\packages\python-packages\api-stub-generator\dist\api_stub_generator-0.1.0-py3-none-any.whl
..\..\..\go\apiviewgo.exe
- ..\..\..\ts\ts-genapi\
+ ..\..\..\..\tools\apiview\parsers\js-api-parser\
latest
true
diff --git a/src/dotnet/APIView/APIViewWeb/CONTRIBUTING.md b/src/dotnet/APIView/APIViewWeb/CONTRIBUTING.md
index c032ec80200..921db0b3e9b 100644
--- a/src/dotnet/APIView/APIViewWeb/CONTRIBUTING.md
+++ b/src/dotnet/APIView/APIViewWeb/CONTRIBUTING.md
@@ -24,7 +24,7 @@ Core of the APIView tool is the web app developed using ASP.Net and TypeScript.
| C | https://github.com/Azure/azure-sdk-tools/blob/main/src/dotnet/APIView/APIViewWeb/Languages/CLanguageService.cs |
| C++ | https://github.com/Azure/azure-sdk-tools/blob/main/src/dotnet/APIView/APIViewWeb/Languages/CppLanguageService.cs |
| Java | https://github.com/Azure/azure-sdk-tools/tree/main/src/java/apiview-java-processor |
-| JS/TS | https://github.com/Azure/azure-sdk-tools/tree/main/src/ts/ts-genapi |
+| JS/TS | https://github.com/Azure/azure-sdk-tools/tree/main/tools/apiview/parsers/js-api-parser |
| Python | https://github.com/Azure/azure-sdk-tools/tree/main/packages/python-packages/api-stub-generator |
| Go | https://github.com/Azure/azure-sdk-tools/tree/main/src/go |
| Swift | https://github.com/Azure/azure-sdk-tools/tree/main/src/swift |
@@ -180,10 +180,10 @@ Happy coding!!!!
- Start Visual Studio debug run and create a new review as per the instructions in [APIView README.md](https://github.com/Azure/azure-sdk-tools/blob/main/src/dotnet/APIView/APIViewWeb/README.md)
#### JS/TS
- - Got to /src/ts/ts-genapi
+ - Got to /tools/apiview/parsers/js-api-parser
- run `npm install`
- run `npm run-script build`
- - Copy compiled `index.js` to following location within local code repo /artifacts/bin/APIVIewWeb/Debug/<.NetVersion>/
+ - Copy compiled `export.js` to following location within local code repo /artifacts/bin/APIVIewWeb/Debug/<.NetVersion>/
- Start Visual Studio debug run and create a new review as per the instructions in [APIView README.md](https://github.com/Azure/azure-sdk-tools/blob/main/src/dotnet/APIView/APIViewWeb/README.md)
diff --git a/src/ts/ts-genapi/package.json b/src/ts/ts-genapi/package.json
deleted file mode 100644
index ace0f280803..00000000000
--- a/src/ts/ts-genapi/package.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "ts-genapi",
- "version": "1.0.1",
- "description": "",
- "main": "index.js",
- "dependencies": {
- "@microsoft/api-extractor-model": "^7.8.13",
- "js-tokens": "^6.0.0"
- },
- "devDependencies": {
- "ts-node": "^8.10.2",
- "typescript": "^3.9.7"
- },
- "scripts": {
- "build": "tsc export.ts --module commonjs"
- },
- "keywords": [],
- "author": "",
- "license": "ISC"
-}
diff --git a/src/ts/ts-genapi/.gitignore b/tools/apiview/parsers/js-api-parser/.gitignore
similarity index 100%
rename from src/ts/ts-genapi/.gitignore
rename to tools/apiview/parsers/js-api-parser/.gitignore
diff --git a/tools/apiview/parsers/js-api-parser/ci.yml b/tools/apiview/parsers/js-api-parser/ci.yml
new file mode 100644
index 00000000000..ca439a64a19
--- /dev/null
+++ b/tools/apiview/parsers/js-api-parser/ci.yml
@@ -0,0 +1,100 @@
+# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
+trigger:
+ branches:
+ include:
+ - main
+ - feature/*
+ - release/*
+ - hotfix/*
+ paths:
+ include:
+ - tools/apiview/parsers/js-api-parserts-genapi
+
+pr:
+ branches:
+ include:
+ - main
+ - feature/*
+ - release/*
+ - hotfix/*
+ paths:
+ include:
+ - tools/apiview/parsers/js-api-parserts-genapi
+
+variables:
+ NodeVersion: '16.x'
+ TypeScriptGeneratorDirectory: 'tools/apiview/parsers/js-api-parserts-genapi'
+ ArtifactName: 'apiview'
+ FeedRegistry: 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/'
+
+stages:
+ - stage: 'Build'
+ jobs:
+ - job: 'Build'
+
+ pool:
+ name: azsdk-pool-mms-ubuntu-2004-general
+ vmImage: MMSUbuntu20.04
+
+ steps:
+ - task: NodeTool@0
+ inputs:
+ versionSpec: '$(NodeVersion)'
+ displayName: 'Use NodeJS $(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"
+
+ - pwsh: |
+ npm pack $(TypeScriptGeneratorDirectory)
+ Copy-Item ./*.tgz $(Build.ArtifactStagingDirectory)
+ displayName: "Pack typescript generator"
+
+ - task: PublishBuildArtifacts@1
+ inputs:
+ pathtoPublish: '$(Build.ArtifactStagingDirectory)'
+ artifactName: $(ArtifactName)
+
+ - ${{if and(eq(variables['Build.Reason'], 'Manual'), eq(variables['System.TeamProject'], 'internal'))}}:
+ - stage: 'Release'
+ dependsOn: Build
+ condition: Succeeded()
+ jobs:
+ - job: PublishPackage
+ displayName: 'Publish ts-genapi package to devops feed'
+ pool:
+ name: azsdk-pool-mms-ubuntu-2004-general
+ vmImage: MMSUbuntu20.04
+ steps:
+ - checkout: none
+ - download: current
+
+ - pwsh: |
+ $detectedPackageName=Get-ChildItem $(Pipeline.Workspace)/$(ArtifactName)/*.tgz
+ Write-Host "Detected package name: $detectedPackageName"
+ $registry="$(FeedRegistry)"
+ $regAuth=$registry.replace("https:","")
+ $npmReg = $regAuth.replace("registry/","");
+ $env:NPM_TOKEN="$(azure-sdk-devops-npm-token)"
+ Write-Host "Publishing to $($regAuth)"
+ npm config set $regAuth`:username=azure-sdk
+ npm config set $regAuth`:_password=`$`{NPM_TOKEN`}
+ npm config set $regAuth`:email=not_set
+ npm config set $npmReg`:username=azure-sdk
+ npm config set $npmReg`:_password=`$`{NPM_TOKEN`}
+ npm config set $npmReg`:email=not_set
+ Write-Host "Publishing package"
+ Write-Host "npm publish $detectedPackageName --registry=$registry --always-auth=true"
+ npm publish $detectedPackageName --registry=$registry --always-auth=true
+ displayName: Publish package
diff --git a/src/ts/ts-genapi/export.ts b/tools/apiview/parsers/js-api-parser/export.ts
similarity index 96%
rename from src/ts/ts-genapi/export.ts
rename to tools/apiview/parsers/js-api-parser/export.ts
index 646642b4238..c4d5c161614 100644
--- a/src/ts/ts-genapi/export.ts
+++ b/tools/apiview/parsers/js-api-parser/export.ts
@@ -119,7 +119,9 @@ var apiViewFile: IApiViewFile = {
Name: name,
Navigation: navigation,
Tokens: builder.tokens,
- PackageName: apiModel.packages[0].name
+ PackageName: apiModel.packages[0].name,
+ VersionString: "1.0.3",
+ Language: "JavaScript"
}
writeFile(process.argv[3], JSON.stringify(apiViewFile), err => {
diff --git a/src/ts/ts-genapi/models.ts b/tools/apiview/parsers/js-api-parser/models.ts
similarity index 94%
rename from src/ts/ts-genapi/models.ts
rename to tools/apiview/parsers/js-api-parser/models.ts
index 6518d9c3811..37abaed4bd6 100644
--- a/src/ts/ts-genapi/models.ts
+++ b/tools/apiview/parsers/js-api-parser/models.ts
@@ -16,6 +16,8 @@ export declare interface IApiViewFile {
Tokens: IApiViewToken[];
Navigation: IApiViewNavItem[];
PackageName: string;
+ VersionString: string;
+ Language: string;
}
export declare interface IApiViewToken {
diff --git a/tools/apiview/parsers/js-api-parser/package.json b/tools/apiview/parsers/js-api-parser/package.json
new file mode 100644
index 00000000000..2d32c51b37b
--- /dev/null
+++ b/tools/apiview/parsers/js-api-parser/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "@azure-tools/ts-genapi",
+ "version": "1.0.3",
+ "description": "",
+ "main": "index.js",
+ "publishConfig":{"registry":"https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/"},
+ "dependencies": {
+ "@microsoft/api-extractor-model": "^7.22.2",
+ "js-tokens": "^6.0.0"
+ },
+ "devDependencies": {
+ "ts-node": "^8.10.2",
+ "typescript": "^3.9.7"
+ },
+ "scripts": {
+ "build": "tsc -p ."
+ },
+ "keywords": [],
+ "author": "azure-sdk",
+ "license": "MIT"
+}
diff --git a/tools/apiview/parsers/js-api-parser/readme.md b/tools/apiview/parsers/js-api-parser/readme.md
new file mode 100644
index 00000000000..ddf2530e96b
--- /dev/null
+++ b/tools/apiview/parsers/js-api-parser/readme.md
@@ -0,0 +1,19 @@
+## Overview
+
+This application tokenises a Javascript project into a format useful for JavaScript API reviews. JavaScript API review parser is used by APIView system and CI pipelines to convert a JSON output file created by `api-extracor` to JSON token file intepreted by APIView to create and present review in APIView system.
+
+## Building
+
+1. Go to project directory `/tools/apiview/parsers/js-api-parser` and Install npm packages.
+ `npm install
+2. Run `npm run-script build`
+
+## How To Use
+
+Run API extractor step on JS project to create json output file. This step is integrated within build commend for all Azure SDK projects in azure-sdk-for-js monorepo. So running build step is good enough to create input file for APIvIew parser. You can see a JSON file created in temp directory within package root directory once build step is completed succesfully for the package.
+
+Run `node ./export.js
+
+For e.g.
+
+`node .\export.js C:\git\azure-sdk-for-js\sdk\core\core-client\temp\core-client.api.json C:\git\azure-sdk-for-js\sdk\core\core-client\temp\apiview.json`
\ No newline at end of file
diff --git a/src/ts/ts-genapi/tokensBuilder.ts b/tools/apiview/parsers/js-api-parser/tokensBuilder.ts
similarity index 100%
rename from src/ts/ts-genapi/tokensBuilder.ts
rename to tools/apiview/parsers/js-api-parser/tokensBuilder.ts
diff --git a/tools/apiview/parsers/js-api-parser/tsconfig.json b/tools/apiview/parsers/js-api-parser/tsconfig.json
new file mode 100644
index 00000000000..f39daa757a7
--- /dev/null
+++ b/tools/apiview/parsers/js-api-parser/tsconfig.json
@@ -0,0 +1,3 @@
+{
+ "include": ["*.ts"]
+}
\ No newline at end of file