Skip to content

Commit 2134898

Browse files
authored
feature: jsdoc annotations and generation (#177)
# What Adds the ability to generate a website with reference documentation based on JSDoc annotations in the Javascript code. Annotations are also added. This will help you if you use an editor that knows how to parse JSDoc annotations. **This change adds a workflow that depends on NodeJS** however, normal usage of the gateway will not require NodeJs, nor will any development workflows. In the future, development workflows will require NodeJs. Discussion on this topic here: #163 ## Usage To generate the documentation run: ``` make jsdoc ``` It will be located in the `./reference` folder at the root of the project To generate and view the documentation in a browser, run: ``` make jsdoc-open ``` To remove generated documentation, run: ``` make clean ```
1 parent 28e46e9 commit 2134898

File tree

12 files changed

+3116
-78
lines changed

12 files changed

+3116
-78
lines changed

.gitignore

Lines changed: 262 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,58 @@
1-
# Created by https://www.toptal.com/developers/gitignore/api/intellij
2-
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij
1+
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,node,vim,emacs,macos
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,node,vim,emacs,macos
33

4-
### Intellij ###
4+
### Emacs ###
5+
# -*- mode: gitignore; -*-
6+
*~
7+
\#*\#
8+
/.emacs.desktop
9+
/.emacs.desktop.lock
10+
*.elc
11+
auto-save-list
12+
tramp
13+
.\#*
14+
15+
# Org-mode
16+
.org-id-locations
17+
*_archive
18+
19+
# flymake-mode
20+
*_flymake.*
21+
22+
# eshell files
23+
/eshell/history
24+
/eshell/lastdir
25+
26+
# elpa packages
27+
/elpa/
28+
29+
# reftex files
30+
*.rel
31+
32+
# AUCTeX auto folder
33+
/auto/
34+
35+
# cask packages
36+
.cask/
37+
dist/
38+
39+
# Flycheck
40+
flycheck_*.el
41+
42+
# server auth directory
43+
/server/
44+
45+
# projectiles files
46+
.projectile
47+
48+
# directory configuration
49+
.dir-locals.el
50+
51+
# network security
52+
/network-security.data
53+
54+
55+
### Intellij+all ###
556
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
657
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
758

@@ -12,6 +63,9 @@
1263
.idea/**/dictionaries
1364
.idea/**/shelf
1465

66+
# AWS User-specific
67+
.idea/**/aws.xml
68+
1569
# Generated files
1670
.idea/**/contentModel.xml
1771

@@ -53,6 +107,12 @@ cmake-build-*/
53107
# IntelliJ
54108
out/
55109

110+
# jsdoc build directory
111+
reference/
112+
113+
# minio storage
114+
data/
115+
56116
# mpeltonen/sbt-idea plugin
57117
.idea_modules/
58118

@@ -62,6 +122,9 @@ atlassian-ide-plugin.xml
62122
# Cursive Clojure plugin
63123
.idea/replstate.xml
64124

125+
# SonarLint plugin
126+
.idea/sonarlint/
127+
65128
# Crashlytics plugin (for Android Studio and IntelliJ)
66129
com_crashlytics_export_strings.xml
67130
crashlytics.properties
@@ -74,37 +137,209 @@ fabric.properties
74137
# Android studio 3.1+ serialized cache file
75138
.idea/caches/build_file_checksums.ser
76139

77-
### Intellij Patch ###
78-
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
140+
### Intellij+all Patch ###
141+
# Ignore everything but code style settings and run configurations
142+
# that are supposed to be shared within teams.
143+
144+
.idea/*
145+
146+
!.idea/codeStyles
147+
!.idea/runConfigurations
148+
149+
### macOS ###
150+
# General
151+
.DS_Store
152+
.AppleDouble
153+
.LSOverride
154+
155+
# Icon must end with two \r
156+
Icon
157+
158+
159+
# Thumbnails
160+
._*
161+
162+
# Files that might appear in the root of a volume
163+
.DocumentRevisions-V100
164+
.fseventsd
165+
.Spotlight-V100
166+
.TemporaryItems
167+
.Trashes
168+
.VolumeIcon.icns
169+
.com.apple.timemachine.donotpresent
170+
171+
# Directories potentially created on remote AFP share
172+
.AppleDB
173+
.AppleDesktop
174+
Network Trash Folder
175+
Temporary Items
176+
.apdisk
177+
178+
### macOS Patch ###
179+
# iCloud generated files
180+
*.icloud
181+
182+
### Node ###
183+
# Logs
184+
logs
185+
*.log
186+
npm-debug.log*
187+
yarn-debug.log*
188+
yarn-error.log*
189+
lerna-debug.log*
190+
.pnpm-debug.log*
191+
192+
# Diagnostic reports (https://nodejs.org/api/report.html)
193+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
194+
195+
# Runtime data
196+
pids
197+
*.pid
198+
*.seed
199+
*.pid.lock
200+
201+
# Directory for instrumented libs generated by jscoverage/JSCover
202+
lib-cov
203+
204+
# Coverage directory used by tools like istanbul
205+
coverage
206+
*.lcov
207+
208+
# nyc test coverage
209+
.nyc_output
210+
211+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
212+
.grunt
213+
214+
# Bower dependency directory (https://bower.io/)
215+
bower_components
216+
217+
# node-waf configuration
218+
.lock-wscript
219+
220+
# Compiled binary addons (https://nodejs.org/api/addons.html)
221+
build/Release
222+
223+
# Dependency directories
224+
node_modules/
225+
jspm_packages/
226+
227+
# Snowpack dependency directory (https://snowpack.dev/)
228+
web_modules/
229+
230+
# TypeScript cache
231+
*.tsbuildinfo
232+
233+
# Optional npm cache directory
234+
.npm
235+
236+
# Optional eslint cache
237+
.eslintcache
238+
239+
# Optional stylelint cache
240+
.stylelintcache
241+
242+
# Microbundle cache
243+
.rpt2_cache/
244+
.rts2_cache_cjs/
245+
.rts2_cache_es/
246+
.rts2_cache_umd/
247+
248+
# Optional REPL history
249+
.node_repl_history
250+
251+
# Output of 'npm pack'
252+
*.tgz
253+
254+
# Yarn Integrity file
255+
.yarn-integrity
256+
257+
# dotenv environment variable files
258+
.env
259+
.env.development.local
260+
.env.test.local
261+
.env.production.local
262+
.env.local
263+
264+
# parcel-bundler cache (https://parceljs.org/)
265+
.cache
266+
.parcel-cache
267+
268+
# Next.js build output
269+
.next
270+
out
271+
272+
# Nuxt.js build / generate output
273+
.nuxt
274+
dist
275+
276+
# Gatsby files
277+
.cache/
278+
# Comment in the public line in if your project uses Gatsby and not Next.js
279+
# https://nextjs.org/blog/next-9-1#public-directory-support
280+
# public
281+
282+
# vuepress build output
283+
.vuepress/dist
284+
285+
# vuepress v2.x temp and cache directory
286+
.temp
287+
288+
# Docusaurus cache and generated files
289+
.docusaurus
290+
291+
# Serverless directories
292+
.serverless/
293+
294+
# FuseBox cache
295+
.fusebox/
296+
297+
# DynamoDB Local files
298+
.dynamodb/
299+
300+
# TernJS port file
301+
.tern-port
302+
303+
# Stores VSCode versions used for testing VSCode extensions
304+
.vscode-test
305+
306+
# yarn v2
307+
.yarn/cache
308+
.yarn/unplugged
309+
.yarn/build-state.yml
310+
.yarn/install-state.gz
311+
.pnp.*
79312

80-
*.iml
81-
modules.xml
82-
.idea/misc.xml
83-
*.ipr
313+
### Node Patch ###
314+
# Serverless Webpack directories
315+
.webpack/
84316

85-
# Sonarlint plugin
86-
# https://plugins.jetbrains.com/plugin/7973-sonarlint
87-
.idea/**/sonarlint/
317+
# Optional stylelint cache
88318

89-
# SonarQube Plugin
90-
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
91-
.idea/**/sonarIssues.xml
319+
# SvelteKit build / generate output
320+
.svelte-kit
92321

93-
# Markdown Navigator plugin
94-
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
95-
.idea/**/markdown-navigator.xml
96-
.idea/**/markdown-navigator-enh.xml
97-
.idea/**/markdown-navigator/
322+
### Vim ###
323+
# Swap
324+
[._]*.s[a-v][a-z]
325+
!*.svg # comment out if you don't need vector files
326+
[._]*.sw[a-p]
327+
[._]s[a-rt-v][a-z]
328+
[._]ss[a-gi-z]
329+
[._]sw[a-p]
98330

99-
# Cache file creation bug
100-
# See https://youtrack.jetbrains.com/issue/JBR-2257
101-
.idea/$CACHE_FILE$
331+
# Session
332+
Session.vim
333+
Sessionx.vim
102334

103-
# CodeStream plugin
104-
# https://plugins.jetbrains.com/plugin/12206-codestream
105-
.idea/codestream.xml
335+
# Temporary
336+
.netrwhist
337+
# Auto-generated tag files
338+
tags
339+
# Persistent undo
340+
[._]*.un~
106341

107-
# End of https://www.toptal.com/developers/gitignore/api/intellij
342+
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,node,vim,emacs,macos
108343

109344
# Test data files
110345
test-settings.*

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 20.8.0

GNUmakefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,30 @@ help:
2222
.PHONY: test
2323
test: ## Run all tests
2424
$Q $(CURDIR)/test.sh --type oss --unprivileged false --latest-njs false
25+
26+
# Check if the 'open' command exists on the system
27+
OPEN := $(shell command -v open 2> /dev/null)
28+
29+
# Define the open command based on availability
30+
ifeq ($(OPEN),)
31+
OPEN_COMMAND = xdg-open
32+
else
33+
OPEN_COMMAND = open
34+
endif
35+
36+
docs_destination_directory = "reference"
37+
38+
.PHONY: docs
39+
docs:
40+
npx jsdoc -c $(CURDIR)/jsdoc/conf.json -d $(CURDIR)/$(docs_destination_directory) || true
41+
42+
.PHONY: jsdoc
43+
jsdoc: docs ## Build JSDoc output
44+
45+
.PHONY: jsdoc-open
46+
jsdoc-open: docs
47+
$(OPEN_COMMAND) $(CURDIR)/$(docs_destination_directory)/index.html
48+
49+
.PHONY: clean
50+
clean: ## Clean up build artifacts
51+
$Q rm -rf $(CURDIR)/$(docs_destination_directory)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ deployments/ contains files used for deployment technologies
6868
docs/ contains documentation about the project
6969
examples/ contains additional `Dockerfile` examples that extend the base
7070
configuration
71+
jsdoc JSDoc configuration files
7172
oss/ contains files used solely in NGINX OSS configurations
7273
plus/ contains files used solely in NGINX Plus configurations
7374
test/ contains automated tests for validang that the examples work
@@ -79,9 +80,10 @@ Dockerfile.buildkit.plus Dockerfile with the same configuration as Docke
7980
with support for hiding secrets using Docker's Buildkit
8081
Dockerfile.latest-njs Dockerfile that inherits from the last build of the gateway and
8182
then builds and installs the latest version of njs from source
82-
Dockerfile.unprivileged Dockerfiles that inherits from the last build of the gateway and
83+
Dockerfile.unprivileged Dockerfiles that inherits from the last build of the gateway and
8384
makes the necessary modifications to allow running the container
8485
as a non root, unprivileged user.
86+
package.json Node.js package file used only for generating JSDoc
8587
settings.example Docker env file example
8688
standalone_ubuntu_oss_install.sh install script that will install the gateway as a Systemd service
8789
test.sh test launcher

0 commit comments

Comments
 (0)