Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke typedoc to produce browsable JS API documentation #4757

Merged
merged 23 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
abe8aad
Clean up javadoc, adding link references where appropriate
niloc132 Nov 7, 2023
bc8e69f
Correct jsinterop annotations
niloc132 Nov 7, 2023
bf31ca7
First draft of generating js api docs from ts
niloc132 Apr 13, 2023
2fdaa79
Correct cli flags for generating docs
niloc132 Aug 7, 2023
0b22425
quick and dirty ts/js doc deployment
niloc132 Aug 7, 2023
365ae3b
Add support for more ts types
niloc132 Aug 10, 2023
6a77af2
Switch to javadoc-based generation
niloc132 Oct 21, 2023
7167461
Tidy up javadoc
niloc132 Oct 25, 2023
d730039
Correctly pin versions for typedoc
niloc132 Oct 25, 2023
219a667
Also package tarball from types
niloc132 Oct 26, 2023
1f17332
Tidy up javadoc a bit, prep for release
niloc132 Nov 1, 2023
04c6841
Update args to improve output
niloc132 Nov 1, 2023
0bccc97
Clean up typedoc deploy content, apply custom dark theme
niloc132 Nov 1, 2023
26071d9
Update to new release
niloc132 Nov 1, 2023
5e4c15e
Remove old processor that we don't need any more
niloc132 Nov 1, 2023
c75f2d2
Add missing task dependency
niloc132 Nov 1, 2023
f0b47fd
cleanup for review
niloc132 Nov 7, 2023
091a8cf
Merge branch 'main' into typedoc
niloc132 Nov 16, 2023
665db2d
Move typedoc to its own separate job
niloc132 Nov 17, 2023
0950b0f
Temp commit, switch branch to build and disable other doc jobs+rsync
niloc132 Nov 17, 2023
4ffdacd
Revert "Temp commit, switch branch to build and disable other doc job…
niloc132 Nov 17, 2023
76607ff
Set job-id to a unique value for typedoc
niloc132 Nov 17, 2023
7b3c709
Correct another copy/paste
niloc132 Nov 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,57 @@ jobs:
remote_user: ${{ secrets.DOCS_USER }}
remote_key: ${{ secrets.DEEPHAVEN_CORE_SSH_KEY }}

typedoc:
runs-on: ubuntu-22.04
concurrency:
group: typedoc-${{ github.workflow }}-${{ github.ref }}
# We don't want to cancel in-progress jobs against main because that might leave the upload in a bad state.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup JDK 11
id: setup-java-11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

- name: Setup JDK 17
id: setup-java-17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV

- name: Run typedoc on JS API
uses: burrunan/gradle-cache-action@v1
with:
job-id: typedoc
arguments: --scan :web-client-api:types:typedoc
gradle-version: wrapper
- name: Upload JavaScript/TypeScript docs
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v3
with:
name: typedoc
path: 'web/client-api/types/build/documentation/'
- name: Deploy JavaScript/TypeScript docs
if: ${{ github.ref == 'refs/heads/main' }}
uses: burnett01/[email protected]
with:
switches: -avzr --delete
path: web/client-api/docs/build/documentation/
remote_path: deephaven-core/client-api/javascript/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if remote path needs to exist before this job is run, just FYI. Obv sync expectations w/ deephaven.io.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not following - how could this be omitted, where would the CI job rsync the data to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - didn't mean to imply you don't need to set remote_path. I'm not sure if the physical "remote path" needs to exist or not before this job will succeed. Just commenting on the fact that there is some coordination w/ deephaven.io that will be necessary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will verify with docs team.

Copy link
Member

@mofojed mofojed Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a ticket for this in the docs repo?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running it creates the folder, nothing needs to be done. You should create a ticket to add a link in the sidebar back to this though once it merges though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do that in a few minutes after seeing if I broke main...

remote_host: ${{ secrets.DOCS_HOST }}
remote_port: ${{ secrets.DOCS_PORT }}
remote_user: ${{ secrets.DOCS_USER }}
remote_key: ${{ secrets.DEEPHAVEN_CORE_SSH_KEY }}

