From 898e7ed11ab0958fcdaf65b99b33f7b04787630a Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 24 Sep 2017 22:14:48 +0200 Subject: Bootstrap with GHCJS and reflex: - setup login and logout, - first draft of payment view. --- Makefile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a0458f1..5d695f2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ start: - @nix-shell --command "mux local" + @nix-shell --command "tmuxinator local" stop: @tmux kill-session -t sharedCost @@ -15,31 +15,36 @@ build: build-server build-client # ------ clean-server: - @stack clean > /dev/null + @cabal clean install-server: - @stack setup + @cabal2nix --shell . > sharedCost.nix build-server: - @stack build || : + @nix-shell sharedCost.nix --command "cabal build" launch-server: - @(killall sharedCost || :) && stack exec sharedCost + @killall sharedCost || : + @cabal run sharedCost watch-server: - @nodemon -e hs,conf --exec 'clear && make build-server --silent && make launch-server' + @nodemon --watch src/server -e hs,conf --exec '(clear && make build-server && make launch-server) || :' # Client # ------ clean-client: - @rm -r elm-stuff >/dev/null 2>&1 || true + @rm -rf reflex-platform install-client: - @elm package install --yes + @git clone https://github.com/reflex-frp/reflex-platform 2>/dev/null || : + @cd reflex-platform && ./try-reflex --command exit >/dev/null + +build-client-inside: + @cd src/client && ghcjs -Wall -Werror --make Main && mv Main.jsexe/all.js ../../public/javascript/main.js build-client: - @elm make src/client/Main.elm --output public/javascripts/client.js || true + @./reflex-platform/try-reflex --command "make build-client-inside" watch-client: - @nodemon -e elm --exec 'clear && make build-client --silent' + @./reflex-platform/try-reflex --command "nodemon --watch src/client -e hs --exec '(clear && make build-client-inside) || true'" -- cgit v1.2.3 From 27e11b20b06f2f2dbfb56c0998a63169b4b8abc4 Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 8 Nov 2017 23:47:26 +0100 Subject: Use a better project structure --- Makefile | 57 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5d695f2..c8bb7ce 100644 --- a/Makefile +++ b/Makefile @@ -1,50 +1,49 @@ start: - @nix-shell --command "tmuxinator local" + @nix-shell tools.nix --command "tmuxinator local" stop: @tmux kill-session -t sharedCost dist: - @nix-shell --command "make clean install build" + @nix-shell tools.nix --command "make clean install build" -clean: clean-server clean-client -install: install-server install-client -build: build-server build-client +clean: clean-client clean-server +install: install-client install-server +build: build-client build-server -# Server +# Client # ------ -clean-server: - @cabal clean +build-client: + @nix-shell -A shells.ghcjs --run "build-client-inside" -install-server: - @cabal2nix --shell . > sharedCost.nix +build-client-inside: + @cabal --project-file=cabal-client.project --builddir=dist-client new-build all && make cp-client -build-server: - @nix-shell sharedCost.nix --command "cabal build" +cp-client: + @cp dist-client/build/x86_64-linux/ghcjs-0.2.1/client-0.0.1/c/client/build/client/client.jsexe/all.js public/javascript/main.js -launch-server: - @killall sharedCost || : - @cabal run sharedCost +clean-client: + @rm -rf dist-client -watch-server: - @nodemon --watch src/server -e hs,conf --exec '(clear && make build-server && make launch-server) || :' +watch-client: + @nix-shell -A shells.ghcjs --run "nodemon --watch client --watch common --ext hs --exec '(clear && make build-client-inside) || true'" -# Client +# Server # ------ -clean-client: - @rm -rf reflex-platform +clean-server: + @rm -rf dist-server -install-client: - @git clone https://github.com/reflex-frp/reflex-platform 2>/dev/null || : - @cd reflex-platform && ./try-reflex --command exit >/dev/null +build-server: + @nix-shell -A shells.ghc --run "make build-server-inside" -build-client-inside: - @cd src/client && ghcjs -Wall -Werror --make Main && mv Main.jsexe/all.js ../../public/javascript/main.js +build-server-inside: + @cabal --project-file=cabal-server.project --builddir=dist-server new-build all -build-client: - @./reflex-platform/try-reflex --command "make build-client-inside" +run-server: + @(killall sharedCost &>/dev/null) || : + @./dist-server/build/x86_64-linux/ghc-8.0.2/server-0.0.1/c/server/build/server/server -watch-client: - @./reflex-platform/try-reflex --command "nodemon --watch src/client -e hs --exec '(clear && make build-client-inside) || true'" +watch-server: + @nix-shell -A shells.ghc --run "nodemon --watch server --watch common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" -- cgit v1.2.3 From 30f786e277b4ece6a09311de364082691f261ca3 Mon Sep 17 00:00:00 2001 From: Joris Date: Fri, 10 Nov 2017 01:23:49 +0100 Subject: Minify javascript in dist mode, compress served files with gzip --- Makefile | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c8bb7ce..8ece441 100644 --- a/Makefile +++ b/Makefile @@ -5,29 +5,31 @@ stop: @tmux kill-session -t sharedCost dist: - @nix-shell tools.nix --command "make clean install build" + @nix-build -o result-server -A ghc.server + @nix-build -o result-client -A ghcjs.client + @nix-shell -p closurecompiler --command 'closure-compiler result-client/bin/client.jsexe/all.js --js_output_file public/javascript/main.js' -clean: clean-client clean-server -install: install-client install-server -build: build-client build-server +clean: clean-server clean-client + +build: build-server build-client cp-client # Client # ------ +clean-client: + @rm -rf dist-client + build-client: @nix-shell -A shells.ghcjs --run "build-client-inside" build-client-inside: - @cabal --project-file=cabal-client.project --builddir=dist-client new-build all && make cp-client + @cabal --project-file=cabal-client.project --builddir=dist-client new-build all cp-client: @cp dist-client/build/x86_64-linux/ghcjs-0.2.1/client-0.0.1/c/client/build/client/client.jsexe/all.js public/javascript/main.js -clean-client: - @rm -rf dist-client - watch-client: - @nix-shell -A shells.ghcjs --run "nodemon --watch client --watch common --ext hs --exec '(clear && make build-client-inside) || true'" + @nix-shell -A shells.ghcjs --run "nodemon --watch client --watch common --ext hs --exec '(clear && make build-client-inside && make cp-client) || true'" # Server # ------ @@ -42,8 +44,8 @@ build-server-inside: @cabal --project-file=cabal-server.project --builddir=dist-server new-build all run-server: - @(killall sharedCost &>/dev/null) || : + @(fuser -k 3000/tcp &>/dev/null) || : @./dist-server/build/x86_64-linux/ghc-8.0.2/server-0.0.1/c/server/build/server/server watch-server: - @nix-shell -A shells.ghc --run "nodemon --watch server --watch common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" + @nix-shell -A shells.ghc --run "nodemon --watch ./server --watch ./common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" -- cgit v1.2.3 From 213cf7ede058b781fc957de2cd9f6a5988c08004 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 12 Nov 2017 22:58:23 +0100 Subject: Add mocked pages --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8ece441..d18fb6d 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ clean-client: @rm -rf dist-client build-client: - @nix-shell -A shells.ghcjs --run "build-client-inside" + @nix-shell -A shells.ghcjs --run "make build-client-inside" build-client-inside: @cabal --project-file=cabal-client.project --builddir=dist-client new-build all -- cgit v1.2.3 From 5a63f7be9375e3ab888e4232dd7ef72c2f1ffae1 Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 13 Nov 2017 23:56:40 +0100 Subject: Setup stylish-haskell --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index d18fb6d..16bf753 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ cp-client: @cp dist-client/build/x86_64-linux/ghcjs-0.2.1/client-0.0.1/c/client/build/client/client.jsexe/all.js public/javascript/main.js watch-client: - @nix-shell -A shells.ghcjs --run "nodemon --watch client --watch common --ext hs --exec '(clear && make build-client-inside && make cp-client) || true'" + @nix-shell -A shells.ghcjs --run "nodemon --delay 0.1 --watch client --watch common --ext hs --exec '(clear && make build-client-inside && make cp-client) || true'" # Server # ------ @@ -48,4 +48,4 @@ run-server: @./dist-server/build/x86_64-linux/ghc-8.0.2/server-0.0.1/c/server/build/server/server watch-server: - @nix-shell -A shells.ghc --run "nodemon --watch ./server --watch ./common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" + @nix-shell -A shells.ghc --run "nodemon --delay 0.1 --watch ./server --watch ./common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" -- cgit v1.2.3 From 42e94a45e26f40edc3ad71b1e77a4bf47c13fd3d Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 15 Nov 2017 23:50:44 +0100 Subject: Add dynamic pages --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 16bf753..ac939fc 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ cp-client: @cp dist-client/build/x86_64-linux/ghcjs-0.2.1/client-0.0.1/c/client/build/client/client.jsexe/all.js public/javascript/main.js watch-client: - @nix-shell -A shells.ghcjs --run "nodemon --delay 0.1 --watch client --watch common --ext hs --exec '(clear && make build-client-inside && make cp-client) || true'" + @nix-shell -A shells.ghcjs --run "nodemon --delay 0.2 --watch client --watch common --ext hs --exec '(clear && make build-client-inside && make cp-client) || true'" # Server # ------ @@ -48,4 +48,4 @@ run-server: @./dist-server/build/x86_64-linux/ghc-8.0.2/server-0.0.1/c/server/build/server/server watch-server: - @nix-shell -A shells.ghc --run "nodemon --delay 0.1 --watch ./server --watch ./common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" + @nix-shell -A shells.ghc --run "nodemon --delay 0.2 --watch ./server --watch ./common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" -- cgit v1.2.3 From 8a28f608d8e08fba4bbe54b46804d261686c3c03 Mon Sep 17 00:00:00 2001 From: Joris Date: Tue, 30 Oct 2018 20:33:17 +0100 Subject: Upgrade reflex-platform --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ac939fc..31d9a62 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ build-client-inside: @cabal --project-file=cabal-client.project --builddir=dist-client new-build all cp-client: - @cp dist-client/build/x86_64-linux/ghcjs-0.2.1/client-0.0.1/c/client/build/client/client.jsexe/all.js public/javascript/main.js + @cp dist-client/build/x86_64-linux/ghcjs-*/client-*/*/client/build/client/client.jsexe/all.js public/javascript/main.js watch-client: @nix-shell -A shells.ghcjs --run "nodemon --delay 0.2 --watch client --watch common --ext hs --exec '(clear && make build-client-inside && make cp-client) || true'" @@ -45,7 +45,7 @@ build-server-inside: run-server: @(fuser -k 3000/tcp &>/dev/null) || : - @./dist-server/build/x86_64-linux/ghc-8.0.2/server-0.0.1/c/server/build/server/server + @./dist-server/build/x86_64-linux/ghc-*/server-0.0.1/*/server/build/server/server watch-server: @nix-shell -A shells.ghc --run "nodemon --delay 0.2 --watch ./server --watch ./common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" -- cgit v1.2.3 From 52331eeadce8d250564851c25fc965172640bc55 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 12 Oct 2019 11:23:10 +0200 Subject: Implement client routing --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 31d9a62..5c615b3 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ cp-client: @cp dist-client/build/x86_64-linux/ghcjs-*/client-*/*/client/build/client/client.jsexe/all.js public/javascript/main.js watch-client: - @nix-shell -A shells.ghcjs --run "nodemon --delay 0.2 --watch client --watch common --ext hs --exec '(clear && make build-client-inside && make cp-client) || true'" + @nix-shell -A shells.ghcjs --run "nodemon --delay 0.2 --watch client --watch common --ext hs --exec '(tput reset && make build-client-inside && make cp-client) || true'" # Server # ------ @@ -48,4 +48,4 @@ run-server: @./dist-server/build/x86_64-linux/ghc-*/server-0.0.1/*/server/build/server/server watch-server: - @nix-shell -A shells.ghc --run "nodemon --delay 0.2 --watch ./server --watch ./common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" + @nix-shell -A shells.ghc --run "nodemon --delay 0.2 --watch ./server --watch ./common --ext hs --exec '(tput reset && make build-server-inside && make run-server) || :'" -- cgit v1.2.3 From bc48d7428607c84003658d5b88d41cf923d010fd Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 18 Jan 2020 16:18:26 +0100 Subject: Add deploy command --- Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5c615b3..5097b56 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,6 @@ start: stop: @tmux kill-session -t sharedCost -dist: - @nix-build -o result-server -A ghc.server - @nix-build -o result-client -A ghcjs.client - @nix-shell -p closurecompiler --command 'closure-compiler result-client/bin/client.jsexe/all.js --js_output_file public/javascript/main.js' - clean: clean-server clean-client build: build-server build-client cp-client @@ -49,3 +44,19 @@ run-server: watch-server: @nix-shell -A shells.ghc --run "nodemon --delay 0.2 --watch ./server --watch ./common --ext hs --exec '(tput reset && make build-server-inside && make run-server) || :'" + +# Deploy +# ------ + +deploy: + @make clean + @nix-build -o result-server -A ghc.server + @nix-build -o result-client -A ghcjs.client + @nix-shell -p closurecompiler --command 'closure-compiler result-client/bin/client.jsexe/all.js --js_output_file public/javascript/main.js' + @rm -rf bundle + @mkdir bundle + @cp application.conf bundle + @cp -r public bundle + @cp result-server/bin/server bundle + @rsync -avzhr bundle/ guyonvarch.me:servers/shared-cost + @rm -rf bundle -- cgit v1.2.3