Skip to content

Commit

Permalink
chore(jsdoc): update jsdoc configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
larsgw committed Jan 5, 2025
1 parent 62b7d27 commit 62e9443
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 37 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ on:
workflow_dispatch:
push:
tags:
- '*'
- '*'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v2.1.2
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand Down
31 changes: 0 additions & 31 deletions .jsdoc.js

This file was deleted.

28 changes: 28 additions & 0 deletions .jsdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"plugins": ["plugins/markdown"],
"markdown": {
"idInHeadings": true
},
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"source": {
"include": [
"src",
"src/parser"
]
},
"opts": {
"destination": "./docs/0.2/",
"encoding": "utf8",
"readme": "./README.md"
},
"templates": {
"default": {
"includeDate": true
},
"cleverLinks": false,
"monospaceLinks": false
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "standard",
"test": "mocha --throw-deprecation test/spec.js",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"docs": "jsdoc -c .jsdoc.cjs",
"docs": "node scripts/update-jsdoc-config.js && jsdoc -c .jsdoc.json",
"preversion": "npm run lint && npm test",
"version": "npm run changelog"
},
Expand Down
16 changes: 16 additions & 0 deletions scripts/update-jsdoc-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import path from 'node:path'
import url from 'node:url'
import fs from 'node:fs'

const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
const packageRoot = path.dirname(__dirname)

const packageFile = path.join(packageRoot, 'package.json')
const packageConfig = JSON.parse(fs.readFileSync(packageFile, 'utf8'))
const version = packageConfig.version.match(/(0\.)*\d+/)[0]

const jsdocFile = path.join(packageRoot, '.jsdoc.json')
const jsdocConfig = fs.readFileSync(jsdocFile, 'utf8')
const updatedJsdocConfig = jsdocConfig.replace(/"\.\/docs\/.+?\/"/, '"./docs/' + version + '/"')

fs.writeFileSync(jsdocFile, updatedJsdocConfig)

0 comments on commit 62e9443

Please sign in to comment.