Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build script to make an (svg) demo of all available themes #2079

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ test: fmt
.PHONY: race
race: fmt
prefix "$@" ./ci/test.sh --race ./...

.PHONY: themesdemo
themesdemo:
$(MAKE) -C ./testdata/examples/
14 changes: 14 additions & 0 deletions testdata/examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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#$* )) $< $@
50 changes: 50 additions & 0 deletions testdata/examples/themex.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

vars: {
d2-config: {
layout-engine: elk
}
}
network: {
cell tower: {
satellites: {
shape: stored_data
style.multiple: true
}

transmitter

satellites -> transmitter: send
satellites -> transmitter: send
satellites -> transmitter: send
}

online portal: {
ui: {shape: hexagon}
}

data processor: {
storage: {
shape: cylinder
style.multiple: true
}
}

cell tower.transmitter -> data processor.storage: phone logs
}

user: {
shape: person
width: 130
}

user -> network.cell tower: make call
user -> network.online portal.ui: access {
style.stroke-dash: 3
}

api server -> network.online portal.ui: display
api server -> logs: persist
logs: {shape: page; style.multiple: true}

network.data processor -> api server

Loading