Skip to content

Commit ff76451

Browse files
committed
feat: add typedoc
1 parent 29bf698 commit ff76451

File tree

7 files changed

+95
-13
lines changed

7 files changed

+95
-13
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: CI
22

33
on:
44
push:

.github/workflows/docs.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Docs
2+
3+
run-name: Update API docs
4+
5+
on:
6+
workflow_run:
7+
workflows: [CI]
8+
types: [completed]
9+
branches: [master]
10+
11+
concurrency:
12+
cancel-in-progress: true
13+
group: ${{github.workflow}}-${{github.ref_name}}
14+
15+
permissions:
16+
pages: write
17+
id-token: write
18+
19+
jobs:
20+
docs:
21+
runs-on: ubuntu-latest
22+
name: Publish docs on GitHub pages
23+
if: github.event.workflow_run.conclusion == 'success'
24+
environment:
25+
name: github-pages
26+
url: ${{steps.deployment.outputs.page_url}}
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
submodules: true
32+
fetch-depth: 0
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
cache: 'npm'
38+
- name: Install dependencies
39+
run: npm ci
40+
- name: Generate documentation
41+
run: npm run docs
42+
- name: Upload pages artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: docs/api
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v4

package.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,31 @@
2929
"vendor/tree-sitter/lib/src/*"
3030
],
3131
"dependencies": {
32-
"node-addon-api": "^8.2.1",
32+
"node-addon-api": "^8.2.2",
3333
"node-gyp-build": "^4.8.2"
3434
},
3535
"devDependencies": {
36-
"@types/node": "^22.7.8",
36+
"@types/node": "^22.9.0",
3737
"@types/tmp": "^0.2.6",
3838
"glob": "^11.0.0",
3939
"node-gyp": "^10.2.0",
4040
"prebuildify": "^6.0.1",
4141
"tmp": "^0.2.3",
4242
"tree-sitter-c": "^0.23.1",
43-
"tree-sitter-embedded-template": "^0.23.0",
44-
"tree-sitter-html": "^0.23.0",
45-
"tree-sitter-java": "^0.23.2",
46-
"tree-sitter-javascript": "^0.23.0",
47-
"tree-sitter-json": "^0.23.0",
48-
"tree-sitter-php": "^0.23.4",
49-
"tree-sitter-python": "^0.23.2",
43+
"tree-sitter-embedded-template": "^0.23.1",
44+
"tree-sitter-html": "^0.23.1",
45+
"tree-sitter-java": "^0.23.3",
46+
"tree-sitter-javascript": "^0.23.1",
47+
"tree-sitter-json": "^0.24.7",
48+
"tree-sitter-python": "^0.23.3",
5049
"tree-sitter-ruby": "^0.23.0",
51-
"tree-sitter-rust": "^0.23.0"
50+
"tree-sitter-rust": "^0.23.1",
51+
"typedoc": "^0.26.11",
52+
"typedoc-plugin-rename-defaults": "^0.7.1",
53+
"typescript": "^5.6.3"
5254
},
5355
"scripts": {
56+
"docs": "typedoc --out docs/api tree-sitter.d.ts --readme README.md",
5457
"install": "node-gyp-build",
5558
"build": "prebuildify --napi --strip",
5659
"build_x64": "prebuildify --napi --strip --arch x64 --target 20.9.0",

test/tree_test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/** @type {typeof import('tree-sitter')} */
22
const Parser = require("../index.js");
3-
const PHP = require('tree-sitter-php').php;
43
const JavaScript = require('tree-sitter-javascript');
54
const Rust = require('tree-sitter-rust');
65
const assert = require('node:assert');

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
]
1212
},
1313
"include": [
14-
"./**/*.js"
14+
"./test/*.js"
1515
],
1616
"exclude": [
1717
"node_modules"

tsconfig.typedoc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": false
4+
},
5+
"include": [
6+
"./tree-sitter.d.ts"
7+
]
8+
}

typedoc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"entryPoints": ["tree-sitter.d.ts"],
4+
"entryPointStrategy": "expand",
5+
"tsconfig": "./tsconfig.typedoc.json",
6+
"out": "docs/api",
7+
"readme": "README.md",
8+
"cleanOutputDir": true,
9+
"excludeReferences": true,
10+
"excludePrivate": true,
11+
"excludeInternal": true,
12+
"includeVersion": true,
13+
"searchInComments": true,
14+
"navigationLinks": {
15+
"GitHub": "https://github.com/tree-sitter/node-tree-sitter"
16+
},
17+
"visibilityFilters": {
18+
"protected": false,
19+
"private": false,
20+
"inherited": true,
21+
"external": false
22+
},
23+
"plugin": ["typedoc-plugin-rename-defaults"]
24+
}

0 commit comments

Comments
 (0)