pydoc:
runs-on: ubuntu-22.04
concurrency:
Expand Down
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ Closure configureWebModule = {

webMods.collect({ project(":$it")}).each configureWebModule

include ':web-client-api:types'
project(':web-client-api:types').projectDir = file('web/client-api/types')


buildCache {
local {
removeUnusedEntriesAfterDays = 4
Expand Down
19 changes: 17 additions & 2 deletions web/client-api/client-api.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ apply from: "$rootDir/gradle/web-client.gradle"

configurations {
js
dts
typescriptDoclet
}

dependencies {
implementation project(':web-shared-beans')
implementation project(':web-client-backplane')

implementation 'com.vertispan.tsdefs:jsinterop-ts-defs-annotations:1.0.0-RC2'
annotationProcessor 'com.vertispan.tsdefs:jsinterop-ts-defs-processor:1.0.0-RC2'
implementation 'com.vertispan.tsdefs:jsinterop-ts-defs-annotations:1.0.0-RC3'
typescriptDoclet 'com.vertispan.tsdefs:jsinterop-ts-defs-doclet:1.0.0-RC3'

implementation 'com.vertispan.nio:gwt-nio:1.0-alpha-1'

Expand All @@ -36,10 +38,23 @@ def gwtOutput = tasks.register('gwtOutput', Sync) {
into jsOutput
}

def dtsOutput = layout.buildDirectory.dir('ts-types');
def tsDefs = tasks.register('typescriptDefinitions', Javadoc) {
dependsOn 'compileJava'
source = sourceSets.main.allJava
options.classpath = sourceSets.main.compileClasspath.files as List
destinationDir = dtsOutput.get().asFile
options.docletpath = (configurations.typescriptDoclet.files as List) + (sourceSets.main.compileClasspath.files as List)
options.doclet = 'com.vertispan.tsdefs.doclet.TsDoclet'
}

artifacts {
js(jsOutput) {
builtBy gwtOutput
}
dts(dtsOutput) {
builtBy tsDefs
}
}

project.tasks.getByName('quick').dependsOn project.tasks.withType(de.esoco.gwt.gradle.task.GwtCompileTask)
Expand Down
52 changes: 52 additions & 0 deletions web/client-api/types/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
plugins {
id 'com.bmuschko.docker-remote-api'
id 'io.deephaven.project.register'
}

configurations {
dts
}
dependencies {
dts project(path: ':web-client-api', configuration: 'dts')
}

Docker.registerDockerTask(project, 'typedoc') {
copyIn {
from(configurations.dts) {
into 'dist'
}
from 'tsconfig.json'
from 'package.json'
from 'package-lock.json'

from('src/main/docker') {
include 'theme.css'
}
}
dockerfile {
// share the common base image to keep it simple
from 'deephaven/node:local-build'

copyFile('.', '/project')

runCommand('''set -eux; \\
cd /project/; \\
mv dist/types.d.ts dist/index.d.ts; \\
npm ci; \\
npm pack; \\
mkdir /out; \\
mv deephaven-jsapi-types*.tgz /out/; \\
node_modules/.bin/typedoc dist/index.d.ts \\
--out /out/documentation \\
--skipErrorChecking \\
--hideGenerator \\
--disableSources \\
--customCss theme.css; \\
''')
}
parentContainers = [ Docker.registryTask(project, 'node') ] // deephaven/node
containerOutPath = '/out'
copyOut {
into "$buildDir/"
}
}
1 change: 1 addition & 0 deletions web/client-api/types/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.deephaven.project.ProjectType=BASIC
96 changes: 96 additions & 0 deletions web/client-api/types/package-lock.json

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

27 changes: 27 additions & 0 deletions web/client-api/types/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@deephaven/jsapi-types",
"version": "1.0.0-dev1",
"description": "Deephaven JSAPI Types",
"author": "Deephaven Data Labs LLC",
"license": "Apache-2.0",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/deephaven/deephaven-core.git",
"directory": "web/client-api/types"
},
"engines": {
"node": ">=16"
},
"devDependencies": {
"typedoc": "^0.24.8",
"typescript": "^5.1.6"
},
"files": [
"dist"
],
"sideEffects": false,
"publishConfig": {
"access": "public"
}
}
18 changes: 18 additions & 0 deletions web/client-api/types/src/main/docker/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
:root {
--dark-color-background: #040427;
--dark-color-background-secondary: #0d1b37;
--dark-color-background-warning: #fffbef;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are these colours coming from? This one in particular I can't see referenced anywhere else in the code base.
Pretty sure we should match the colours from other docs (defined in root.scss). @dsmmcken ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deephaven.io colors.

--dark-color-warning-text: #463b19;
--dark-color-accent: #24405a;
--dark-color-active-menu-item: #2f546c;
--dark-color-text: #f0f9fb;
--dark-color-text-aside: #d3d3d3;
--dark-color-link: #65c6da;
--dark-color-ts-project: #b7a9f6;
--dark-color-ts-enum: #f4d93e;
--dark-color-ts-variable: #b2e3ed;
--dark-color-ts-function: #d5cdfa;
--dark-color-ts-class: #93d7e5;
--dark-color-ts-interface: #afd685;
--dark-color-ts-type-alias: #f27596;
}
7 changes: 7 additions & 0 deletions web/client-api/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files": ["dist/index.d.ts"],
"compilerOptions": {
"target": "es5",
"lib": ["es5","es2015", "DOM"]
}
}
Loading