| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
# resolve DEB_VERSION |
| 4 |
include /usr/share/dpkg/pkg-info.mk |
| 5 |
|
| 6 |
# generate documentation unless nodoc requested |
| 7 |
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) |
| 8 |
DOCS = README.html README.txt |
| 9 |
CHANGELOGS = CHANGELOG.html CHANGELOG.txt |
| 10 |
endif |
| 11 |
|
| 12 |
ESLINT = eslint |
| 13 |
MOCHA = mocha --no-timeout |
| 14 |
# normalize output with TAP where possible unless terse requested |
| 15 |
ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) |
| 16 |
ESLINT += --format tap |
| 17 |
MOCHA += --reporter tap |
| 18 |
else |
| 19 |
ESLINT += --format unix |
| 20 |
MOCHA += --reporter dot --no-colors |
| 21 |
endif |
| 22 |
|
| 23 |
%: |
| 24 |
dh $@ |
| 25 |
|
| 26 |
override_dh_clean: |
| 27 |
dh_clean -- $(DOCS) $(CHANGELOGS) |
| 28 |
|
| 29 |
execute_after_dh_auto_build: $(DOCS) $(CHANGELOGS) |
| 30 |
|
| 31 |
# * simplify lint check when newer eslint is in Debian |
| 32 |
# * check typescript when tsd is in Debian |
| 33 |
override_dh_auto_test: |
| 34 |
$(MOCHA) 'tests/lib/**/*.cjs' 'tests/lib/**/*.js' |
| 35 |
$(ESLINT) --no-eslintrc --env es2020 --parser-options sourceType:module --ignore-pattern /dist . |
| 36 |
# tsd |
| 37 |
|
| 38 |
override_dh_installdocs: |
| 39 |
dh_installdocs --all -- $(DOCS) |
| 40 |
|
| 41 |
override_dh_installchangelogs: |
| 42 |
dh_installchangelogs -- $(CHANGELOGS) |
| 43 |
|
| 44 |
%.html: %.md |
| 45 |
cmark-gfm $< > $@ |
| 46 |
|
| 47 |
%.txt: %.md |
| 48 |
cmark-gfm --to plaintext $< > $@ |
| 49 |
|