My personal website, in gleam+lustre!
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Automatically toggling arivertisements and updated deps while I was at it.


Signed-off-by: MLC Bloeiman <mar@strawmelonjuice.com>

+28 -17
+11 -3
dev/homepage/prepare.gleam
··· 1 1 //// Most of this file was borrowed from the project that was replaced by this: 2 2 //// https://forge.strawmelonjuice.com/CynthiaWebsiteEngine/ByYou/src/branch/main/by-you/src/byyou/cli.gleam 3 3 4 + import argv 5 + import gleam/bool 4 6 import gleam/erlang/application 5 7 import gleam/int 6 8 import gleam/io ··· 41 43 } 42 44 43 45 pub fn main() { 44 - case embed_files() { 46 + let prod_mode = argv.load().arguments |> list.contains("--prod") 47 + 48 + case embed_data(prod_mode) { 45 49 Ok(_) -> Nil 46 50 Error(msg) -> panic as msg 47 51 } ··· 133 137 |> Ok 134 138 } 135 139 136 - fn embed_files() { 140 + fn embed_data(prod_mode: Bool) { 137 141 use files <- result.try(list_files()) 138 142 139 143 use dir <- result.try( ··· 164 168 simplifile.write( 165 169 "./src/homepage/from_prebuild/data.gleam", 166 170 assertive_priv_file_read("codegen-templates/data.gleam") 167 - |> string.replace("todo as \"templated:files\"", files), 171 + |> string.replace("todo as \"templated:files\"", files) 172 + |> string.replace( 173 + "pub const arrivertisements_show = False", 174 + "pub const arrivertisements_show = " <> bool.to_string(prod_mode), 175 + ), 168 176 ) 169 177 |> result.replace_error( 170 178 "❌\tSomething went wrong writing `src/homepage/from_prebuild/data.gleam`.",
+2 -1
gleam.toml
··· 9 9 chilp = ">= 1.0.0 and < 2.0.0" 10 10 gleam_time = ">= 1.7.0 and < 2.0.0" 11 11 webls = ">= 1.6.1 and < 2.0.0" 12 - glentities = ">= 6.2.1 and < 7.0.0" 13 12 14 13 [dev-dependencies] 14 + glentities = ">= 6.2.1 and < 7.0.0" 15 15 lustre_dev_tools = ">= 2.3.4 and < 3.0.0" 16 16 simplifile = ">= 2.3.2 and < 3.0.0" 17 17 gleam_erlang = ">= 1.3.0 and < 2.0.0" 18 18 gleam_json = ">= 3.1.0 and < 4.0.0" 19 + argv = ">= 1.0.2 and < 2.0.0" 19 20 20 21 [tools.lustre] 21 22 bin.bun = "system"
+5 -4
justfile
··· 5 5 @just --list 6 6 7 7 # Run pre-build scripts, among which file embedding! 8 - prepare: 8 + prepare *FLAGS: 9 9 mkdir -p src/homepage/from_prebuild 10 10 cp --update=none priv/codegen-templates/data.gleam src/homepage/from_prebuild/data.gleam 11 - gleam run -m homepage/prepare 11 + gleam run -m homepage/prepare {{FLAGS}} 12 12 tailwindcss -i ./site.css -o ./assets/styles.css -m 13 13 14 - # Produce a JavaScript bundle in dist. 15 - build: prepare 14 + # Produce a production mode site bundle in dist. 15 + build: 16 + just prepare -- --prod 16 17 rm -fr ./dist 17 18 gleam run -m lustre/dev build 18 19
+5 -4
manifest.toml
··· 34 34 { name = "justin", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "7FA0C6DB78640C6DC5FBFD59BF3456009F3F8B485BF6825E97E1EB44E9A1E2CD" }, 35 35 { name = "logging", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "1098FBF10B54B44C2C7FDF0B01C1253CAFACDACABEFB4B0D027803246753E06D" }, 36 36 { name = "lustre", version = "5.6.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "EE558CD4DB9F09FCC16417ADF0183A3C2DAC3E4B21ED3AC0CAE859792AB810CA" }, 37 - { name = "lustre_dev_tools", version = "2.3.4", build_tools = ["gleam"], requirements = ["argv", "booklet", "filepath", "gleam_community_ansi", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_httpc", "gleam_json", "gleam_otp", "gleam_regexp", "gleam_stdlib", "glint", "group_registry", "justin", "lustre", "mist", "polly", "simplifile", "tom", "wisp"], otp_app = "lustre_dev_tools", source = "hex", outer_checksum = "5D5C479E465A3EA018205EFCD2F2FE430A9B9783CAC21670E6CB25703069407D" }, 37 + { name = "lustre_dev_tools", version = "2.3.5", build_tools = ["gleam"], requirements = ["argv", "booklet", "filepath", "gleam_community_ansi", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_httpc", "gleam_json", "gleam_otp", "gleam_regexp", "gleam_stdlib", "glint", "group_registry", "justin", "lustre", "mist", "polly", "simplifile", "tom", "wisp"], otp_app = "lustre_dev_tools", source = "hex", outer_checksum = "0B376F4057AB6E0FB5D48DFED9943D48571968D132EBD67EAED0A21EA29027FE" }, 38 38 { name = "marceau", version = "1.3.0", build_tools = ["gleam"], requirements = [], otp_app = "marceau", source = "hex", outer_checksum = "2D1C27504BEF45005F5DFB18591F8610FB4BFA91744878210BDC464412EC44E9" }, 39 39 { name = "mist", version = "5.0.4", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "gleam_yielder", "glisten", "gramps", "hpack_erl", "logging"], otp_app = "mist", source = "hex", outer_checksum = "7CED4B2D81FD547ADB093D97B9928B9419A7F58B8562A30A6CC17A252B31AD05" }, 40 40 { name = "modem", version = "2.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre"], otp_app = "modem", source = "hex", outer_checksum = "3F9682EBCBF4D26045F1038A7507E8C7967E49D43F9CA6BA68EF0C971B195A7F" }, 41 41 { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" }, 42 42 { name = "polly", version = "3.1.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_erlang", "gleam_otp", "gleam_stdlib", "simplifile"], otp_app = "polly", source = "hex", outer_checksum = "51FB565D81FF6212FDF3306D44419601F2A7C4EDD1F00FC9DA5C376A00AED4FE" }, 43 43 { name = "rsvp", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_fetch", "gleam_http", "gleam_httpc", "gleam_javascript", "gleam_json", "gleam_stdlib", "lustre"], otp_app = "rsvp", source = "hex", outer_checksum = "40F9E0E662FF258E10C7041A9591261FE802D56625FB444B91510969644F7722" }, 44 - { name = "simplifile", version = "2.3.2", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "E049B4DACD4D206D87843BCF4C775A50AE0F50A52031A2FFB40C9ED07D6EC70A" }, 44 + { name = "simplifile", version = "2.4.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "7C18AFA4FED0B4CE1FA5B0B4BAC1FA1744427054EA993565F6F3F82E5453170D" }, 45 45 { name = "snag", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "274F41D6C3ECF99F7686FDCE54183333E41D2C1CA5A3A673F9A8B2C7A4401077" }, 46 46 { name = "splitter", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "splitter", source = "hex", outer_checksum = "3DFD6B6C49E61EDAF6F7B27A42054A17CFF6CA2135FF553D0CB61C234D281DD0" }, 47 - { name = "telemetry", version = "1.4.0", build_tools = ["rebar3"], requirements = [], otp_app = "telemetry", source = "hex", outer_checksum = "D1FF426F988AC1092F9D684D34D08E51042A70567C16BE793FBC8F399FD2E77D" }, 47 + { name = "telemetry", version = "1.4.1", build_tools = ["rebar3"], requirements = [], otp_app = "telemetry", source = "hex", outer_checksum = "2172E05A27531D3D31DD9782841065C50DD5C3C7699D95266B2EDD54C2DAFA1C" }, 48 48 { name = "tom", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_time"], otp_app = "tom", source = "hex", outer_checksum = "90791DA4AACE637E30081FE77049B8DB850FBC8CACC31515376BCC4E59BE1DD2" }, 49 49 { name = "webls", version = "1.6.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_time"], otp_app = "webls", source = "hex", outer_checksum = "40317445399BFBBDCE8D5976C84ACD92319D4A6F1500A926F19AFCC9ED6639F1" }, 50 - { name = "wisp", version = "2.2.0", build_tools = ["gleam"], requirements = ["directories", "exception", "filepath", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "655163D4DE19E3DD4AC75813A991BFD5523CB4FF2FC5F9F58FD6FB39D5D1806D" }, 50 + { name = "wisp", version = "2.2.1", build_tools = ["gleam"], requirements = ["directories", "exception", "filepath", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "6E37308F4F8C45B5D3F2A2DC71BDE4DA6AD2F7978D26A7C8D6790CE275C8614E" }, 51 51 ] 52 52 53 53 [requirements] 54 + argv = { version = ">= 1.0.2 and < 2.0.0" } 54 55 chilp = { version = ">= 1.0.0 and < 2.0.0" } 55 56 gleam_erlang = { version = ">= 1.3.0 and < 2.0.0" } 56 57 gleam_json = { version = ">= 3.1.0 and < 4.0.0" }
+4
priv/codegen-templates/data.gleam
··· 1 1 import gleam/dict 2 2 3 + /// We want to disable this while previewing, as to not spam ari.lt with 4 + /// requests due to autoreloading. 5 + pub const arrivertisements_show = False 6 + 3 7 pub fn files() { 4 8 dict.from_list(todo as "templated:files") 5 9 }
+1 -5
src/homepage.gleam
··· 1 - /// We want to disable this while previewing, as to not spam ari.lt with 2 - /// requests due to autoreloading. 3 - const arrivertisements_show = False 4 - 5 1 /// Post data ------------------------------------------------------------------- 6 2 /// 7 3 /// Some special tags: ··· 1057 1053 "bg-accent mt-4 text-accent-content mx-auto max-w-2xl md:rounded-md md:mb-14 p-2 md:p-12 md:h-fit", 1058 1054 ), 1059 1055 ], 1060 - case arrivertisements_show { 1056 + case data.arrivertisements_show { 1061 1057 True -> { 1062 1058 [ 1063 1059 badges_ |> element.fragment(),