···11+# page
22+33+[](https://hex.pm/packages/page)
44+[](https://hexdocs.pm/page/)
55+66+```sh
77+gleam add page@1
88+```
99+```gleam
1010+import page
1111+1212+pub fn main() -> Nil {
1313+ // TODO: An example of the project in use
1414+}
1515+```
1616+1717+Further documentation can be found at <https://hexdocs.pm/page>.
1818+1919+## Development
2020+2121+```sh
2222+gleam run # Run the project
2323+gleam test # Run the tests
2424+```
+32
flake.nix
···11+{
22+ description = "page dev env";
33+44+ inputs = {
55+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
66+ utils.url = "github:numtide/flake-utils";
77+ };
88+99+ outputs = { self, nixpkgs, utils }:
1010+ utils.lib.eachDefaultSystem (system:
1111+ let
1212+ pkgs = import nixpkgs { inherit system; };
1313+ in
1414+ {
1515+ devShells.default = pkgs.mkShell {
1616+ buildInputs = with pkgs; [
1717+ gleam
1818+ erlang_28
1919+ rebar3
2020+ bun
2121+ just
2222+ ];
2323+2424+ shellHook = ''
2525+ echo "page dev env loaded"
2626+ just --list
2727+ echo "Use just to run them."
2828+ '';
2929+ };
3030+ });
3131+}
3232+
+25
gleam.toml
···11+name = "doodler"
22+version = "1.0.0"
33+target = "javascript"
44+55+# Fill out these fields if you intend to generate HTML documentation or publish
66+# your project to the Hex package manager.
77+#
88+# description = ""
99+# licences = ["Apache-2.0"]
1010+# repository = { type = "github", user = "", repo = "" }
1111+# links = [{ title = "Website", href = "" }]
1212+#
1313+# For a full reference of all the available options, you can have a look at
1414+# https://gleam.run/writing-gleam/gleam-toml/.
1515+1616+[javascript]
1717+runtime = "bun"
1818+1919+[dependencies]
2020+gleam_stdlib = ">= 0.44.0 and < 2.0.0"
2121+lustre = ">= 5.3.5 and < 6.0.0"
2222+2323+[dev-dependencies]
2424+gleeunit = ">= 1.0.0 and < 2.0.0"
2525+lustre_dev_tools = ">= 2.1.3 and < 3.0.0"
+32
justfile
···11+default:
22+ @just --list
33+44+# Run a dev server using lustre/dev start
55+dev:
66+ gleam run -m lustre/dev start
77+88+# Build the SPA
99+build:
1010+ gleam run -m lustre/dev build
1111+1212+1313+roll-back:
1414+ # move copy from /srv/doodler/previous to /srv/doodler/
1515+ ssh deploy-doodler@gitlab "cp /srv/doodler/previous/* /srv/doodler/"
1616+1717+# Deploy doodler to my server
1818+deploy: build
1919+ #!/bin/zsh
2020+ ssh deploy-doodler@gitlab "
2121+ # ignore errors since the following 2 steps would otherwise have issues
2222+ set +e
2323+ # create copy of previous version in /srv/doodler/previous
2424+ cp /srv/doodler/* /srv/doodler/previous
2525+ # remove previous version -- /srv/doodler/previous will be ignored
2626+ rm /srv/doodler/*
2727+ "
2828+2929+ # copy current version to /srv/doodler/
3030+ scp ./dist/* deploy-doodler@gitlab:/srv/doodler
3131+3232+