add demothemes generator to Makefile
minor improvements
This commit is contained in:
parent
11b0ec79a3
commit
b338ea5da0
3 changed files with 26 additions and 17 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
|
@ -6,6 +6,17 @@ e2e_report.html
|
||||||
bin
|
bin
|
||||||
out
|
out
|
||||||
d2
|
d2
|
||||||
|
# generated svg examples (from make themesdemo)
|
||||||
|
testdata/examples/svg/
|
||||||
|
|
||||||
# https://github.com/golang/go/blob/8b67cf0bc6ad657fddcbaaa10729d0086f08f9a9/src/cmd/go/internal/test/test.go#L415-L416
|
# https://github.com/golang/go/blob/8b67cf0bc6ad657fddcbaaa10729d0086f08f9a9/src/cmd/go/internal/test/test.go#L415-L416
|
||||||
e2etests.test
|
e2etests.test
|
||||||
|
|
||||||
|
# nix/devenv related
|
||||||
|
# .envrc
|
||||||
|
devenv.*
|
||||||
|
!devenv.nix
|
||||||
|
.devenv*
|
||||||
|
.direnv
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
|
||||||
|
|
|
||||||
16
Makefile
16
Makefile
|
|
@ -25,6 +25,18 @@ race: fmt
|
||||||
js: gen
|
js: gen
|
||||||
cd d2js/js && NPM_VERSION="${NPM_VERSION}" prefix "$@" ./make.sh all
|
cd d2js/js && NPM_VERSION="${NPM_VERSION}" prefix "$@" ./make.sh all
|
||||||
|
|
||||||
|
SVGDIR := testdata/examples/svg
|
||||||
|
SVGS = $(shell ./d2 themes | gawk -F':' '/^-/{ printf "$(SVGDIR)/themex-%03d.svg ",$$2 }' || :)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -f $(SVGS) d2
|
||||||
|
|
||||||
.PHONY: themesdemo
|
.PHONY: themesdemo
|
||||||
themesdemo:
|
themesdemo: $(SVGS) d2
|
||||||
$(MAKE) -C ./testdata/examples/
|
|
||||||
|
$(SVGDIR)/themex-%.svg: testdata/examples/themex.d2
|
||||||
|
$(info Building $@ from $< ...)
|
||||||
|
./d2 -t $$(( 10#$* )) $< $@
|
||||||
|
|
||||||
|
# d2: build
|
||||||
|
|
|
||||||
14
testdata/examples/Makefile
vendored
14
testdata/examples/Makefile
vendored
|
|
@ -1,14 +0,0 @@
|
||||||
D2 := ../../d2
|
|
||||||
|
|
||||||
SVGS = $(shell $(D2) themes | gawk -F':' '/^-/{ printf "out/themex-%03d.svg ",$$2 }' || :)
|
|
||||||
|
|
||||||
.PHONY:
|
|
||||||
all: $(D2) $(SVGS)
|
|
||||||
|
|
||||||
$(D2):
|
|
||||||
cd $(dir $@) && go build
|
|
||||||
$(MAKE) $(SVGS)
|
|
||||||
# D2 as dependency to expire results if recompiled
|
|
||||||
out/themex-%.svg: themex.d2 $(D2)
|
|
||||||
$(info Building $@ from $< ...)
|
|
||||||
$(D2) -t $$(( 10#$* )) $< $@
|
|
||||||
Loading…
Reference in a new issue