From 9d41cf0a44efcbe933b186953699aa52cf5289b3 Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Wed, 10 Jun 2026 04:36:40 +0000 Subject: [PATCH] configure wrangler --- .gitignore | 6 ++++++ .tangled/workflows/deploy.yml | 14 ++++++++++++++ Makefile | 15 +++++++++++++++ _headers | 3 +++ 4 files changed, 38 insertions(+) create mode 100644 .tangled/workflows/deploy.yml create mode 100644 _headers diff --git a/.gitignore b/.gitignore index d57de6a..da0e496 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,9 @@ node_modules/ # vendored tooling lives in tools/shrinko8 and IS tracked; ignore only its caches tools/shrinko8/__pycache__/ + +# Wrangler local cache (build artifacts, account metadata) +.wrangler/ + +# Cloudflare Pages deploy output (generated by `make dist`) +dist/ diff --git a/.tangled/workflows/deploy.yml b/.tangled/workflows/deploy.yml new file mode 100644 index 0000000..9ac2fd8 --- /dev/null +++ b/.tangled/workflows/deploy.yml @@ -0,0 +1,14 @@ +when: + - event: [push] + branch: [main] +engine: nixery +dependencies: + nixpkgs: + - nodejs + - nodePackages.pnpm + - gnumake +steps: + - name: deploy + command: make deploy + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} diff --git a/Makefile b/Makefile index 1344f5a..08105f5 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,21 @@ screenshot: build ## Run the built cart headlessly so an extcmd("screenshot") ca -$(HEADLESS_ENV) $(PICO8) -home $(P8HOME) $(OUT) @echo "if the cart called extcmd(\"screenshot\"), look in $(P8HOME)/screenshots" +# --- deploy ------------------------------------------------------------------ +DIST ?= dist + +.PHONY: dist +dist: web ## Assemble web-only files into dist/ for Cloudflare Pages deploy + rm -rf $(DIST) + mkdir -p $(DIST) + cp index.html sw.js manifest.webmanifest crt.js npicomx.js og.png $(DIST)/ + cp -r favicons fonts vendor $(DIST)/ + @[ -f _headers ] && cp _headers $(DIST)/ || true + +.PHONY: deploy +deploy: dist ## Build + deploy to Cloudflare Pages (requires wrangler auth) + npx wrangler pages deploy $(DIST) --project-name npicomx --commit-dirty=true + # --- help / housekeeping ----------------------------------------------------- .PHONY: help help: ## Show this help diff --git a/_headers b/_headers new file mode 100644 index 0000000..d459804 --- /dev/null +++ b/_headers @@ -0,0 +1,3 @@ +/sw.js + Content-Type: application/javascript + Service-Worker-Allowed: / -- 2.51.2