Skip to content

New: Static docs builds without app startup (fixes #47)#48

Merged
taylortom merged 7 commits into
masterfrom
issue/47-static-docs-build
Feb 27, 2026
Merged

New: Static docs builds without app startup (fixes #47)#48
taylortom merged 7 commits into
masterfrom
issue/47-static-docs-build

Conversation

@taylortom

Copy link
Copy Markdown
Collaborator

New

  • Added StaticAppContext class (lib/StaticAppContext.js) that replaces App.instance by scanning the filesystem for module configs, routes, schemas, errors and permissions — enabling docs to be built without starting the full app

Update

  • Rewrote bin/docgen.js to use StaticAppContext instead of App, accepting --rootDir and --outputDir CLI args
  • Rewrote bin/docserve.js to accept --outputDir, --port, and --open CLI args without requiring the app to start
  • Moved adapt-authoring-core from peerDependencies to dependencies (still uses loadDependencyFiles and readJson utilities)
  • Added path-to-regexp dependency (for building permission route regexes)

Testing

  1. cd docs && npm test — all 70 tests pass (25 new + 45 existing)
  2. node bin/docgen.js --rootDir /path/to/adapt-authoring --outputDir /tmp/docs-test — builds all docs without starting the app
  3. node bin/docserve.js --outputDir /tmp/docs-test — serves docs on port 9000
  4. npx standard — linting passes

Replace App.instance with StaticAppContext that scans the filesystem
for module configs, routes, schemas, errors and permissions. Docs can
now be built with `node bin/docgen.js --rootDir <path>` without
starting the full authoring tool.
Refactor the static docs build to use plain exported functions in
lib/docsData.js instead of a class that mimics App.instance. docgen.js
now calls the helpers directly and assembles the app object inline.
Swagger reads app.routerTree, app.schemas, app.permissions directly
instead of going through waitForModule/dependencyloader. The app object
assembled in docgen.js no longer needs onReady or dependencyloader.
A temporary waitForModule shim remains for the jsonschema docs plugin.
The errors plugin expects { code, statusCode, meta: { description } }
matching the runtime AdaptError instances. Transform raw JSON error
definitions into this shape so the errors doc plugin works correctly.
@taylortom
taylortom merged commit c676054 into master Feb 27, 2026
2 checks passed
@taylortom
taylortom deleted the issue/47-static-docs-build branch February 27, 2026 19:02
github-actions Bot pushed a commit that referenced this pull request Feb 27, 2026
# [1.4.0](v1.3.1...v1.4.0) (2026-02-27)

### Chore

* Change workflow name ([ce313e9](ce313e9))

### Fix

* bump adapt-authoring-core dependency to ^2.0.0 ([6dd4e6f](6dd4e6f))
* remove lockfile and peerDependenciesMeta, add .npmrc ([d86d8eb](d86d8eb))

### New

* Static docs builds without app startup (fixes #47) (#48) ([c676054](c676054)), closes [#47](#47) [#48](#48)
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant