diff options
author | Joris | 2020-01-30 11:35:31 +0000 |
---|---|---|
committer | Joris | 2020-01-30 11:35:31 +0000 |
commit | 960fa7cb7ae4c57d01306f78cd349f3a8337d0ab (patch) | |
tree | 5077cc720525fb025e4dba65a9a8b631862cbcc8 /Makefile | |
parent | 14bdbc8c937f5d0b35c61350dba28cb41c3737cd (diff) | |
parent | 6a04e640955051616c3ad0874605830c448f2d75 (diff) |
Merge branch 'with-ghcjs' into 'master'
Use Haskell on the frontend
See merge request guyonvarch/shared-cost!2
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 69 |
1 files changed, 43 insertions, 26 deletions
@@ -1,45 +1,62 @@ start: - @nix-shell --command "mux local" + @nix-shell tools.nix --command "tmuxinator local" stop: @tmux kill-session -t sharedCost -dist: - @nix-shell --command "make clean install build" - clean: clean-server clean-client -install: install-server install-client -build: build-server build-client -# Server +build: build-server build-client cp-client + +# Client # ------ -clean-server: - @stack clean > /dev/null +clean-client: + @rm -rf dist-client -install-server: - @stack setup +build-client: + @nix-shell -A shells.ghcjs --run "make build-client-inside" -build-server: - @stack build || : +build-client-inside: + @cabal --project-file=cabal-client.project --builddir=dist-client new-build all -launch-server: - @(killall sharedCost || :) && stack exec sharedCost +cp-client: + @cp dist-client/build/x86_64-linux/ghcjs-*/client-*/*/client/build/client/client.jsexe/all.js public/javascript/main.js -watch-server: - @nodemon -e hs,conf --exec 'clear && make build-server --silent && make launch-server' +watch-client: + @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'" -# Client +# Server # ------ -clean-client: - @rm -r elm-stuff >/dev/null 2>&1 || true +clean-server: + @rm -rf dist-server -install-client: - @elm package install --yes +build-server: + @nix-shell -A shells.ghc --run "make build-server-inside" -build-client: - @elm make src/client/Main.elm --output public/javascripts/client.js || true +build-server-inside: + @cabal --project-file=cabal-server.project --builddir=dist-server new-build all -watch-client: - @nodemon -e elm --exec 'clear && make build-client --silent' +run-server: + @(fuser -k 3000/tcp &>/dev/null) || : + @./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 '(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 |