-
Notifications
You must be signed in to change notification settings - Fork 7
/
js.check.d.ts.mk
47 lines (39 loc) · 1.5 KB
/
js.check.d.ts.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
# Adds a 'check-d-ts' target to run 'tsc'
# over YP_D_TS_FILES (defaults to all committed and staged *.d.ts files).
# The 'check-d-ts' target is automatically added to the 'check' target via YP_CHECK_TARGETS.
#
# The tsc executable is lazy-found inside node_modules/.bin and $PATH.
# The arguments to the tsc executable can be changed via TSC_D_TS_ARGS.
#
# For convenience, specific files can be ignored
# via grep arguments given to YP_D_TS_FILES_IGNORE:
# YP_D_TS_FILES_IGNORE += \
# -e "^path/to/dir/" \
# -e "^path/to/file$" \
#
# NOTE transcrypted files are automatically ignored.
#
# ------------------------------------------------------------------------------
YP_IS_TRANSCRYPTED ?= false
TSC_D_TS = $(call npm-which,TSC,tsc)
$(foreach VAR,TSC_D_TS,$(call make-lazy-once,$(VAR)))
TSC_D_TS_ARGS += \
--esModuleInterop \
--noEmit \
YP_D_TS_FILES_IGNORE += \
-e "^$$" \
$(YP_VENDOR_FILES_IGNORE) \
YP_D_TS_FILES += $(shell $(GIT_LS) . | \
$(GREP) -e "\.d\.ts$$" | \
$(GREP) -Fvxf <($(FIND) $(GIT_ROOT) -type l -printf "%P\n") | \
$(GREP) -Fvxf <($(YP_IS_TRANSCRYPTED) || [[ ! -x $(GIT_ROOT)/transcrypt ]] || $(GIT_ROOT)/transcrypt -l) | \
$(GREP) -Fvxf <($(GIT) config --file .gitmodules --get-regexp path | $(CUT) -d' ' -f2 || true) | \
$(GREP) -v $(YP_D_TS_FILES_IGNORE) | \
$(SED) "s/^/'/g" | \
$(SED) "s/$$/'/g")
YP_CHECK_TARGETS += \
check-d-ts
# ------------------------------------------------------------------------------
.PHONY: check-d-ts
check-d-ts:
$(TSC_D_TS) $(TSC_D_TS_ARGS) $(YP_D_TS_FILES)