26 lines
792 B
Makefile
26 lines
792 B
Makefile
PLUGIN_ID := beaver
|
|
ASSETS := manifest.json main.js versions.json
|
|
PM := $(shell command -v pnpm 2>/dev/null || command -v npm 2>/dev/null)
|
|
|
|
.PHONY: install zip _build
|
|
|
|
_build:
|
|
@test -n "$(PM)" || (echo "no pnpm or npm in PATH" >&2; exit 1)
|
|
$(PM) install --silent
|
|
$(PM) run build
|
|
|
|
install: _build
|
|
@test -n "$(VAULT)" || (echo "set VAULT=<path-to-vault>" >&2; exit 1)
|
|
@test -d "$(VAULT)/.obsidian" || (echo "no .obsidian dir at $(VAULT)" >&2; exit 1)
|
|
@target="$(VAULT)/.obsidian/plugins/$(PLUGIN_ID)"; \
|
|
mkdir -p "$$target"; \
|
|
cp $(ASSETS) "$$target/"; \
|
|
echo "installed → $$target"
|
|
|
|
zip: _build
|
|
@version=$$(node -p "require('./manifest.json').version"); \
|
|
out="beaver-plugin-$$version.zip"; \
|
|
rm -f "$$out"; \
|
|
zip -q -j "$$out" $(ASSETS); \
|
|
echo "wrote $$out"
|