Skip to content

Commit

Permalink
docs(bindings/nodejs): copyright in footer (#3986)
Browse files Browse the repository at this point in the history
* docs(bindings/nodejs): copyright in footer

Signed-off-by: suyanhanx <suyanhanx@gmail.com>

* fix: header

Signed-off-by: suyanhanx <suyanhanx@gmail.com>

---------

Signed-off-by: suyanhanx <suyanhanx@gmail.com>
  • Loading branch information
suyanhanx authored Jan 15, 2024
1 parent d18782a commit 5628f7c
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ jobs:
working-directory: bindings/nodejs
run: pnpm install --frozen-lockfile

- name: Build docs theme
working-directory: bindings/nodejs
run: pnpm run build:theme

- name: Build bindings/nodejs Docs
working-directory: bindings/nodejs
run: pnpm run docs
Expand Down
4 changes: 3 additions & 1 deletion bindings/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@swc-node/register": "^1.6.2",
"@swc/core": "^1.3.38",
"@types/node": "^18.14.5",
"@types/react": "^18.2.48",
"benny": "^3.7.1",
"dotenv": "^16.0.3",
"prettier": "^2.8.4",
Expand All @@ -65,6 +66,7 @@
"scripts": {
"build": "napi build --platform --features \"${NAPI_FEATURES:-}\" --target \"${NAPI_TARGET:-}\" --release --js generated.js --dts generated.d.ts && node ./scripts/header.js",
"build:debug": "napi build --platform --features \"${NAPI_FEATURES:-}\" --target \"${NAPI_TARGET:-}\" --js generated.js --dts generated.d.ts && node ./scripts/header.js",
"build:theme": "tsc -p ./tsconfig.theme.json",
"docs": "typedoc",
"format": "prettier --write .",
"test": "vitest",
Expand All @@ -75,7 +77,7 @@
"prettier": {
"overrides": [
{
"files": "./**/*.{js,ts,mjs}",
"files": "./**/*.{js,ts,mjs,jsx,tsx}",
"options": {
"arrowParens": "always",
"parser": "typescript",
Expand Down
23 changes: 23 additions & 0 deletions bindings/nodejs/pnpm-lock.yaml

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

54 changes: 54 additions & 0 deletions bindings/nodejs/theme/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { DefaultTheme, PageEvent, Reflection, Options, DefaultThemeRenderContext, Application, JSX } from 'typedoc'

export class FooterWithASFCopyright extends DefaultThemeRenderContext {
constructor(theme: DefaultTheme, page: PageEvent<Reflection>, options: Options) {
super(theme, page, options)

this.footer = () => {
return (
<>
<div class="tsd-generator">
<p>
Copyright © 2022-2024, The Apache Software Foundation Apache OpenDAL, OpenDAL, Apache, Apache Incubator,
the Apache feather, the Apache Incubator logo and the Apache OpenDAL project logo are either registered
trademarks or trademarks of the Apache Software Foundation.
</p>
</div>
</>
) as unknown as JSX.Element
}
}
}

export class FooterOverrideTheme extends DefaultTheme {
private _contextCache?: FooterWithASFCopyright

override getRenderContext(pageEvent: PageEvent<Reflection>): FooterWithASFCopyright {
this._contextCache ||= new FooterWithASFCopyright(this, pageEvent, this.application.options)

return this._contextCache
}
}

export function load(app: Application) {
app.renderer.defineTheme('opendal', FooterOverrideTheme)
}
2 changes: 1 addition & 1 deletion bindings/nodejs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"allowSyntheticDefaultImports": true
},
"include": ["."],
"exclude": ["node_modules", "benchmark"]
"exclude": ["node_modules", "benchmark", "theme"]
}
16 changes: 16 additions & 0 deletions bindings/nodejs/tsconfig.theme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"strict": true,
"esModuleInterop": true,
"outDir": "theme/dist",

"jsx": "react",
"jsxFactory": "JSX.createElement",
"jsxFragmentFactory": "JSX.Fragment"
},
"include": ["theme"]
}
2 changes: 2 additions & 0 deletions bindings/nodejs/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"excludeExternals": true,
"includeVersion": true,
"githubPages": false,
"plugin": ["./theme/dist/index.js"],
"theme": "opendal",
"navigationLinks": {
"Homepage": "https://opendal.apache.org/",
"GitHub": "https://github.com/apache/incubator-opendal/tree/main/bindings/nodejs"
Expand Down

0 comments on commit 5628f7c

Please sign in to comment.