27 lines
947 B
Makefile
27 lines
947 B
Makefile
PLUGIN_ID := beaver
|
|
ASSETS := manifest.json main.js styles.css versions.json
|
|
# package-lock.json → npm; otherwise whichever of pnpm/npm is around.
|
|
PM := $(if $(wildcard package-lock.json),$(shell command -v npm 2>/dev/null),$(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"
|