From 4893a81fa58e6c2c83f8287a051212264fb38de1 Mon Sep 17 00:00:00 2001 From: Chris Chinchilla Date: Tue, 16 Jan 2024 11:24:52 +0100 Subject: [PATCH] Add Yarn and GitHub workflow config for building docs to GitHub Pages --- .github/workflows/docpublish.yml | 24 +++++++++++ .gitignore | 4 ++ docs/.nojekyll | 0 package.json | 3 ++ tsconfig.docs.json | 22 +++++++++++ yarn.lock | 68 +++++++++++++++++++++++++++++++- 6 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docpublish.yml create mode 100644 docs/.nojekyll create mode 100644 tsconfig.docs.json diff --git a/.github/workflows/docpublish.yml b/.github/workflows/docpublish.yml new file mode 100644 index 0000000..6d075f6 --- /dev/null +++ b/.github/workflows/docpublish.yml @@ -0,0 +1,24 @@ +name: Build and Deploy API docs + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install and Build + run: | + yarn install + yarn build:docs + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages # The branch the action should deploy to. + folder: docs/api # The folder the action should deploy to. diff --git a/.gitignore b/.gitignore index c0bba76..bcb4fe5 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,7 @@ cjs # VSCode .vscode + +# doc +**/docs/api +/docs/api \ No newline at end of file diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/package.json b/package.json index 9bc5492..4dbbee6 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "eslint-plugin-license-header": "^0.6.0", "prettier": "^3.0.0", "rimraf": "^5.0.1", + "typedoc": "^0.24.8", "typescript": "^5.3.2", "vitest": "^0.33.0" }, @@ -45,9 +46,11 @@ "scripts": { "build": "yarn build:cjs && yarn build:esm", "build:cjs": "run -T tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json", + "build:docs": "typedoc --theme default --out docs/api --tsconfig tsconfig.docs.json && touch docs/.nojekyll", "build:esm": "run -T tsc -p tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./dist/esm/package.json", "check": "tsc -p tsconfig.json", "clean": "yarn rimraf -g */{cjs,esm}", + "clean:docs": "rimraf docs/api", "lint": "eslint --ext .ts . && prettier -c .", "lint:fix": "prettier -w . && eslint --fix --ext .ts .", "prepublish": "yarn exec cp -f ../../LICENSE .", diff --git a/tsconfig.docs.json b/tsconfig.docs.json new file mode 100644 index 0000000..a2fbafb --- /dev/null +++ b/tsconfig.docs.json @@ -0,0 +1,22 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*"], + "typedocOptions": { + "entryPointStrategy": "resolve", + "entryPoints": ["src/runtime.ts", "src/sibling.ts", "src/utils.ts"], + "out": "docs/api", + "theme": "default", + "exclude": [ + "**/*spec.ts", + "**/__mocks__/**", + "**/tests/**", + "**/*.js", + "**/node_modules/**" + ], + "excludeExternals": true, + "excludePrivate": true, + "hideGenerator": true, + "name": "API Documentation", + "readme": "README.md" + } +} diff --git a/yarn.lock b/yarn.lock index da92200..dec0071 100644 --- a/yarn.lock +++ b/yarn.lock @@ -399,6 +399,7 @@ __metadata: eslint-plugin-license-header: ^0.6.0 prettier: ^3.0.0 rimraf: ^5.0.1 + typedoc: ^0.24.8 typescript: ^5.3.2 vitest: ^0.33.0 languageName: unknown @@ -1516,6 +1517,13 @@ __metadata: languageName: node linkType: hard +"ansi-sequence-parser@npm:^1.1.0": + version: 1.1.1 + resolution: "ansi-sequence-parser@npm:1.1.1" + checksum: ead5b15c596e8e85ca02951a844366c6776769dcc9fd1bd3a0db11bb21364554822c6a439877fb599e7e1ffa0b5f039f1e5501423950457f3dcb2f480c30b188 + languageName: node + linkType: hard + "ansi-styles@npm:^4.0.0, ansi-styles@npm:^4.1.0": version: 4.3.0 resolution: "ansi-styles@npm:4.3.0" @@ -3621,6 +3629,13 @@ __metadata: languageName: node linkType: hard +"lunr@npm:^2.3.9": + version: 2.3.9 + resolution: "lunr@npm:2.3.9" + checksum: 176719e24fcce7d3cf1baccce9dd5633cd8bdc1f41ebe6a180112e5ee99d80373fe2454f5d4624d437e5a8319698ca6837b9950566e15d2cae5f2a543a3db4b8 + languageName: node + linkType: hard + "magic-string@npm:^0.30.1": version: 0.30.5 resolution: "magic-string@npm:0.30.5" @@ -3656,6 +3671,15 @@ __metadata: languageName: node linkType: hard +"marked@npm:^4.3.0": + version: 4.3.0 + resolution: "marked@npm:4.3.0" + bin: + marked: bin/marked.js + checksum: 0db6817893952c3ec710eb9ceafb8468bf5ae38cb0f92b7b083baa13d70b19774674be04db5b817681fa7c5c6a088f61300815e4dd75a59696f4716ad69f6260 + languageName: node + linkType: hard + "merge-stream@npm:^2.0.0": version: 2.0.0 resolution: "merge-stream@npm:2.0.0" @@ -3721,7 +3745,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.1, minimatch@npm:^9.0.3": +"minimatch@npm:^9.0.0, minimatch@npm:^9.0.1, minimatch@npm:^9.0.3": version: 9.0.3 resolution: "minimatch@npm:9.0.3" dependencies: @@ -4738,6 +4762,18 @@ __metadata: languageName: node linkType: hard +"shiki@npm:^0.14.1": + version: 0.14.7 + resolution: "shiki@npm:0.14.7" + dependencies: + ansi-sequence-parser: ^1.1.0 + jsonc-parser: ^3.2.0 + vscode-oniguruma: ^1.7.0 + vscode-textmate: ^8.0.0 + checksum: 2aec3b3519df977c4391df9e1825cb496e9a4d7e11395f05a0da77e4fa2f7c3d9d6e6ee94029ac699533017f2b25637ee68f6d39f05f311535c2704d0329b520 + languageName: node + linkType: hard + "side-channel@npm:^1.0.4": version: 1.0.4 resolution: "side-channel@npm:1.0.4" @@ -5286,6 +5322,22 @@ __metadata: languageName: node linkType: hard +"typedoc@npm:^0.24.8": + version: 0.24.8 + resolution: "typedoc@npm:0.24.8" + dependencies: + lunr: ^2.3.9 + marked: ^4.3.0 + minimatch: ^9.0.0 + shiki: ^0.14.1 + peerDependencies: + typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x + bin: + typedoc: bin/typedoc + checksum: a46a14497f789fb3594e6c3af2e45276934ac46df40b7ed15a504ee51dc7a8013a2ffb3a54fd73abca6a2b71f97d3ec9ad356fa9aa81d29743e4645a965a2ae0 + languageName: node + linkType: hard + "typescript-logging@npm:^1.0.0": version: 1.0.1 resolution: "typescript-logging@npm:1.0.1" @@ -5540,6 +5592,20 @@ __metadata: languageName: node linkType: hard +"vscode-oniguruma@npm:^1.7.0": + version: 1.7.0 + resolution: "vscode-oniguruma@npm:1.7.0" + checksum: 53519d91d90593e6fb080260892e87d447e9b200c4964d766772b5053f5699066539d92100f77f1302c91e8fc5d9c772fbe40fe4c90f3d411a96d5a9b1e63f42 + languageName: node + linkType: hard + +"vscode-textmate@npm:^8.0.0": + version: 8.0.0 + resolution: "vscode-textmate@npm:8.0.0" + checksum: 127780dfea89559d70b8326df6ec344cfd701312dd7f3f591a718693812b7852c30b6715e3cfc8b3200a4e2515b4c96f0843c0eacc0a3020969b5de262c2a4bb + languageName: node + linkType: hard + "w3c-xmlserializer@npm:^5.0.0": version: 5.0.0 resolution: "w3c-xmlserializer@npm:5.0.0"