Skip to content

Commit

Permalink
feat: add typedoc
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Nov 10, 2024
1 parent 29bf698 commit ff76451
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: CI

on:
push:
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Docs

run-name: Update API docs

on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [master]

concurrency:
cancel-in-progress: true
group: ${{github.workflow}}-${{github.ref_name}}

permissions:
pages: write
id-token: write

jobs:
docs:
runs-on: ubuntu-latest
name: Publish docs on GitHub pages
if: github.event.workflow_run.conclusion == 'success'
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Generate documentation
run: npm run docs
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/api
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
23 changes: 13 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,31 @@
"vendor/tree-sitter/lib/src/*"
],
"dependencies": {
"node-addon-api": "^8.2.1",
"node-addon-api": "^8.2.2",
"node-gyp-build": "^4.8.2"
},
"devDependencies": {
"@types/node": "^22.7.8",
"@types/node": "^22.9.0",
"@types/tmp": "^0.2.6",
"glob": "^11.0.0",
"node-gyp": "^10.2.0",
"prebuildify": "^6.0.1",
"tmp": "^0.2.3",
"tree-sitter-c": "^0.23.1",
"tree-sitter-embedded-template": "^0.23.0",
"tree-sitter-html": "^0.23.0",
"tree-sitter-java": "^0.23.2",
"tree-sitter-javascript": "^0.23.0",
"tree-sitter-json": "^0.23.0",
"tree-sitter-php": "^0.23.4",
"tree-sitter-python": "^0.23.2",
"tree-sitter-embedded-template": "^0.23.1",
"tree-sitter-html": "^0.23.1",
"tree-sitter-java": "^0.23.3",
"tree-sitter-javascript": "^0.23.1",
"tree-sitter-json": "^0.24.7",
"tree-sitter-python": "^0.23.3",
"tree-sitter-ruby": "^0.23.0",
"tree-sitter-rust": "^0.23.0"
"tree-sitter-rust": "^0.23.1",
"typedoc": "^0.26.11",
"typedoc-plugin-rename-defaults": "^0.7.1",
"typescript": "^5.6.3"
},
"scripts": {
"docs": "typedoc --out docs/api tree-sitter.d.ts --readme README.md",
"install": "node-gyp-build",
"build": "prebuildify --napi --strip",
"build_x64": "prebuildify --napi --strip --arch x64 --target 20.9.0",
Expand Down
1 change: 0 additions & 1 deletion test/tree_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** @type {typeof import('tree-sitter')} */
const Parser = require("../index.js");
const PHP = require('tree-sitter-php').php;
const JavaScript = require('tree-sitter-javascript');
const Rust = require('tree-sitter-rust');
const assert = require('node:assert');
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
]
},
"include": [
"./**/*.js"
"./test/*.js"
],
"exclude": [
"node_modules"
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"allowJs": false
},
"include": [
"./tree-sitter.d.ts"
]
}
24 changes: 24 additions & 0 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["tree-sitter.d.ts"],
"entryPointStrategy": "expand",
"tsconfig": "./tsconfig.typedoc.json",
"out": "docs/api",
"readme": "README.md",
"cleanOutputDir": true,
"excludeReferences": true,
"excludePrivate": true,
"excludeInternal": true,
"includeVersion": true,
"searchInComments": true,
"navigationLinks": {
"GitHub": "https://github.com/tree-sitter/node-tree-sitter"
},
"visibilityFilters": {
"protected": false,
"private": false,
"inherited": true,
"external": false
},
"plugin": ["typedoc-plugin-rename-defaults"]
}

0 comments on commit ff76451

Please sign in to comment.