Skip to content

Commit

Permalink
Reference API
Browse files Browse the repository at this point in the history
  • Loading branch information
MaXFeeD committed Mar 21, 2024
1 parent 43e4e7f commit bf57250
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 4 deletions.
3 changes: 3 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Dependencies
node_modules/

# Production
docs/

# Generated files
/media/codicons
/.wireit
17 changes: 14 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
],
"private": true,
"scripts": {
"prebuild-theme": "wireit",
"prebuild-declarations": "wireit",
"typedoc": "wireit",
"build": "wireit"
},
"wireit": {
Expand All @@ -41,8 +43,8 @@
"declarations/core-engine.d.ts"
]
},
"build": {
"command": "typedoc --out ../src/pages/api declarations/core-engine.d.ts",
"typedoc": {
"command": "typedoc declarations/core-engine.d.ts",
"files": [
"typedoc.json",
"tsconfig-typedoc.json",
Expand All @@ -54,7 +56,16 @@
"prebuild-declarations"
],
"output": [
"../src/pages/api"
"docs"
]
},
"build": {
"command": "tsx tools/link_references.ts",
"files": [
"docs/**/*"
],
"dependencies": [
"typedoc"
]
}
},
Expand Down
42 changes: 42 additions & 0 deletions api/tools/link_references.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
Inner Core API: Core Engine API Reference
Copyright (C) 2023 Nernar (https://github.com/nernar)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Maintained and distributed by MaXFeeD ([email protected])
*/

import { join } from 'path';
import { existsSync } from 'fs';
import { symlink, mkdir } from 'fs/promises';

(async () => {
const website = join(__dirname, '..', '..', 'static');
const api = join(website, 'api');
if (!existsSync(api))
{
const target = join(__dirname, '..', 'docs');
if (!existsSync(target))
{
console.error("Run `npm run typedoc` before running symlinking!");
return;
}
await mkdir(website, { recursive: true });
await symlink(target, api, 'dir');
console.info("Successfully symlinked 'api'!");
}
})();
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const config = /** @type {import('@docusaurus/types').Config} */ ({
})
});

const api = path.resolve('src/pages/api');
const api = path.resolve('static/api');

if (fs.existsSync(api) && fs.readdirSync(api).length) {
const themeConfig =
Expand Down

0 comments on commit bf57250

Please sign in to comment.