Files
warp-engine-client/Makefile
T
mr.zeroandClaude Opus 5 85c6d33b05 A Makefile over the npm scripts, and one command that publishes
Building and releasing were a build followed by remembered `tea` invocations, and
the second half was the part I got wrong by hand: the first release went out with
assets attached through a path that half-failed. `make release` is now one command
— package for this machine, then create the release and upload — and the pieces
are also available separately as `make dist` and `make publish`.

The Makefile adds no logic beyond that: every other target wraps an npm script, so
`npm start` and `npm run dist:mac` keep working. What it does add is a Node
version guard on anything that touches Electron's installer, because a Node 20
`npm install` fails deep inside a postinstall script with an ESM error that says
nothing about the cause.

`scripts/release.sh` holds the publishing, in POSIX sh like the other repositories'
scripts:

- the tag comes from package.json, so `npm version patch` is the only place a
  version is written;
- an attachment whose name is already on the release is replaced rather than
  refused, which is what makes rebuild-and-upload repeatable;
- the repository is read from `origin`, so a fork publishes to the fork;
- `RELEASE_NOTES.md` becomes the release body when it exists.

Tested against the live release with a small probe file rather than by pushing 240
MB twice: creation is skipped when the release exists, a repeat upload takes the
replace path, and an empty `dist/` refuses with the command to run instead. The
probe was removed afterwards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 12:10:41 +02:00

89 lines
3.1 KiB
Makefile

# WarpEngine Store GUI — the front door to the npm scripts.
#
# Everything here is a thin wrapper: the app is an Electron project, so npm still
# does the work. The Makefile exists so the useful sequences have names, and so
# `make release` is one command rather than a build followed by remembered tea
# invocations.
#
# make list the targets
# make setup install the dependencies
# make dist package for this machine
# make release package and publish to Gitea
#
# Publishing assumes `tea` is installed and logged in — the devarea repo has
# `make tea` for that.
SHELL := /bin/sh
SCRIPTS := scripts
NODE_MIN := 22
# The version is package.json's, so the release tag never drifts from the app.
VERSION := $(shell python3 -c 'import json; print(json.load(open("package.json"))["version"])')
TAG ?= v$(VERSION)
.DEFAULT_GOAL := help
.PHONY: help setup node-check start smoke uitest test dist dist-mac dist-win dist-linux \
release publish clean distclean version
help: ## List available targets
@echo "WarpEngine Store GUI $(VERSION) — usage: make <target>"
@echo
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " %-12s %s\n", $$1, $$2}'
@echo
@echo " Variables: TAG=$(TAG) TEA_LOGIN=ttg REPO=<owner/name> NOTES=RELEASE_NOTES.md"
node-check: ## Check the Node version Electron's installer needs
@node -e 'const [maj] = process.versions.node.split("."); \
if (Number(maj) < $(NODE_MIN)) { \
console.error("Node $(NODE_MIN)+ is needed to install Electron (found " + process.versions.node + \
"): its installer is ESM-only. The packaged app carries its own runtime."); \
process.exit(1); \
} else { console.log("node " + process.versions.node + " ok"); }'
setup: node-check ## Install the dependencies
npm install
start: ## Run the app against whatever store is installed
npm start
smoke: ## Drive the store bridge with no window at all
npm run smoke
uitest: ## Load the window once and report what rendered
npm run uitest
test: smoke uitest ## Both checks
dist: node-check ## Package for this machine
npm run dist
dist-mac: node-check ## Package for macOS (ad-hoc signed, see the README)
npm run dist:mac
dist-win: node-check ## Package for Windows
npm run dist:win
dist-linux: node-check ## Package for Linux
npm run dist:linux
publish: ## Upload the packages already in dist/ to the Gitea release
@TAG=$(TAG) $(SCRIPTS)/release.sh
release: dist publish ## Package for this machine and publish it
clean: ## Remove the built packages
rm -rf dist
distclean: clean ## Remove the packages and the dependencies
rm -rf node_modules
version: ## Show the versions involved
@echo "app $(VERSION) (tag $(TAG))"
@printf "node "; node --version 2>/dev/null || echo "missing"
@printf "npm "; npm --version 2>/dev/null || echo "missing"
@printf "electron "; node -p "require('./package.json').devDependencies.electron" 2>/dev/null || echo "missing"
@printf "tea "; tea --version 2>/dev/null | head -1 || echo "missing — devarea: make tea"
@printf "python3 "; python3 --version 2>/dev/null || echo "missing"