From c6af9b1cba4e24beb616fb7a7b25d2394d72330b Mon Sep 17 00:00:00 2001
From: Correl Roush <correl@gmail.com>
Date: Tue, 10 Jan 2023 00:31:30 -0500
Subject: [PATCH] Remove npm dependency from Makefile

---
 www/.gitignore   |  3 +--
 www/Makefile     | 20 +++++++++-----------
 www/package.json | 13 -------------
 3 files changed, 10 insertions(+), 26 deletions(-)
 delete mode 100644 www/package.json

diff --git a/www/.gitignore b/www/.gitignore
index 7be18a7..6e27712 100644
--- a/www/.gitignore
+++ b/www/.gitignore
@@ -1,4 +1,3 @@
+bin
 elm-stuff
-node_modules
-package-lock.json
 public/elm.js
diff --git a/www/Makefile b/www/Makefile
index 1ef9c77..5d7cc59 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -4,30 +4,28 @@ TARGET=public/elm.js
 SOURCE=src/App.elm
 
 ELM_FILES = $(shell find src -type f -name '*.elm')
-NODE_BIN = ./node_modules/.bin
-ELM = $(NODE_BIN)/elm
-ELM_LIVE = $(NODE_BIN)/elm-live
+ELM = ./bin/elm
 
 ELMMAKE_FLAGS =
 ifeq ($(DEBUG),1)
 	ELMMAKE_FLAGS += --debug
 endif
 
-all: node-deps $(TARGET)
+all: $(TARGET)
 
-node-deps:
-	npm i
+$(ELM):
+	mkdir -p ./bin
+	curl -sL https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz \
+		| gunzip > $@
+	chmod +x $@
 
-$(TARGET): $(ELM_FILES)
+$(TARGET): $(ELM_FILES) $(ELM)
 	$(ELM) make $(ELMMAKE_FLAGS) $(SOURCE) --output $@
 
 clean-deps:
+	rm -rf bin
 	rm -rf elm-stuff
-	rm -rf node_modules
 
 clean:
 	rm -f $(TARGET)
 	rm -rf elm-stuff/build-artifacts
-
-run: all
-	PATH="$(NODE_BIN):$$PATH" $(ELM_LIVE) $(SOURCE) --dir public --open -- $(ELMMAKE_FLAGS) --output $(TARGET)
diff --git a/www/package.json b/www/package.json
deleted file mode 100644
index b2972f6..0000000
--- a/www/package.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-    "name": "tutor",
-    "description": "Tutor",
-    "version": "1.0.0",
-    "author": "Correl Roush <correl@gmail.com>",
-    "license": "MIT",
-    "devDependencies": {
-        "elm": "0.19.1"
-    },
-    "dependencies": {
-        "elm-live": "^4.0.2"
-    }
-}