Week 14 of 2021
Development log of Word Snake
7 items
Move boilerplate and auxiliary code to Makefile.d/
On by
index 4beef7a..3be6dd7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,7 @@
=entrypoints = src/index.html
=public-url ?= /
=
-SHELL := bash
-.SHELLFLAGS := -eu -o pipefail -c
-.ONESHELL:
-.DELETE_ON_ERROR:
-MAKEFLAGS += --warn-undefined-variables
-MAKEFLAGS += --warn-undefined-functions
-MAKEFLAGS += --no-builtin-rules
+include Makefile.d/defaults.mk
=
=all: ## Run unit tests and build the program (DEFAULT)
=all: dist
@@ -19,7 +13,7 @@ help: # TODO: Handle section headers in awk script
= @echo
= @echo "Available goals:"
= @echo
- @cat $(MAKEFILE_LIST) | awk -f make-goals.awk
+ @cat $(MAKEFILE_LIST) | awk -f Makefile.d/make-goals.awk
=.PHONY: help
=
=dist: ## Build the program to the dist/ directorynew file mode 100644
index 0000000..28a8897
--- /dev/null
+++ b/Makefile.d/defaults.mk
@@ -0,0 +1,19 @@
+# Default settings for Make
+
+# Always use strict bash
+SHELL := bash
+.SHELLFLAGS := -eu -o pipefail -c
+.ONESHELL:
+
+# If a recipe fails, delete it's targets to avoid broken state
+.DELETE_ON_ERROR:
+
+# Warn about undefined variables and
+# TODO: How to make it an error, like in bash strict mode?
+# TODO: Consider https://www.artificialworlds.net/blog/2015/04/22/treat-warnings-as-errors-in-a-gnu-makefile/
+MAKEFLAGS += --warn-undefined-variables
+MAKEFLAGS += --warn-undefined-functions
+
+# Remove implicit rules - no magic please
+# See https://www.gnu.org/software/make/manual/html_node/Catalogue-of-Rules.html
+MAKEFLAGS += --no-builtin-rulessimilarity index 100%
rename from make-goals.awk
rename to Makefile.d/make-goals.awkCI: Revert failed experiment
On by
index f27b567..c73af3c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,12 +5,18 @@ dist:
=
= before_script:
= - nix-channel --update
+
= - nix-env --install --attr
- nixpkgs.bash
= nixpkgs.nixFlakes
= nixpkgs.git
- - bash
- - source <(nix --experimental-features "nix-command flakes" print-dev-env)
+ nixpkgs.bash
+ nixpkgs.gnumake
+ nixpkgs.jq
+ nixpkgs.cachix
+
+ # TODO: Prepare a flake builder image with bash, git, etc. Then use the
+ # following to get development environment
+ # - source <(nix --experimental-features "nix-command flakes" print-dev-env)
=
= script:
= - make resultMerge branch 'make-love' into 'master'
On by
Improve the Makefile
See merge request software-garden/word-snake!14
The game will go full screen when play button is clicked
On by
There was some weird issue with background color. I solved it by
repeating the background property of body on html.
index 6c42e25..7e87a93 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -15,6 +15,9 @@ import RemoteData exposing (WebData)
=import Time
=
=
+port fullscreen : () -> Cmd msg
+
+
=port goalTracking : ( String, Int ) -> Cmd msg
=
=
@@ -394,9 +397,12 @@ update msg model =
=
= StartButtonClicked ->
= ( model
- , model.levels
- |> RemoteData.map (generateRandomGameFlags GotRandomGameFlags)
- |> RemoteData.withDefault Cmd.none
+ , Cmd.batch
+ [ fullscreen ()
+ , model.levels
+ |> RemoteData.map (generateRandomGameFlags GotRandomGameFlags)
+ |> RemoteData.withDefault Cmd.none
+ ]
= )
=
= CountdownClockTick _ ->
@@ -442,6 +448,7 @@ update msg model =
= ( model
= , [ generateRandomGameFlags GotRandomGameFlags rescheduledLevels
= , trackGoal
+ , fullscreen ()
= ]
= |> Cmd.batch
= )index 338783d..22d139c 100644
--- a/src/index.coffee
+++ b/src/index.coffee
@@ -25,6 +25,9 @@ document.addEventListener "keydown", (event) =>
= do event.preventDefault
= game.ports.keydown.send event
=
+game.ports.fullscreen.subscribe () =>
+ document.body.requestFullscreen? {}
+
=game.ports.goalTracking.subscribe ([goal, value]) =>
= if process.env.NODE_ENV is "production"
= fathom.trackGoal goal, valueindex 677695c..76ad605 100644
--- a/src/index.html
+++ b/src/index.html
@@ -36,6 +36,7 @@
= margin: 0;
= padding: 0;
= font-family: sans-serif;
+ background: hsl(0, 0%, 86%);
= }
=
= body, [data-elm-hot] {Position the outcome message higher
On by
So that it is fully visible on smaller viewports (e.g. phones).
index 7e87a93..58d721c 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -273,7 +273,7 @@ curtainView countdown game =
= , Html.Attributes.style "left" "0"
= , Html.Attributes.style "right" "0"
= , Html.Attributes.style "display" "flex"
- , Html.Attributes.style "align-items" "center"
+ , Html.Attributes.style "padding-top" "20%"
= , Html.Attributes.style "justify-content" "center"
= , Html.Attributes.style "background" "hsla(0,0%,0%,80%)"
= , Html.Attributes.style "animation-name" "overlay"Merge branch 'fullscreen' into 'master'
On by
The game will go full screen when play button is clicked
See merge request software-garden/word-snake!15
Add merge request template with a checklist
On by
Closes #2.
new file mode 100644
index 0000000..99598e7
--- /dev/null
+++ b/.gitlab/merge_request_templates/default.md
@@ -0,0 +1,8 @@
+Before merging please make sure that:
+
+- [ ] It works as expected in Firefox on Linux, Mac or Windows (one is enough)
+- [ ] It works as expected in Chromium on Linux, Mac or Windows (one is enough)
+- [ ] It works as expected in Safari on Linux, Mac or Windows (one is enough)
+- [ ] It works as expected in Chrome on Android
+- [ ] It works as expected in Firefox on Android
+- [ ] It works as expected in Safari on iOS