Skip to content

Commit

Permalink
Regenerate full documentation (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Garber committed Jul 3, 2023
1 parent 977adc7 commit 3b4a1bb
Show file tree
Hide file tree
Showing 38 changed files with 745 additions and 458 deletions.
22 changes: 0 additions & 22 deletions .ts-for-girrc.js

This file was deleted.

555 changes: 278 additions & 277 deletions .yarn/releases/yarn-3.5.0.cjs → .yarn/releases/yarn-3.6.0.cjs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
nodeLinker: node-modules

packageExtensions:
"@types/body-parser@*":
dependencies:
Expand Down Expand Up @@ -69,8 +71,6 @@ packageExtensions:
"@gjsify/typedoc-plugin-remote-search": "*"
"@gjsify/typedoc-theme": "*"

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"
Expand All @@ -79,4 +79,4 @@ plugins:

pnpMode: loose

yarnPath: .yarn/releases/yarn-3.5.0.cjs
yarnPath: .yarn/releases/yarn-3.6.0.cjs
2 changes: 1 addition & 1 deletion @types
Submodule @types updated 2485 files
23 changes: 8 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"version": "0.0.0",
"private": true,
"description": "Monorepo to generate Typescript types and documentations for GJS and node-gtk",
"type": "commonjs",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"reinstall": "YARN_CHECKSUM_BEHAVIOR=update yarn install",
"start": "concurrently --kill-others 'yarn:start:gjs' 'yarn:start:node-gtk'",
"start:gjs": "yarn build:gjs && yarn serve:gjs",
"start:node-gtk": "yarn build:node-gtk && yarn serve:node-gtk",
"start:try:gjs": "yarn build:try:gjs && yarn serve:try:gjs",
"start:gjs": "yarn build:docs:gjs && yarn serve:gjs",
"start:node-gtk": "yarn build:docs:node-gtk && yarn serve:node-gtk",
"start:try:gjs": "yarn build:docs:try:gjs && yarn serve:try:gjs",
"start:try:node-gtk": "yarn build:docs:try:node-gtk && yarn serve:try:node-gtk",
"start:gjs:local": "yarn build:gjs:local && yarn serve:gjs",
"start:node-gtk:local": "yarn build:node-gtk:local && yarn serve:node-gtk",
"start:try:gjs:local": "yarn build:try:gjs:local && yarn serve:try:gjs",
"start:gjs:local": "yarn build:docs:gjs:local && yarn serve:gjs",
"start:node-gtk:local": "yarn build:docs:node-gtk:local && yarn serve:node-gtk",
"start:try:gjs:local": "yarn build:docs:try:gjs:local && yarn serve:try:gjs",
"start:try:node-gtk:local": "yarn build:docs:try:node-gtk:local && yarn serve:try:node-gtk",
"update": "yarn update:submodules",
"update:submodules": "git submodule update --init --recursive && git submodule foreach git pull origin master",
Expand All @@ -28,13 +28,6 @@
"build:docs:try:gjs:local": "yarn clear:docs:try:gjs && yarn workspace @gjsify/typedoc-build-docs run build:try:gjs:local",
"build:docs": "yarn build:docs:gjs && yarn build:docs:node-gtk",
"build:docs:local": "yarn build:docs:gjs:local && yarn build:docs:node-gtk:local",
"build:node-gtk": "yarn build:docs:node-gtk",
"build:try:node-gtk": "yarn build:docs:try:node-gtk",
"build:try:node-gtk:local": "yarn build:docs:try:node-gtk:local",
"build:gjs": "yarn build:docs:gjs",
"build:try:gjs": "yarn build:docs:try:gjs",
"build:gjs:local": "yarn build:docs:gjs:local",
"build:try:gjs:local": "yarn build:docs:try:gjs:local",
"build:packages:typedoc-plugin-remote-search": "yarn workspace @gjsify/typedoc-plugin-remote-search run build",
"build:packages:typedoc-theme": "yarn workspace @gjsify/typedoc-theme run build",
"build:packages:typedoc-theme-client": "yarn workspace @gjsify/typedoc-theme-client run build",
Expand Down Expand Up @@ -135,7 +128,7 @@
"@ribajs/babel-config": "workspace:^",
"@ribajs/strapi": "workspace:^"
},
"packageManager": "yarn@3.5.0",
"packageManager": "yarn@3.6.0",
"dependencies": {
"@gjsify/typedoc-build-docs": "workspace:^",
"@gjsify/typedoc-plugin-remote-search": "workspace:^",
Expand Down
10 changes: 5 additions & 5 deletions packages/typedoc-build-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
"version": "0.0.0",
"description": "JavaScript / TypeScript documentations generator scripts",
"module": "cli.ts",
"type": "commonjs",
"type": "module",
"repository": "https://github.com/gjsify/doc/tree/main/packages/typedoc-build-docs",
"bin": {
"custom-cli": "./dist/cli.js"
},
"scripts": {
"build": "yarn run build:custom-cli",
"start:typedoc-cli": "typedoc --plugin @gjsify/typedoc-theme --plugin @gjsify/typedoc-plugin-remote-search",
"start:ts:custom-cli": "node --expose-gc --max-old-space-size=25600 -r ts-node/register src/cli.ts",
"start:custom-cli": "node --expose-gc --max-old-space-size=25600 dist/cli.js",
"start:typedoc-cli": "NODE_OPTIONS=--max_old_space_size=30720 typedoc --plugin @gjsify/typedoc-theme --plugin @gjsify/typedoc-plugin-remote-search --skipErrorChecking",
"start:ts:custom-cli": "node --expose-gc --max-old-space-size=30720 -r ts-node/register src/cli.ts",
"start:custom-cli": "node --expose-gc --max-old-space-size=30720 dist/cli.js",
"build:custom-cli": "tsc --project ./tsconfig.json && chmod +x ./dist/cli.js",
"watch:custom-cli": "tsc --project ./tsconfig.json --watch",
"build:gjs": "yarn run start:custom-cli --options ./typedoc.gjs.json",
"build:gjs": "yarn run start:typedoc-cli --options ./typedoc.gjs.json",
"build:node-gtk": "yarn run start:custom-cli --options ./typedoc.node-gtk.json",
"build:try:gjs": "yarn run start:typedoc-cli --options ./typedoc.try-gjs.json --serverBaseUrl https://try-gjs-docs.gjsify.org/",
"build:try:node-gtk": "yarn run start:custom-cli --options ./typedoc.try-node-gtk.json --serverBaseUrl https://try-node-gtk-docs.gjsify.org/",
Expand Down
34 changes: 24 additions & 10 deletions packages/typedoc-build-docs/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

// See https://github.com/TypeStrong/typedoc/issues/1403
import { Application, TSConfigReader, TypeDocOptions, LogLevel } from "typedoc";
import { resolve } from "path";
import { mkdirSync } from "fs";
import { resolve } from "node:path";
import { mkdirSync } from "node:fs";
import { readFile } from "node:fs/promises";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { ConsoleLogger } from "./logger";
import { ConsoleLogger } from "./logger.js";

import { createRequire } from "node:module";
const require = createRequire(import.meta.url);

const logger = new ConsoleLogger();
logger.level = LogLevel.Verbose;

Expand All @@ -15,11 +20,16 @@ interface Options {
ignoreErrors?: boolean;
}

const readJson = async (path: string) => {
const file = await readFile(path, "utf8");
return JSON.parse(file);
};

const loadConfigFile = async (typedoc?: string) => {
let config: Partial<TypeDocOptions> = {};
if (typedoc) {
typedoc = resolve(".", typedoc);
const file = await import(typedoc);
const file = await readJson(typedoc);
if (file?.default?.default) {
config = file.default.default;
} else if (file?.default) {
Expand All @@ -39,12 +49,16 @@ async function generate(

const typedocConfigFile = await loadConfigFile(typedoc);

const entryPoints = [ ...(typedocConfigFile.entryPoints || []), ...(typeDocOptions.entryPoints || []) ]
const entryPoints = [
...(typedocConfigFile.entryPoints || []),
...(typeDocOptions.entryPoints || []),
];

typeDocOptions = { ...typedocConfigFile, ...typeDocOptions, entryPoints };
typeDocOptions.plugin = [ ...(typeDocOptions.plugin || []),
typeDocOptions.plugin = [
...(typeDocOptions.plugin || []),
require.resolve("@gjsify/typedoc-theme"),
require.resolve("@gjsify/typedoc-plugin-remote-search")
require.resolve("@gjsify/typedoc-plugin-remote-search"),
];

// If you want TypeDoc to load tsconfig.json file
Expand Down Expand Up @@ -82,19 +96,19 @@ async function start() {
type: "string",
normalize: true,
describe:
"Specify a json option file that should be loaded. If not specified TypeDoc will look for json and js in the current directory. E.g. gjs.js"
"Specify a json option file that should be loaded. If not specified TypeDoc will look for json and js in the current directory. E.g. gjs.js",
})
.option("ignoreErrors", {
type: "boolean",
normalize: true,
describe: "Ignore errors"
describe: "Ignore errors",
})
.help().argv;

await generate(
{
typedoc: argv.options,
ignoreErrors: argv.ignoreErrors
ignoreErrors: argv.ignoreErrors,
},
{}
);
Expand Down
40 changes: 20 additions & 20 deletions packages/typedoc-build-docs/tsconfig.gjs.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"compilerOptions": {
// General settings for code interpretation
"target": "esnext",
"module": "esnext",
"isolatedModules": true,
"allowSyntheticDefaultImports": false,
"experimentalDecorators": true,
"moduleResolution": "node",
"noEmit": true,
"noEmitOnError": false,
"baseUrl": "../../@types/Gjs/",
"rootDir": "../../@types/Gjs",
// General settings for code generation
"removeComments": false,
"inlineSourceMap": false,
"inlineSources": false,
"newLine": "LF"
},
"include": ["../../@types/Gjs"],
"exclude": ["../../@types/Gjs/index.d.ts"]
"compilerOptions": {
// General settings for code interpretation
"target": "esnext",
"module": "esnext",
"isolatedModules": true,
"allowSyntheticDefaultImports": false,
"experimentalDecorators": true,
"moduleResolution": "node",
"noEmit": true,
"noEmitOnError": false,
"baseUrl": "../../@types/",
"rootDir": "../../@types",
// General settings for code generation
"removeComments": false,
"inlineSourceMap": false,
"inlineSources": false,
"newLine": "LF"
},
"include": ["../../@types/**/*.ts"],
"exclude": ["../../@types/node-*/*.ts"]
}
29 changes: 21 additions & 8 deletions packages/typedoc-build-docs/typedoc.gjs.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
{
"out": "../../docs/gjs/",
"readme": "none",
"entryPointStrategy": "packages",
"entryPoints": [
"../../@types/"
"../../@types/*"
],
"includes": "../../@types/**/*",
"exclude:": "../../@types/node-*",
"tsconfig": "./tsconfig.gjs.json",
"entryPointStrategy": "expand",
"externalPattern": "../../@types/node-*",
"excludeExternals": true,
"disableSources": false,
"name": "GJS API Reference",
"name": "GJS API Reference (Try build)",
"noScript": true,
"noReplaceElement": true,
"skipErrorChecking": true,
"includeVersion": true,
"serverBaseUrl": "https://gjs-docs.gjsify.org/",
"theme": "gjsify"
"theme": "gjsify",
"navigation": {
"includeCategories": true,
"includeGroups": true
},
"categorizeByGroup": true,
"visibilityFilters": {
"protected": true,
"private": true,
"inherited": true,
"external": true,
"@alpha": true,
"@beta": true
}
}
2 changes: 2 additions & 0 deletions packages/typedoc-build-docs/typedoc.node-gtk.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"name": "NODE-GTK API Reference",
"noScript": true,
"noReplaceElement": true,
"skipErrorChecking": true,
"includeVersion": true,
"serverBaseUrl": "https://node-gtk-docs.gjsify.org/",
"theme": "gjsify"
}
2 changes: 2 additions & 0 deletions packages/typedoc-build-docs/typedoc.try-gjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"name": "GJS API Reference (Try build)",
"noScript": true,
"noReplaceElement": true,
"skipErrorChecking": true,
"includeVersion": true,
"serverBaseUrl": "https://try-gjs-docs.gjsify.org/",
"theme": "gjsify",
"navigation": {
Expand Down
2 changes: 2 additions & 0 deletions packages/typedoc-build-docs/typedoc.try-node-gtk.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"name": "NODE-GTK API Reference (Try build)",
"noScript": true,
"noReplaceElement": true,
"skipErrorChecking": true,
"includeVersion": true,
"serverBaseUrl": "https://try-node-gtk-docs.gjsify.org/",
"theme": "gjsify"
}
1 change: 1 addition & 0 deletions packages/typedoc-theme-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@types/marked": "^4.3.1",
"concurrently": "^8.2.0",
"sass": "^1.63.4",
"typedoc": "^0.24.8",
"typescript": "^5.1.3",
"vite": "^4.3.9"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
@import "./navbar/navbar.component";
@import "./sidebar-content/sidebar-content.component";
@import "./module-menu/module-menu.component";
@import "./module-navigation/module-navigation.component";
@import "./search/search.component";
3 changes: 2 additions & 1 deletion packages/typedoc-theme-client/scripts/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from "./footer/footer.component";
export * from "./header/header.component";
export * from "./member-signatures/member-signatures.component.js";
export * from "./navbar/navbar.component.js";
export * from "./sidebar-content/sidebar-content.component.js";
export * from "./module-menu/module-menu.component.js";
export * from "./module-navigation/module-navigation.component.js";
export * from "./search/search.component.js";
export * from "./sidebar-content/sidebar-content.component.js";
Loading

0 comments on commit 3b4a1bb

Please sign in to comment.