|
1 | | -# apidocs |
| 1 | +# @inrupt/solid-client API Documentation |
2 | 2 |
|
3 | | -Builds the API docs site from generated api \*.md files. |
| 3 | +This directory contains the TypeScript API documentation setup for the `@inrupt/solid-client` library. |
4 | 4 |
|
5 | | -## To Build |
| 5 | +## Documentation Structure |
6 | 6 |
|
7 | | -To build: |
| 7 | +- `docs/dist/`: Generated HTML documentation (output of TypeDoc) |
| 8 | +- `typedoc.config.json`: Configuration for TypeDoc in the root directory |
8 | 9 |
|
9 | | -0. Prereq: [python3](https://www.python.org/downloads/), [Node.js](https://nodejs.org/). |
| 10 | +## Building Documentation |
10 | 11 |
|
11 | | -1. Optional but recommended. Create a virtual env: |
| 12 | +To build the documentation locally: |
12 | 13 |
|
13 | | - ```sh |
14 | | - python3 -m venv <path to the new virtual environment> |
15 | | - source <path to the new virtual environment>/bin/activate |
16 | | - ``` |
| 14 | +```bash |
| 15 | +# Install dependencies |
| 16 | +npm ci |
17 | 17 |
|
18 | | -2. Install the dependencies: |
| 18 | +# Build documentation |
| 19 | +npm run docs:build |
19 | 20 |
|
20 | | - ```sh |
21 | | - npm ci |
22 | | - npm run docs:install |
23 | | - ``` |
| 21 | +# Preview documentation on http://localhost:8080 |
| 22 | +npm run docs:preview |
| 23 | +``` |
24 | 24 |
|
25 | | -3. Generate the docs source files and build the site: |
| 25 | +## Documentation Configuration |
26 | 26 |
|
27 | | - ```sh |
28 | | - npm run docs:build |
29 | | - ``` |
| 27 | +The TypeDoc configuration is isolated in `typedoc.config.json` in the project root to allow for easy reuse across repositories. The key aspects of the configuration include: |
30 | 28 |
|
31 | | -4. If you want to preview the docs site, you can use: |
| 29 | +- **Entry Points**: Explicitly lists all the source files that should be documented |
| 30 | +- **Exclusions**: Specifies files to exclude from documentation (tests, internal files) |
| 31 | +- **Theme**: Uses the default TypeDoc theme for HTML output |
| 32 | +- **Output**: Generates documentation to `docs/dist/` |
32 | 33 |
|
33 | | - ```sh |
34 | | - npm run docs:preview |
35 | | - ``` |
| 34 | +## Deployment |
36 | 35 |
|
37 | | -5. If you'd like to clean the generated docs and start fresh, you can use: |
| 36 | +The documentation is automatically built and deployed to GitHub Pages when changes are pushed to the main branch or when documentation-related files are modified. |
38 | 37 |
|
39 | | - ```sh |
40 | | - npm run docs:clean |
41 | | - ``` |
| 38 | +The GitHub Action workflow (`.github/workflows/docs.yml`) handles: |
| 39 | +1. Building the documentation using the TypeDoc configuration |
| 40 | +2. Deploying the generated HTML to GitHub Pages |
42 | 41 |
|
43 | | -When finished, can deactivate your virtual env. |
| 42 | +## Customizing for Other Repositories |
44 | 43 |
|
45 | | -## Third Party Licenses |
| 44 | +To use this documentation setup in other `@inrupt` repositories: |
46 | 45 |
|
47 | | -The `requirements.txt` lists the 3rd party libraries used for the docs. |
48 | | -For the licenses, see the shared |
49 | | -[inrupt/docs-assets](https://github.com/inrupt/docs-assets#readme). |
| 46 | +1. Copy `typedoc.config.json` to the target repository |
| 47 | +2. Update the entry points to match the repository's structure |
| 48 | +3. Copy the scripts from `package.json`: |
| 49 | + - `docs:clean`: Cleans previous documentation |
| 50 | + - `docs:build`: Builds documentation with TypeDoc |
| 51 | + - `docs:preview`: Starts a local server to preview documentation |
| 52 | +4. Copy the GitHub Action workflow from `.github/workflows/docs.yml` |
| 53 | + |
| 54 | +## Future Improvements |
| 55 | + |
| 56 | +For shared configuration across repositories, consider: |
| 57 | + |
| 58 | +1. Creating an `@inrupt/internal-typedoc-config` package with: |
| 59 | + - Base TypeDoc configuration |
| 60 | + - Common themes and plugins |
| 61 | + - Shared GitHub Actions workflow templates |
| 62 | + |
| 63 | +2. Each repository would then extend the base configuration with its specific entry points and customize as needed. |
0 commit comments