diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8de8dd0 --- /dev/null +++ b/Makefile @@ -0,0 +1,59 @@ +DENO := deno +COV := $(DENO) coverage cov_profile +FMT := $(DENO) fmt *.ts examples/*.ts +NPM_PUB := npm publish + +D2 := nix run git+https://git.pleshevski.ru/mynix/tools\\\#d2_unstable -- +DIAGRAMS := \ + turnstile + +turnstile_theme_args := --layout elk --theme 101 + +dev: fmt tests cov + +ci: fmt-check tests-cov + +tests: clean + $(DENO) test --coverage=cov_profile *.test.ts + +tests-cov: tests + $(COV) --lcov > cov_profile/cov.lcov + +cov: + $(COV) + +fmt: + $(FMT) + +fmt-check: + $(FMT) --check + +build: clean | $(DIAGRAMS) + tsc && tsc -p tsconfig.cjs.json + +clean: + @echo clean test coverage data + rm -rf cov_profile + @echo clean build target + rm -rf dist + @echo clean diagrams + rm -rf assets/*.svg + +define d2rule +d2_$(1)_args := $(D2) $$($(1)_theme_args) assets/$(1).d2 assets/$(1).svg + +$(1): ; $$($(1)_args) +$(1)-w: ; $$($(1)_args) -w +endef + +$(foreach d2name,$(DIAGRAMS),$(eval $(call d2rule,$(d2name)))) + +dry-pub: + $(NPM_PUB) --dry-run + +pub: + $(NPM_PUB) + +help: + cat Makefile + diff --git a/assets/turnstile.d2 b/assets/turnstile.d2 new file mode 100644 index 0000000..2ab84b5 --- /dev/null +++ b/assets/turnstile.d2 @@ -0,0 +1,6 @@ +direction: right + +Turnstile: { + Locked -> Unlocked: coin + Unlocked -> Locked: push +} diff --git a/assets/turnstile.svg b/assets/turnstile.svg new file mode 100644 index 0000000..713a4d3 --- /dev/null +++ b/assets/turnstile.svg @@ -0,0 +1,37 @@ + +TurnstileLockedUnlocked + + +coin + + +push \ No newline at end of file diff --git a/makefile b/makefile deleted file mode 100644 index 9c0b98e..0000000 --- a/makefile +++ /dev/null @@ -1,37 +0,0 @@ -DENO := deno -COV := $(DENO) coverage cov_profile -FMT := $(DENO) fmt *.ts examples/*.ts -NPM_PUB := npm publish - -dev: fmt tests cov - -ci: fmt-check tests-cov - -tests: clean - $(DENO) test --coverage=cov_profile *.test.ts - -tests-cov: tests - $(COV) --lcov > cov_profile/cov.lcov - -cov: - $(COV) - -fmt: - $(FMT) - -fmt-check: - $(FMT) --check - -clean: - rm -rf cov_profile dist - -build: clean - tsc && tsc -p tsconfig.cjs.json - -dry-pub: - $(NPM_PUB) --dry-run - -pub: - $(NPM_PUB) - -