Skip to content

Commit

Permalink
Add typedoc reporter (#134)
Browse files Browse the repository at this point in the history
* add typedoc report

* Add typedoc report

* fix typedoc reporter only
  • Loading branch information
leordev authored Feb 7, 2024
1 parent b44ed48 commit bf0bd1b
Show file tree
Hide file tree
Showing 8 changed files with 265 additions and 31 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ node scripts/main.js
cd examples/foo && npm i && npm run build && cd ../..
export INPUT_ENTRY_POINTS="
- file: src/index.ts
docsReporter: api-extractor
docsReporter: typedoc
docsGenerator: typedoc-markdown
- file: examples/foo/index.ts
docsReporter: api-extractor
docsReporter: typedoc
docsGenerator: typedoc-markdown
"
node scripts/main.js
Expand All @@ -182,7 +182,7 @@ that you have in your local environment without needing to setup and wait for a
real GH action execution.

```sh
docker build -f Dockerfile . --tag tbdocs-app:latest
docker build -f Dockerfile . --tag tbdocs:latest
# now from the repo you want to analyze & generate docs
# below is an example of running it from the root of tbdex-js repo
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 22 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"simple-git": "^3.20.0",
"ts-is-present": "^1.2.2",
"tsconfck": "^2.1.2",
"typedoc": "^0.25.2",
"typedoc": "^0.25.7",
"typedoc-plugin-markdown": "^3.16.0",
"yaml": "^2.3.3"
},
Expand Down
12 changes: 9 additions & 3 deletions src/docs-generator/typedoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ export const generateTypedoc = async (

// Set project path if not set before by the doc-reporter
if (!entryPoint.projectPath) {
const entryPointDir = path.dirname(entryPointFile)
const packageJsonPath = lookupFile(entryPointDir, 'package.json')
entryPoint.projectPath = packageJsonPath
const entryPointFileFullPath = path.dirname(
path.join(process.cwd(), entryPointFile)
)
const packageJsonFullPath = lookupFile(
'package.json',
entryPointFileFullPath
)
const projectPath = path.dirname(packageJsonFullPath)
entryPoint.projectPath = projectPath
}

const { tsconfigFile } = await loadTsconfigProps(entryPoint.projectPath)
Expand Down
3 changes: 3 additions & 0 deletions src/docs-report/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FilesDiffsMap, isSourceInChangedScope } from '../utils'
import { EntryPoint } from '../interfaces'
import { generateApiExtractorReport } from './api-extractor'
import { generateTypedocReport } from './typedoc'
import { DocsReport } from './interfaces'

export * from './report-markdown'
Expand All @@ -26,6 +27,8 @@ const generateReport = async (
ignoreMessages?: string[]
): Promise<DocsReport> => {
switch (entryPoint.docsReporter) {
case 'typedoc':
return generateTypedocReport(entryPoint, ignoreMessages)
case 'api-extractor':
return generateApiExtractorReport(entryPoint, ignoreMessages)
default:
Expand Down
2 changes: 1 addition & 1 deletion src/docs-report/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @public
**/
export type DocsReporterType = 'api-extractor'
export type DocsReporterType = 'api-extractor' | 'typedoc'

/**
* Object containing the result of running the docs reporter.
Expand Down
Loading

0 comments on commit bf0bd1b

Please sign in to comment.