Use dartdoc package in docs website

This commit is contained in:
Simon Binder 2022-05-13 11:57:03 +02:00
parent 779e2838c5
commit 93a34b6969
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
5 changed files with 14 additions and 8 deletions

View File

@ -14,9 +14,9 @@ builders:
targets: targets:
prepare: prepare:
builders: builders:
"|versions": ":versions":
enabled: true enabled: true
"|code_snippets": ":code_snippets":
enabled: true enabled: true
generate_for: generate_for:
- "lib/snippets/**/*.dart" - "lib/snippets/**/*.dart"
@ -33,7 +33,7 @@ targets:
$default: $default:
dependencies: [":prepare"] dependencies: [":prepare"]
builders: builders:
build_web_compilers|entrypoint: build_web_compilers:entrypoint:
release_options: release_options:
# Turn of null assertions for release builds, it looks like this # Turn of null assertions for release builds, it looks like this
# makes generated code slightly smaller. # makes generated code slightly smaller.

View File

@ -14,9 +14,9 @@ builders:
targets: targets:
prepare: prepare:
builders: builders:
"|versions": ":versions":
enabled: true enabled: true
"|code_snippets": ":code_snippets":
enabled: true enabled: true
generate_for: generate_for:
- "lib/snippets/**/*.dart" - "lib/snippets/**/*.dart"
@ -36,7 +36,7 @@ targets:
built_site: built_site:
release_options: release_options:
environment: "preview" environment: "preview"
build_web_compilers|entrypoint: build_web_compilers:entrypoint:
release_options: release_options:
# Turn of null assertions for release builds, it looks like this # Turn of null assertions for release builds, it looks like this
# makes generated code slightly smaller. # makes generated code slightly smaller.

1
docs/dartdoc.build.yaml Normal file
View File

@ -0,0 +1 @@
# dartdoc has a weird config breaking everything, override!

View File

@ -22,6 +22,8 @@ dev_dependencies:
json_serializable: ^6.1.6 json_serializable: ^6.1.6
shelf: ^1.2.0 shelf: ^1.2.0
shelf_static: ^1.1.0 shelf_static: ^1.1.0
# `dart doc` is missing some options, so we run `dart run dartdoc` instead.
dartdoc: ^5.0.1
code_snippets: code_snippets:
hosted: https://simonbinder.eu hosted: https://simonbinder.eu
version: ^0.0.4 version: ^0.0.4

View File

@ -82,14 +82,17 @@ Future<void> _createApiDocumentation(Directory output) async {
// todo: Use `dart doc` after https://github.com/dart-lang/sdk/issues/46100#issuecomment-1033899215 // todo: Use `dart doc` after https://github.com/dart-lang/sdk/issues/46100#issuecomment-1033899215
// gets clarified. // gets clarified.
final dartDoc = await Process.start( final dartDoc = await Process.start(
'dartdoc', 'dart',
[ [
'run',
'dartdoc',
'--rel-canonical-prefix=https://pub.dev/documentation/drift/latest', '--rel-canonical-prefix=https://pub.dev/documentation/drift/latest',
'--link-to-source-revision=$rev', '--link-to-source-revision=$rev',
'--link-to-source-root=..', '--link-to-source-root=..',
'--link-to-source-uri-template=$source', '--link-to-source-uri-template=$source',
'--input=../drift',
'--output=../drift/doc/api',
], ],
workingDirectory: '../drift',
); );
await _waitForProcess(dartDoc, 'dartdoc'); await _waitForProcess(dartDoc, 'dartdoc');