Skip to content

Commit

Permalink
docs: add api-extractor report (opensearch-project#662)
Browse files Browse the repository at this point in the history
This commit activates the api-extractor report allowing a semi-automated check about possible breaking changes on the current published API contract. The extractor outputs a Markdown report file called `api/charts.api.md`. This file shows all the public/beta/alpha type/interface/function exposed as part of our public API (visible when importing elastic/charts into a project). It includes a set of warnings related to missing tags or wrongly used tags. This commit adds also a GH workflow that runs the `yarn api:check` commands as a GH check and warns the PR author about possible changes of the current API document.
  • Loading branch information
markov00 authored May 21, 2020
1 parent b1bdfb3 commit 81fa252
Show file tree
Hide file tree
Showing 18 changed files with 1,768 additions and 108 deletions.
1 change: 1 addition & 0 deletions packages/osd-charts/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.json linguist-language=JSON-with-Comments
26 changes: 26 additions & 0 deletions packages/osd-charts/.github/workflows/api_extractor_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check for API changes

on: [push, pull_request]

jobs:
api-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Run API-Extractor
run: yarn api:check
- name: API-Extractor failure
if: ${{ failure() }}
uses: LouisBrunner/[email protected]
with:
old: api/charts.api.md
new: tmp/charts.api.md
mode: deletion
tolerance: better
37 changes: 19 additions & 18 deletions packages/osd-charts/api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
*/
// "tsconfigFilePath": "<projectFolder>/tsconfig.json",
"tsconfigFilePath": "<projectFolder>/tsconfig.lib.json",
/**
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
* The object must conform to the TypeScript tsconfig schema:
Expand All @@ -99,7 +99,7 @@
*
* DEFAULT VALUE: false
*/
// "skipLibCheck": true,
"skipLibCheck": false
},

/**
Expand All @@ -109,7 +109,7 @@
/**
* (REQUIRED) Whether to generate an API report.
*/
"enabled": true
"enabled": true,

/**
* The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
Expand All @@ -135,7 +135,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/etc/"
*/
// "reportFolder": "<projectFolder>/etc/",
"reportFolder": "<projectFolder>/api/",

/**
* Specifies the folder where the temporary report file is written. The file name portion is determined by
Expand All @@ -150,7 +150,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/temp/"
*/
// "reportTempFolder": "<projectFolder>/temp/"
"reportTempFolder": "<projectFolder>/tmp/"
},

/**
Expand All @@ -160,7 +160,7 @@
/**
* (REQUIRED) Whether to generate a doc model file.
*/
"enabled": true
"enabled": false

/**
* The output path for the doc model file. The file extension should be ".api.json".
Expand All @@ -181,7 +181,7 @@
/**
* (REQUIRED) Whether to generate the .d.ts rollup file.
*/
"enabled": true
"enabled": false,

/**
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.
Expand All @@ -195,7 +195,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
*/
// "untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",

/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
Expand All @@ -207,7 +207,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: ""
*/
// "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
"betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",

/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
Expand All @@ -221,7 +221,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: ""
*/
// "publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts",
"publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts"

/**
* When a declaration is trimmed, by default it will be replaced by a code comment such as
Expand All @@ -242,7 +242,7 @@
*
* DEFAULT VALUE: true
*/
// "enabled": true,
"enabled": true
/**
* Specifies where the TSDoc metadata file should be written.
*
Expand Down Expand Up @@ -330,14 +330,15 @@
"default": {
"logLevel": "warning"
// "addToApiReportFile": false
},
"ae-extra-release-tag": {
"logLevel": "warning",
"addToApiReportFile": true
},
"ae-missing-release-tag": {
"logLevel": "warning",
"addToApiReportFile": true
}

// "ae-extra-release-tag": {
// "logLevel": "warning",
// "addToApiReportFile": true
// },
//
// . . .
},

/**
Expand Down
Loading

0 comments on commit 81fa252

Please sign in to comment.