docs: generate api documentation as a GitHub workflow (#217)

Fixes: https://github.com/cloudevents/sdk-javascript/issues/212
Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
Lance Ball 2020-06-08 18:25:27 -04:00 committed by GitHub
parent ed1d3286fa
commit 44b791bf97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 15 deletions

27
.github/workflows/api-docs.yaml vendored Normal file
View File

@ -0,0 +1,27 @@
name: API Docs
on: release
jobs:
publish:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Generate API documentation
run: npm install && npm run generate-docs
-
name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: docs
commit_message: |
Deploy to GitHub Pages
Signed-off-by: Lance Ball <lball@redhat.com>
allow_empty_commit: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

17
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "cloudevents-sdk",
"version": "2.0.1",
"version": "2.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -5720,6 +5720,11 @@
}
}
},
"typedoc-clarity-theme": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/typedoc-clarity-theme/-/typedoc-clarity-theme-1.1.0.tgz",
"integrity": "sha1-ESlK3eTzQuL8ZqX6Yqb7dDjMVhw="
},
"typedoc-default-themes": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.10.1.tgz",
@ -5729,16 +5734,6 @@
"lunr": "^2.3.8"
}
},
"typedoc-plugin-markdown": {
"version": "2.2.17",
"resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-2.2.17.tgz",
"integrity": "sha512-eE6cTeqsZIbjur6RG91Lhx1vTwjR49OHwVPRlmsxY3dthS4FNRL8sHxT5Y9pkosBwv1kSmNGQEPHjMYy1Ag6DQ==",
"dev": true,
"requires": {
"fs-extra": "^8.1.0",
"handlebars": "^4.7.3"
}
},
"typescript": {
"version": "3.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz",

View File

@ -14,7 +14,7 @@
"test:ts": "mocha --require ts-node/register ./test-ts/**/*.ts",
"coverage": "nyc --reporter=lcov --reporter=text npm run test",
"coverage-publish": "wget -qO - https://coverage.codacy.com/get.sh | bash -s report -l JavaScript -r coverage/lcov.info",
"generate-docs": "typedoc --tsconfig ./tsconfig.json --plugin typedoc-plugin-markdown src",
"generate-docs": "typedoc --excludeNotDocumented --out docs src",
"release": "standard-version",
"prepublish": "npm run build"
},
@ -99,6 +99,7 @@
"dependencies": {
"ajv": "~6.12.0",
"axios": "~0.19.2",
"typedoc-clarity-theme": "^1.1.0",
"uuid": "~8.0.0"
},
"devDependencies": {
@ -118,7 +119,6 @@
"standardx": "^5.0.0",
"ts-node": "^8.10.2",
"typedoc": "^0.17.7",
"typedoc-plugin-markdown": "^2.2.17",
"typescript": "^3.8.3"
},
"publishConfig": {

View File

@ -11,7 +11,7 @@ const nullOrUndefinedPayload = new ValidationError("null or undefined payload");
const asJSON = (v: object|string) => (isString(v) ? JSON.parse(v as string) : v);
class JSONParser {
decorator: any
decorator: Base64Parser
constructor(decorator: Base64Parser) {
this.decorator = decorator;
}

View File

@ -21,6 +21,7 @@
],
"typedocOptions": {
"out": "docs",
"mode": "file"
"mode": "file",
"theme": "node_modules/typedoc-clarity-theme/bin"
}
}