From 87a9d9099adc8592228c83bdb52abfbe90b0a47c Mon Sep 17 00:00:00 2001 From: Lance Ball Date: Mon, 8 Jun 2020 17:44:54 -0400 Subject: [PATCH] docs: generate api documentation as a GitHub workflow Fixes: https://github.com/cloudevents/sdk-javascript/issues/212 --- .github/workflows/api-docs.yaml | 27 +++++++++++++++++++++++++++ package-lock.json | 17 ++++++----------- package.json | 5 +++-- src/lib/formats/json/parser.ts | 2 +- tsconfig.json | 3 ++- 5 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/api-docs.yaml diff --git a/.github/workflows/api-docs.yaml b/.github/workflows/api-docs.yaml new file mode 100644 index 00000000..e0b2d769 --- /dev/null +++ b/.github/workflows/api-docs.yaml @@ -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 + allow_empty_commit: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package-lock.json b/package-lock.json index 18fa2330..189d9204 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index f653f558..4c407876 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "2.0.2", "description": "CloudEvents SDK for JavaScript", "main": "index.js", + "type": "module", "scripts": { "watch": "tsc --project tsconfig.json --watch", "build": "tsc --project tsconfig.json", @@ -14,7 +15,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 +100,7 @@ "dependencies": { "ajv": "~6.12.0", "axios": "~0.19.2", + "typedoc-clarity-theme": "^1.1.0", "uuid": "~8.0.0" }, "devDependencies": { @@ -118,7 +120,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": { diff --git a/src/lib/formats/json/parser.ts b/src/lib/formats/json/parser.ts index 8a861c97..4b61a42c 100644 --- a/src/lib/formats/json/parser.ts +++ b/src/lib/formats/json/parser.ts @@ -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; } diff --git a/tsconfig.json b/tsconfig.json index 7bf429f4..dcaa5fdb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,6 +21,7 @@ ], "typedocOptions": { "out": "docs", - "mode": "file" + "mode": "file", + "theme": "node_modules/typedoc-clarity-theme/bin" } }