Skip to content

Commit 6e19415

Browse files
authored
chore: add api docs in mkdocs build (aws-powertools#3715)
1 parent a0795fc commit 6e19415

File tree

10 files changed

+113
-27
lines changed

10 files changed

+113
-27
lines changed

.github/workflows/reusable_publish_docs.yml

-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ jobs:
8282
run: |
8383
rm -rf site
8484
mkdocs build
85-
- name: Build API docs
86-
run: |
87-
rm -rf api
88-
npm run docs-generateApiDoc
8985
- name: Configure AWS credentials
9086
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
9187
with:

CONTRIBUTING.md

+29-3
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,35 @@ GitHub provides additional document on [forking a repository](https://help.githu
115115

116116
You might find useful to run both the documentation website and the API reference locally while contributing:
117117

118-
- **Docs website**: `npm run docs-runLocalDocker`
119-
- If this is your first time running the docs, you need to build the image: `npm run docs-buildDockerImage`
120-
- **API reference**: `npm run docs-api-build-run`
118+
#### Using Docker (recommended)
119+
120+
1. Build the Docker image (only needed the first time):
121+
122+
```bash
123+
npm run docs:docker:build
124+
```
125+
126+
2. Run the documentation website:
127+
128+
```bash
129+
npm run docs:docker:run
130+
```
131+
132+
#### Using Python directly
133+
134+
If you have Python 3.x installed, you can run the documentation website and API reference locally without Docker:
135+
136+
1. Create a virtual environment and install dependencies:
137+
138+
```bash
139+
npm run docs:local:setup
140+
```
141+
142+
2. Run the documentation website:
143+
144+
```bash
145+
npm run docs:local:run
146+
```
121147

122148
## Conventions
123149

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- markdownlint-disable MD013 -->
2-
# Powertools for AWS Lambda (TypeScript) <!-- omit in toc -->
2+
# Powertools for AWS Lambda (TypeScript)
33

44
![NodeSupport](https://img.shields.io/static/v1?label=node&message=%2018|%2020|%2022&color=green?style=flat-square&logo=node)
55
![GitHub Release](https://img.shields.io/github/v/release/aws-powertools/powertools-lambda-typescript?style=flat-square)

docs/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# version 9.5.35
22
FROM squidfunk/mkdocs-material@sha256:047452c6641137c9caa3647d050ddb7fa67b59ed48cc67ec3a4995f3d360ab32
33

4+
# Install Node.js
5+
RUN apk add --no-cache nodejs=20.15.1-r0 npm
6+
47
COPY requirements.txt /tmp/
58
RUN pip install --require-hashes -r /tmp/requirements.txt

docs/contributing/setup.md

+30-4
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,36 @@ You can use `npm run setup-local` to install all dependencies locally and setup
6565
!!! note "Curious about what `setup-local` does under the hood?"
6666
We use npm scripts to [automate common tasks](https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/package.json#L24){target="_blank" rel="nofollow"} locally and in Continuous Integration environments.
6767

68-
## Local documentation
68+
### Local documentation
6969

7070
You might find useful to run both the documentation website and the API reference locally while contributing:
7171

72-
* **Docs website**: `npm run docs-runLocalDocker`
73-
* If this is your first time running the docs, you need to build the image: `npm run docs-buildDockerImage`
74-
* **API reference**: `npm run docs-api-build-run`
72+
#### Using Docker (recommended)
73+
74+
1. Build the Docker image (only needed the first time):
75+
76+
```bash
77+
npm run docs:docker:build
78+
```
79+
80+
2. Run the documentation website:
81+
82+
```bash
83+
npm run docs:docker:run
84+
```
85+
86+
#### Using Python directly
87+
88+
If you have Python installed, you can run the documentation website and API reference locally without Docker:
89+
90+
1. Create a virtual environment and install dependencies:
91+
92+
```bash
93+
npm run docs:local:setup
94+
```
95+
96+
2. Run the documentation website:
97+
98+
```bash
99+
npm run docs:local:run
100+
```

docs/requirements.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mike==1.1.2
22
mkdocs-material==9.6.7
33
mkdocs-git-revision-date-plugin==0.3.2
4-
mkdocs-exclude==1.0.2
4+
mkdocs-exclude==1.0.2
5+
mkdocs-typedoc==1.0.4

docs/requirements.txt

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.12
2+
# This file is autogenerated by pip-compile with Python 3.13
33
# by the following command:
44
#
5-
# pip-compile --generate-hashes --output-file=requirements.txt requirements.in
5+
# pip-compile --generate-hashes --output-file=docs/requirements.txt docs/requirements.in
66
#
77
babel==2.16.0 \
88
--hash=sha256:368b5b98b37c06b7daf6696391c3240c938b37767d4584413e8438c5c435fa8b \
@@ -224,7 +224,7 @@ mergedeep==1.3.4 \
224224
mike==1.1.2 \
225225
--hash=sha256:4c307c28769834d78df10f834f57f810f04ca27d248f80a75f49c6fa2d1527ca \
226226
--hash=sha256:56c3f1794c2d0b5fdccfa9b9487beb013ca813de2e3ad0744724e9d34d40b77b
227-
# via -r requirements.in
227+
# via -r docs/requirements.in
228228
mkdocs==1.6.1 \
229229
--hash=sha256:7b432f01d928c084353ab39c57282f29f92136665bdd6abf7c1ec8d822ef86f2 \
230230
--hash=sha256:db91759624d1647f3f34aa0c3f327dd2601beae39a366d6e064c03468d35c20e
@@ -233,24 +233,29 @@ mkdocs==1.6.1 \
233233
# mkdocs-exclude
234234
# mkdocs-git-revision-date-plugin
235235
# mkdocs-material
236+
# mkdocs-typedoc
236237
mkdocs-exclude==1.0.2 \
237238
--hash=sha256:ba6fab3c80ddbe3fd31d3e579861fd3124513708271180a5f81846da8c7e2a51
238-
# via -r requirements.in
239+
# via -r docs/requirements.in
239240
mkdocs-get-deps==0.2.0 \
240241
--hash=sha256:162b3d129c7fad9b19abfdcb9c1458a651628e4b1dea628ac68790fb3061c60c \
241242
--hash=sha256:2bf11d0b133e77a0dd036abeeb06dec8775e46efa526dc70667d8863eefc6134
242243
# via mkdocs
243244
mkdocs-git-revision-date-plugin==0.3.2 \
244245
--hash=sha256:2e67956cb01823dd2418e2833f3623dee8604cdf223bddd005fe36226a56f6ef
245-
# via -r requirements.in
246+
# via -r docs/requirements.in
246247
mkdocs-material==9.6.7 \
247248
--hash=sha256:3e2c1fceb9410056c2d91f334a00cdea3215c28750e00c691c1e46b2a33309b4 \
248249
--hash=sha256:8a159e45e80fcaadd9fbeef62cbf928569b93df954d4dc5ba76d46820caf7b47
249-
# via -r requirements.in
250+
# via -r docs/requirements.in
250251
mkdocs-material-extensions==1.3.1 \
251252
--hash=sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443 \
252253
--hash=sha256:adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31
253254
# via mkdocs-material
255+
mkdocs-typedoc==1.0.4 \
256+
--hash=sha256:839b54c51a64bbb77c1c253eb81baad12462ea5cf38d361e262f5cfa8a45567a \
257+
--hash=sha256:a9601d6b04ed4fd5658c7170c58a3a52f584357be2a3c1e39995c6eed3712b1e
258+
# via -r docs/requirements.in
254259
packaging==24.1 \
255260
--hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \
256261
--hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124

examples/snippets/validation/.gitignore

Whitespace-only changes.

mkdocs.yml

+32-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,35 @@ site_author: Amazon Web Services
44
repo_url: https://github.com/aws-powertools/powertools-lambda-typescript
55
edit_uri: edit/main/docs
66
site_url: https://docs.powertools.aws.dev/lambda/typescript
7+
watch: [
8+
docs,
9+
packages/batch/src,
10+
examples/snippets/batch,
11+
packages/commons/src,
12+
packages/event-handler/src,
13+
examples/snippets/event-handler,
14+
packages/idempotency/src,
15+
examples/snippets/idempotency,
16+
packages/jmespath/src,
17+
examples/snippets/jmespath,
18+
packages/logger/src,
19+
examples/snippets/logger,
20+
packages/metrics/src,
21+
examples/snippets/metrics,
22+
packages/parameters/src,
23+
examples/snippets/parameters,
24+
packages/parser/src,
25+
examples/snippets/parser,
26+
packages/tracer/src,
27+
examples/snippets/tracer,
28+
packages/validation/src,
29+
examples/snippets/validation,
30+
]
731

832
nav:
933
- Homepage:
1034
- index.md
1135
- Changelog: changelog.md
12-
- API reference: api/" target="_blank
1336
- Upgrade guide: upgrade.md
1437
- We Made This (Community): we_made_this.md
1538
- Workshop: https://s12d.com/powertools-for-aws-lambda-workshop" target="_blank
@@ -23,6 +46,7 @@ nav:
2346
- utilities/batch.md
2447
- utilities/jmespath.md
2548
- utilities/parser.md
49+
- API reference: api"
2650
- Processes:
2751
- Roadmap: roadmap.md
2852
- Versioning policy: versioning.md
@@ -101,7 +125,7 @@ markdown_extensions:
101125
- pymdownx.tasklist:
102126
custom_checkbox: true
103127

104-
copyright: Copyright &copy; 2023 Amazon Web Services
128+
copyright: Copyright &copy; 2025 Amazon Web Services
105129

106130
plugins:
107131
- privacy
@@ -112,6 +136,12 @@ plugins:
112136
- snippets/node_modules/*
113137
- snippets/package.json
114138
- snippets/CHANGELOG.md
139+
- typedoc:
140+
source: '.'
141+
output_dir: 'api'
142+
tsconfig: 'tsconfig.json'
143+
options: 'typedoc.json'
144+
name: 'API Reference'
115145

116146
extra_css:
117147
- stylesheets/extra.css

package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@
2727
"commit": "commit",
2828
"setup-local": "npm ci && npm run build && husky",
2929
"build": "npm run build -ws",
30-
"docs-website-build-run": "npm run docs-buildDockerImage && npm run docs-runLocalDocker",
31-
"docs-buildDockerImage": "docker build -t powertools-typescript/docs ./docs/",
32-
"docs-runLocalDocker": "docker run --rm -it -p 8000:8000 -v ${PWD}:/docs powertools-typescript/docs",
33-
"docs-api-build-run": "npm run docs-generateApiDoc && npx live-server api",
34-
"docs-generateApiDoc": "typedoc .",
35-
"docs-runLocalApiDoc": "npx live-server api",
30+
"docs:docker:build": "docker build -t powertools-typescript/docs ./docs/",
31+
"docs:docker:run": "docker run --rm -it -p 8000:8000 -v ${PWD}:/docs powertools-typescript/docs",
32+
"docs:local:setup": "python3 -m venv .venv && .venv/bin/pip install -r docs/requirements.txt",
33+
"docs:local:run": ".venv/bin/mkdocs serve",
34+
"docs:local:api": "typedoc .",
3635
"postpublish": "git restore .",
3736
"lint:markdown": "markdownlint-cli2 '**/*.md' '#node_modules' '#**/*/node_modules' '#docs/changelog.md' '#LICENSE.md' '#.github' '#**/*/CHANGELOG.md' '#examples/app/README.md'"
3837
},

0 commit comments

Comments
 (0)