-
-
Notifications
You must be signed in to change notification settings - Fork 809
/
Copy pathjsdoc.mk
157 lines (120 loc) · 3.96 KB
/
jsdoc.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#/
# @license Apache-2.0
#
# Copyright (c) 2017 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#/
# VARIABLES #
# Define the path of the JSDoc executable:
JSDOC ?= $(BIN_DIR)/jsdoc
# Define the path to the JSDoc configuration file:
JSDOC_CONF ?= $(CONFIG_DIR)/jsdoc/.jsdoc.json
# Define the path to JSDoc type definitions:
JSDOC_TYPEDEF ?= $(TOOLS_DIR)/docs/jsdoc/typedefs/*.js
# Define the path to the JSDoc JSON template:
JSDOC_JSON_TEMPLATE ?= $(TOOLS_DIR)/docs/jsdoc/templates/json
# Define the output directory for JSDoc:
JSDOC_OUT ?= $(SRC_DOCS_DIR)/jsdoc
# Define the output directory for JSDoc JSON:
JSDOC_JSON_OUT ?= $(JSDOC_OUT)/json
# Define the output filepath for JSDoc JSON:
JSDOC_JSON ?= $(JSDOC_JSON_OUT)/jsdoc.json
# Define the path to the JSDoc HTML template:
JSDOC_HTML_TEMPLATE ?= $(TOOLS_DIR)/docs/jsdoc/templates/html
# Define the output directory for JSDoc HTML documentation:
JSDOC_HTML_OUT ?= $(JSDOC_OUT)/static
# Define the output filepath for HTML documentation:
JSDOC_HTML ?= $(JSDOC_HTML_OUT)/index.html
# Define command-line options to be used when invoking the JSDoc executable to generate HTML documentation:
JSDOC_HTML_FLAGS ?= \
--template $(JSDOC_HTML_TEMPLATE) \
--configure $(JSDOC_CONF) \
--encoding utf8 \
--destination $(JSDOC_HTML_OUT) \
--verbose
# Define command-line options to be used when invoking the JSDoc executable to generate JSDoc JSON:
JSDOC_JSON_FLAGS ?= \
--template $(JSDOC_JSON_TEMPLATE) \
--configure $(JSDOC_CONF) \
--encoding utf8 \
--destination console
# TARGETS #
# Generate JSDoc HTML documentation.
#
# This target generates source HTML documentation from [JSDoc][1]-style comments using [JSDoc][1].
#
# To install JSDoc:
#
# ```bash
# $ npm install jsdoc
# ```
#
# [1]: https://jsdoc.app/
jsdoc-html: $(NODE_MODULES)
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(JSDOC_HTML_OUT)
$(QUIET) $(MKDIR_RECURSIVE) $(JSDOC_HTML_OUT)
$(QUIET) $(JSDOC) $(JSDOC_HTML_FLAGS) $(JSDOC_TYPEDEF) $(SOURCES)
.PHONY: jsdoc-html
# Generate JSDoc HTML documentation.
#
# See issue #6583
jsdoc-html-out: $(NODE_MODULES)
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(JSDOC_HTML_OUT)
$(QUIET) $(MKDIR_RECURSIVE) $(JSDOC_HTML_OUT)
$(QUIET) find . -type f -name "$(SOURCES_PATTERN)" > sources.txt
$(QUIET) cat sources.txt | xargs $(JSDOC) $(JSDOC_HTML_FLAGS) $(JSDOC_TYPEDEF)
.PHONY: jsdoc-html-out
# Generate JSDoc JSON.
#
# This target generates JSDoc JSON from [JSDoc][1]-style comments.
#
# To install JSDoc:
#
# ```bash
# $ npm install jsdoc
# ```
#
# [1]: https://jsdoc.app/
jsdoc-json: $(NODE_MODULES)
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(JSDOC_JSON)
$(QUIET) $(MKDIR_RECURSIVE) $(JSDOC_JSON_OUT)
$(QUIET) $(JSDOC) $(JSDOC_JSON_FLAGS) $(JSDOC_TYPEDEF) $(SOURCES) > $(JSDOC_JSON)
.PHONY: jsdoc-json
# View HTML documentation.
#
# This target opens JSDoc HTML documentation in a local web browser.
view-jsdoc-html:
$(QUIET) $(OPEN) $(JSDOC_HTML)
.PHONY: view-jsdoc-html
# Remove a JSDoc output directory.
#
# This target cleans up a JSDoc output directory by removing it entirely.
clean-jsdoc:
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(JSDOC_OUT)
.PHONY: clean-jsdoc
# Rebuild JSDoc HTML documentation.
#
# This target removes any current documentation and regenerates source HTML documentation from [JSDoc][1]-style comments.
#
# To install JSDoc:
#
# ```bash
# $ npm install jsdoc
# ```
#
# [1]: https://jsdoc.app/
rebuild-jsdoc-html:
$(QUIET) $(MAKE) -f $(this_file) clean-jsdoc
$(QUIET) $(MAKE) -f $(this_file) jsdoc-html
.PHONY: rebuild-jsdoc-html