Skip to content

Commit

Permalink
Add TypeDoc documentation generation
Browse files Browse the repository at this point in the history
Add `npm run docs` to generate documentation in `./docs/` for all of our
package groups as well as a static page on "Why Ninjutsu Build?".

This will be a good starting point to review and improve the
documentation as a whole and publish it to Github pages.
  • Loading branch information
elliotgoodrich committed Jul 1, 2024
1 parent 857c484 commit bd025b0
Show file tree
Hide file tree
Showing 15 changed files with 196 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ jobs:
- run: cd configure && npm ci
- run: npm run configure
- run: ninja -k 0
- run: npm run docs
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ node_modules
.vscode
.builddir
build.ninja

125 changes: 123 additions & 2 deletions configure/package-lock.json

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

3 changes: 2 additions & 1 deletion configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@types/node": "^20.12.7",
"@types/toposort": "^2.0.7",
"glob": "^10.3.10",
"is-ci": "^3.0.1"
"is-ci": "^3.0.1",
"typedoc": "^0.26.3"
}
}
15 changes: 15 additions & 0 deletions configure/typedoc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "@ninjutsu-build",
"out": "../docs",
"entryPoints": [
"../guides",
"../packages/biome",
"../packages/bun",
"../packages/core",
"../packages/esbuild",
"../packages/node",
"../packages/tsc"
],
"entryPointStrategy": "packages"
}
16 changes: 16 additions & 0 deletions guides/Why Ninjutsu Build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Why Choose Ninjutsu Build?

Ninjutsu Build is a collection of packages designed to help create a `.ninja` file. This file outlines all dependencies between inputs and outputs in your projects, along with the necessary shell commands to generate those files.

The [`ninja`](https://ninja-build.org/) executable reads this file. Known for its speed, Ninja is used to build large C++ applications like [Chromium](https://chromium.googlesource.com/chromium/src/+/main/docs/linux/build_instructions.md#setting-up-the-build) and [LLVM](https://www.llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm).

Using Ninjutsu Build, you orchestrate your build process with JavaScript while executing it with `ninja`. This approach combines JavaScript's flexibility with the speed of a native build orchestrator. Modern tools for transpiling TypeScript to JavaScript allow you to separate typechecking and type generation from running tests, providing faster feedback during development.

After making changes to files, `ninja` will identifies which output files are outdated and determines the quickest way to update them. For instance, the Ninjutsu `node` plugin tracks all JavaScript files imported during each test run, so after modifying one file, `ninja` will only rerun the subset of tests that imported that file.

Consider using Ninjutsu Build if:

* You are dissatisfied with the large number of `package.json` scripts.
* You have non-standard build steps.
* You already use a JavaScript/TypeScript script to orchestrate your build but seek improved performance or better dependency tracking.
* You want to integrate formatting, linting, transpiling, and/or typechecking into the same build command.
2 changes: 2 additions & 0 deletions guides/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
5 changes: 5 additions & 0 deletions guides/typedoc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "Guides",
"projectDocuments": ["./*.md"]
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
],
"scripts": {
"build": "ninja",
"configure": "node configure/configure.mjs"
"configure": "node configure/configure.mjs",
"docs": "cd configure && npx typedoc"
}
}
5 changes: 5 additions & 0 deletions packages/biome/typedoc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "biome",
"entryPoints": ["./src/biome.ts"],
}
5 changes: 5 additions & 0 deletions packages/bun/typedoc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "bun",
"entryPoints": ["./src/bun.ts"],
}
5 changes: 5 additions & 0 deletions packages/core/typedoc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "core",
"entryPoints": ["./src/core.ts"],
}
5 changes: 5 additions & 0 deletions packages/esbuild/typedoc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "esbuild",
"entryPoints": ["./src/esbuild.ts"],
}
5 changes: 5 additions & 0 deletions packages/node/typedoc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "node",
"entryPoints": ["./src/node.ts", "./src/runtime.cts"],
}
5 changes: 5 additions & 0 deletions packages/tsc/typedoc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "tsc",
"entryPoints": ["./src/tsc.ts"]
}

0 comments on commit bd025b0

Please sign in to comment.