-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.documentation
201 lines (170 loc) · 13.1 KB
/
Makefile.documentation
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#-----------------------------------------------------------------------------------------------------------------------
#
# ## ## ######## ## ########
# ## ## ## ## ## ##
# ## ## ## ## ## ##
# ######### ###### ## ########
# ## ## ## ## ##
# ## ## ## ## ##
# ## ## ######## ######## ##
#
#-----------------------------------------------------------------------------------------------------------------------
$(call lp.help.disable ) # disable the "help" target ("lp.help" remains active)
$(call lp.help.add-target , generated.ts, ....... refresh ) # register a target with description
$(call lp.help.add-phony-target , run, ................ execute ) # register a target and make it .PHONY
$(call lp.help.add-extra-dots , ... ) # add more spacing/dots when printing built-in targets
#-----------------------------------------------------------------------------------------------------------------------
#
# ######## #### ### ###### ## ## ####### ###### ######## #### ###### ######
# ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ## ##
# ## ## ## ## ## ## #### ## ## ## ## ## ## ## ##
# ## ## ## ## ## ## #### ## ## ## ## ## ###### ## ## ## ######
# ## ## ## ######### ## ## ## #### ## ## ## ## ## ## ##
# ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ##
# ######## #### ## ## ###### ## ## ####### ###### ## #### ###### ######
#
#-----------------------------------------------------------------------------------------------------------------------
$(call lp.diagnostics.disable ) # disable diagnostics targets ("lp.*" remains active)
$(call lp.diagnostics.set-target-names, help info config ) # set aliases for diagnostics targets
#-----------------------------------------------------------------------------------------------------------------------
#
# ###### ####### ## ## ######## #### ## ########
# ## ## ## ## ### ### ## ## ## ## ##
# ## ## ## #### #### ## ## ## ## ##
# ## ## ## ## ### ## ######## ## ## ######
# ## ## ## ## ## ## ## ## ##
# ## ## ## ## ## ## ## ## ## ##
# ###### ####### ## ## ## #### ######## ########
#
#-----------------------------------------------------------------------------------------------------------------------
$(call lp.tsc.disable ) # disable the "tsc" target ("lp.tsc" remains active)
$(call lp.tsc.add-extra-prerequisites , ...files ) # add extra prerequisite files that should cause a re-build
$(call lp.tsc.overwrite-prerequisites , ...files ) # use only the given files as prerequisites
$(call lp.tsc.add-extra-targets , ...files ) # declare extra target files generated by the before/after hooks
$(call lp.tsc.overwrite-targets , ...files ) # use only the given files as targets
$(call lp.tsc.add-before-hook , pwd && ls ) # append commands to run before compiling
$(call lp.tsc.overwrite-before-hooks , pwd && ls ) # overwrite any previously defined before-hook commands
$(call lp.tsc.add-after-hook , pwd && ls ) # append commands to run after compiling
$(call lp.tsc.overwrite-after-hooks , pwd && ls ) # overwrite any previously defined after-hook commands
$(call lp.tsc.overwrite-command , tsc -b ) # overwrite the command itself
$(call lp.tsc.get-command-with-hooks , Compile...) # get the command with all hooks (with an optional "echo")
$(call lp.tsc.get-default-command , Compile...) # get the built-in command (with an optional "echo")
$(LP_PREREQUISITE_TSC) # use as a prerequisite for targets that depend on "tsc"
#-----------------------------------------------------------------------------------------------------------------------
#
# ######## ## ## ## ## ######## ## ########
# ## ## ## ## ### ## ## ## ## ##
# ## ## ## ## #### ## ## ## ## ##
# ######## ## ## ## ## ## ## ## ## ######
# ## ## ## ## ## #### ## ## ## ##
# ## ## ## ## ## ### ## ## ## ##
# ######## ####### ## ## ######## ######## ########
#
#-----------------------------------------------------------------------------------------------------------------------
$(call lp.bundle.disable ) # disable the "bundle" target ("lp.bundle" remains active)
$(call lp.bundle.add, # add a file to be bundled
src/app.ts, # [1] source file
dist/app.js, # [2] bundled output file
# [3] list of strings to override the project's configuration
cjs | esm # - set the target module system
cli | web # - bundle for cli/node or web
minify # - minify the JavaScript bundle
sourcemap # - generate a source map
inline-sources # - generate a source map and inline sources
dts # - generate a bundled d.ts declaration file
shebang # - prepend #!/usr/bin/env node to JavaScript bundle
echo "js after-hook", # [3] command to run after bundling the js file
echo "dts after-hook" # [4] command to run after bundling the d.ts file
)
$(call lp.bundle.add-extra-prerequisites , ...files ) # add extra prerequisite files that should cause a re-bundle
$(call lp.bundle.overwrite-prerequisites , ...files ) # use only the given files as prerequisites for bundling
$(call lp.bundle.add-extra-js-targets , ...files ) # declare extra js targets (created separately or by hooks)
$(call lp.bundle.add-extra-dts-targets , ...files ) # declare extra d.ts targets (created separately or by hooks)
$(call lp.bundle.overwrite-js-targets , ...files ) # use only the given files as js targets
$(call lp.bundle.overwrite-dts-targets , ...files ) # use only the given files as d.ts targets
$(LP_PREREQUISITE_BUNDLE) # use as a prerequisite for targets that depend on "bundle"
$(LP_PREREQUISITE_BUNDLE_JS) # same as above but only require bundled JavaScript files
$(LP_PREREQUISITE_BUNDLE_DTS) # same as above but only require bundled d.ts. declaration files
#-----------------------------------------------------------------------------------------------------------------------
#
# ######## ####### ######## ## ## ### ########
# ## ## ## ## ## ### ### ## ## ##
# ## ## ## ## ## #### #### ## ## ##
# ###### ## ## ######## ## ### ## ## ## ##
# ## ## ## ## ## ## ## ######### ##
# ## ## ## ## ## ## ## ## ## ##
# ## ####### ## ## ## ## ## ## ##
#
#-----------------------------------------------------------------------------------------------------------------------
$(call lp.format.disable ) # disable the "format" target ("lp.format" remains active)
$(call lp.format.include , *.cjs resources/* ) # format files/directores matching the $(wildcard) pattern
$(call lp.format.exclude , resources/tmp ) # don't format files/directores matching the $(wildcard) pattern
$(call lp.format.include-only , *.json src ) # format only these files/directories (but not the built-in ones)
# Note: All patterns are expanded via $(wildcard ...). They can
# resolve to files or directories. They do not expand recursively.
# It not possible to exclude sub-directories of included parent
# directories, e.g.:
#
# $(call lp.format.include, src )
# $(call lp.format.exclude, src/tmp ) # DOES NOT WORK!
#
# Instead, include the child path and all of its siblings and
# then exclude the specific child:
#
# $(call lp.format.include, src/* ) # expands to src/tmp src/...
# $(call lp.format.exclude, src/tmp ) # works now
#
# The effective paths can be checked via "make format.help"
$(call lp.format.add-before-hook , pwd && ls ) # append commands to run before formatting
$(call lp.format.overwrite-before-hooks , pwd && ls ) # overwrite any previously defined before-hook commands
$(call lp.format.add-after-hook , pwd && ls ) # append commands to run after formatting
$(call lp.format.overwrite-after-hooks , pwd && ls ) # overwrite any previously defined after-hook commands
$(call lp.format.overwrite-command , prettier ) # overwrite the command itself
$(call lp.bundle.get-command-with-hooks , Format... ) # get the command with all hooks (with an optional "echo")
$(call lp.bundle.get-default-command , Format... ) # get the built-in command (with an optional "echo")
#-----------------------------------------------------------------------------------------------------------------------
#
# ## ## ######## ## #### ######## ########
# ## ## ## ## ## ## ## ##
# ## ## ## ## ## ## ## ##
# ## ## ######## ## ## ###### ##
# ## ## ## ## ## ## ##
# ## ## ## ## ## ## ##
# ####### ## ######## #### ## ##
#
#-----------------------------------------------------------------------------------------------------------------------
$(call lp.uplift.disable ) # disable the uplift target ("lp.uplift" remains active)
$(call lp.uplift.add-before-hook , pwd && ls ) # append commands to run before uplifting
$(call lp.uplift.overwrite-before-hooks , pwd && ls ) # overwrite any previously defined before-hook commands
$(call lp.uplift.add-after-hook , pwd && ls ) # append commands to run after uplifting
$(call lp.uplift.overwrite-after-hooks , pwd && ls ) # overwrite any previously defined after-hook commands
$(call lp.uplift.overwrite-command , prettier ) # overwrite the command itself
#-----------------------------------------------------------------------------------------------------------------------
#
# ###### ## ######## ### ## ##
# ## ## ## ## ## ## ### ##
# ## ## ## ## ## #### ##
# ## ## ###### ## ## ## ## ##
# ## ## ## ######### ## ####
# ## ## ## ## ## ## ## ###
# ###### ######## ######## ## ## ## ##
#
#-----------------------------------------------------------------------------------------------------------------------
$(call lp.clean.npm-packages ) # delete node_modules
$(call lp.clean.tsc-output ) # delete transpiled JavaScript files
$(call lp.clean.bundles ) # delete bundles
$(call lp.clean.files, output.log dist ) # delete the given files and directories
#-----------------------------------------------------------------------------------------------------------------------
#
# ######## ## ## ## ##
# ## ## ## ## ### ##
# ## ## ## ## #### ##
# ######## ## ## ## ## ##
# ## ## ## ## ## ####
# ## ## ## ## ## ###
# ## ## ####### ## ##
#
#-----------------------------------------------------------------------------------------------------------------------
$(call lp.run , dir/js-or-ts-file ) ...arguments # run a TypeScript source file or a compiled JavaScript file
$(call lp.run.js , out/my-app.js ) ...arguments # run a JavaScript file
$(call lp.run.ts , src/my-app.ts ) ...arguments # run a TypeScript file (via ts-node)