diff options
-rw-r--r-- | scratch/habit-screens/client/README.md | 18 | ||||
-rw-r--r-- | website/habit-screens/.envrc (renamed from scratch/habit-screens/client/.envrc) | 0 | ||||
-rw-r--r-- | website/habit-screens/.gitignore (renamed from scratch/habit-screens/client/.gitignore) | 0 | ||||
-rw-r--r-- | website/habit-screens/README.md (renamed from scratch/habit-screens/README.md) | 19 | ||||
-rw-r--r-- | website/habit-screens/default.nix | 53 | ||||
-rw-r--r-- | website/habit-screens/design.md (renamed from scratch/habit-screens/design.md) | 0 | ||||
-rw-r--r-- | website/habit-screens/elm-srcs.nix | 77 | ||||
-rw-r--r-- | website/habit-screens/elm.json (renamed from scratch/habit-screens/client/elm.json) | 0 | ||||
-rw-r--r-- | website/habit-screens/index.css (renamed from scratch/habit-screens/client/index.css) | 0 | ||||
-rw-r--r-- | website/habit-screens/index.html (renamed from scratch/habit-screens/client/index.html) | 0 | ||||
-rw-r--r-- | website/habit-screens/registry.dat | bin | 0 -> 103324 bytes | |||
-rw-r--r-- | website/habit-screens/shell.nix (renamed from scratch/habit-screens/client/shell.nix) | 0 | ||||
-rw-r--r-- | website/habit-screens/src/Habits.elm (renamed from scratch/habit-screens/client/src/Habits.elm) | 0 | ||||
-rw-r--r-- | website/habit-screens/src/Main.elm (renamed from scratch/habit-screens/client/src/Main.elm) | 0 | ||||
-rw-r--r-- | website/habit-screens/src/State.elm (renamed from scratch/habit-screens/client/src/State.elm) | 0 | ||||
-rw-r--r-- | website/habit-screens/src/UI.elm (renamed from scratch/habit-screens/client/src/UI.elm) | 0 | ||||
-rw-r--r-- | website/habit-screens/src/Utils.elm (renamed from scratch/habit-screens/client/src/Utils.elm) | 0 |
17 files changed, 149 insertions, 18 deletions
diff --git a/scratch/habit-screens/client/README.md b/scratch/habit-screens/client/README.md deleted file mode 100644 index 04804ad94fac..000000000000 --- a/scratch/habit-screens/client/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Elm - -Elm has one of the best developer experiences that I'm aware of. The error -messages are helpful and the entire experience is optimized to improve the ease -of writing web applications. - -## Developing - -If you're interested in contributing, the following will create an environment -in which you can develop: - -```shell -$ nix-shell -$ npx tailwindcss build index.css -o output.css -$ elm-live -- src/Main.elm --output=Main.min.js -``` - -You can now view your web client at `http://localhost:8000`! diff --git a/scratch/habit-screens/client/.envrc b/website/habit-screens/.envrc index a4a62da526d3..a4a62da526d3 100644 --- a/scratch/habit-screens/client/.envrc +++ b/website/habit-screens/.envrc diff --git a/scratch/habit-screens/client/.gitignore b/website/habit-screens/.gitignore index 1cb4f3034cc3..1cb4f3034cc3 100644 --- a/scratch/habit-screens/client/.gitignore +++ b/website/habit-screens/.gitignore diff --git a/scratch/habit-screens/README.md b/website/habit-screens/README.md index f0a5be9cabf8..506cdf9c4ac8 100644 --- a/scratch/habit-screens/README.md +++ b/website/habit-screens/README.md @@ -10,3 +10,22 @@ Screens in my bedroom, kitchen, and bathroom, so I will have adequate "cues" to focus my attention. By marking each item as complete and tracking the results over time, I will have more incentive to maintain my consistency (i.e. "reward"). + +## Elm + +Elm has one of the best developer experiences that I'm aware of. The error +messages are helpful and the entire experience is optimized to improve the ease +of writing web applications. + +### Developing + +If you're interested in contributing, the following will create an environment +in which you can develop: + +```shell +$ nix-shell +$ npx tailwindcss build index.css -o output.css +$ elm-live -- src/Main.elm --output=Main.min.js +``` + +You can now view your web client at `http://localhost:8000`! diff --git a/website/habit-screens/default.nix b/website/habit-screens/default.nix new file mode 100644 index 000000000000..19fd1b37c2ed --- /dev/null +++ b/website/habit-screens/default.nix @@ -0,0 +1,53 @@ +{ nixpkgs ? <nixpkgs> +, config ? {} +}: + +with (import nixpkgs config); + +let + mkDerivation = + { srcs ? ./elm-srcs.nix + , src + , name + , srcdir ? "./src" + , targets ? [] + , registryDat ? ./registry.dat + , outputJavaScript ? false + }: + stdenv.mkDerivation { + inherit name src; + + buildInputs = [ elmPackages.elm ] + ++ lib.optional outputJavaScript nodePackages_10_x.uglify-js; + + buildPhase = pkgs.elmPackages.fetchElmDeps { + elmPackages = import srcs; + elmVersion = "0.19.1"; + inherit registryDat; + }; + + installPhase = let + elmfile = module: "${srcdir}/${builtins.replaceStrings ["."] ["/"] module}.elm"; + extension = if outputJavaScript then "js" else "html"; + in '' + mkdir -p $out/share/doc + ${lib.concatStrings (map (module: '' + echo "compiling ${elmfile module}" + elm make ${elmfile module} --output $out/${module}.${extension} --docs $out/share/doc/${module}.json + ${lib.optionalString outputJavaScript '' + echo "minifying ${elmfile module}" + uglifyjs $out/${module}.${extension} --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' \ + | uglifyjs --mangle --output=$out/${module}.min.${extension} + ''} + '') targets)} + ''; + }; +in mkDerivation { + name = "elm-app-0.1.0"; + srcs = ./elm-srcs.nix; + src = ./.; + targets = ["Main"]; + srcdir = "./src"; + outputJavaScript = false; +} + diff --git a/scratch/habit-screens/design.md b/website/habit-screens/design.md index f16361ac4358..f16361ac4358 100644 --- a/scratch/habit-screens/design.md +++ b/website/habit-screens/design.md diff --git a/website/habit-screens/elm-srcs.nix b/website/habit-screens/elm-srcs.nix new file mode 100644 index 000000000000..167708e072b0 --- /dev/null +++ b/website/habit-screens/elm-srcs.nix @@ -0,0 +1,77 @@ +{ + + "elm-community/maybe-extra" = { + sha256 = "0qslmgswa625d218djd3p62pnqcrz38f5p558mbjl6kc1ss0kzv3"; + version = "5.2.0"; + }; + + "elm/html" = { + sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k"; + version = "1.0.0"; + }; + + "elm-community/random-extra" = { + sha256 = "1dg2nz77w2cvp16xazbdsxkkw0xc9ycqpkd032faqdyky6gmz9g6"; + version = "3.1.0"; + }; + + "elm/svg" = { + sha256 = "1cwcj73p61q45wqwgqvrvz3aypjyy3fw732xyxdyj6s256hwkn0k"; + version = "1.0.1"; + }; + + "justinmimbs/date" = { + sha256 = "1f0wcl8yhlvp3x4rj53rdy4r4ga7lkl6n8fdfh6b96scz2rnxmd4"; + version = "3.2.1"; + }; + + "elm/browser" = { + sha256 = "0nagb9ajacxbbg985r4k9h0jadqpp0gp84nm94kcgbr5sf8i9x13"; + version = "1.0.2"; + }; + + "elm/core" = { + sha256 = "19w0iisdd66ywjayyga4kv2p1v9rxzqjaxhckp8ni6n8i0fb2dvf"; + version = "1.0.5"; + }; + + "elm-community/list-extra" = { + sha256 = "1ayv3148drynqnxdfwpjxal8vwzgsjqanjg7yxp6lhdcbkxgd3vd"; + version = "8.2.3"; + }; + + "elm/random" = { + sha256 = "138n2455wdjwa657w6sjq18wx2r0k60ibpc4frhbqr50sncxrfdl"; + version = "1.0.0"; + }; + + "elm/time" = { + sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1"; + version = "1.0.0"; + }; + + "elm/json" = { + sha256 = "0kjwrz195z84kwywaxhhlnpl3p251qlbm5iz6byd6jky2crmyqyh"; + version = "1.1.3"; + }; + + "elm/parser" = { + sha256 = "0a3cxrvbm7mwg9ykynhp7vjid58zsw03r63qxipxp3z09qks7512"; + version = "1.1.0"; + }; + + "owanturist/elm-union-find" = { + sha256 = "13gm7msnp0gr1lqia5m7m4lhy3m6kvjg37d304whb3psn88wqhj5"; + version = "1.0.0"; + }; + + "elm/url" = { + sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4"; + version = "1.0.0"; + }; + + "elm/virtual-dom" = { + sha256 = "0q1v5gi4g336bzz1lgwpn5b1639lrn63d8y6k6pimcyismp2i1yg"; + version = "1.0.2"; + }; +} diff --git a/scratch/habit-screens/client/elm.json b/website/habit-screens/elm.json index 6839ac4fabdc..6839ac4fabdc 100644 --- a/scratch/habit-screens/client/elm.json +++ b/website/habit-screens/elm.json diff --git a/scratch/habit-screens/client/index.css b/website/habit-screens/index.css index b5c61c956711..b5c61c956711 100644 --- a/scratch/habit-screens/client/index.css +++ b/website/habit-screens/index.css diff --git a/scratch/habit-screens/client/index.html b/website/habit-screens/index.html index b587e0901284..b587e0901284 100644 --- a/scratch/habit-screens/client/index.html +++ b/website/habit-screens/index.html diff --git a/website/habit-screens/registry.dat b/website/habit-screens/registry.dat new file mode 100644 index 000000000000..d2671b2cf17a --- /dev/null +++ b/website/habit-screens/registry.dat Binary files differdiff --git a/scratch/habit-screens/client/shell.nix b/website/habit-screens/shell.nix index 00bb4b0b3edc..00bb4b0b3edc 100644 --- a/scratch/habit-screens/client/shell.nix +++ b/website/habit-screens/shell.nix diff --git a/scratch/habit-screens/client/src/Habits.elm b/website/habit-screens/src/Habits.elm index bbd5887f8bd5..bbd5887f8bd5 100644 --- a/scratch/habit-screens/client/src/Habits.elm +++ b/website/habit-screens/src/Habits.elm diff --git a/scratch/habit-screens/client/src/Main.elm b/website/habit-screens/src/Main.elm index 2ddedb913357..2ddedb913357 100644 --- a/scratch/habit-screens/client/src/Main.elm +++ b/website/habit-screens/src/Main.elm diff --git a/scratch/habit-screens/client/src/State.elm b/website/habit-screens/src/State.elm index c75c99322249..c75c99322249 100644 --- a/scratch/habit-screens/client/src/State.elm +++ b/website/habit-screens/src/State.elm diff --git a/scratch/habit-screens/client/src/UI.elm b/website/habit-screens/src/UI.elm index 5b5426913570..5b5426913570 100644 --- a/scratch/habit-screens/client/src/UI.elm +++ b/website/habit-screens/src/UI.elm diff --git a/scratch/habit-screens/client/src/Utils.elm b/website/habit-screens/src/Utils.elm index 23b13c224c68..23b13c224c68 100644 --- a/scratch/habit-screens/client/src/Utils.elm +++ b/website/habit-screens/src/Utils.elm |