From 45e513c5ade61954e9082887a27a8c1d45b20f85 Mon Sep 17 00:00:00 2001 From: m1kadev <67912368+m1kadev@users.noreply.github.com> Date: Sun, 21 Dec 2025 23:00:04 +0100 Subject: [PATCH] new thought --- build.exs | 13 ++++++++++--- thoughts/colours | 1 - thoughts/html | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) delete mode 100644 thoughts/colours create mode 100644 thoughts/html diff --git a/build.exs b/build.exs index 5638fbd72b2dd54dfcabcbe37432c55cca4c0292..1ccc004c7be174429a4fc9a7327e45502d21f028 100644 --- a/build.exs +++ b/build.exs @@ -8,6 +8,13 @@ Mix.install([ Calendar.put_time_zone_database(Tzdata.TimeZoneDatabase) +defmodule Git do + def get_file_commit(path) do + {ts_string, 0} = System.cmd("git", ["log", "--format=%ct", path]) + String.to_integer(String.trim_trailing(ts_string)) + end +end + defmodule Templates do binfo_template = """ commit=<%= commit %>lightningcss=<%= lightningcss %>html_minifier_next=<%= html_minifier_next %>uglifyjs=<%= uglifyjs %>build_time=<%= build_time %> @@ -210,9 +217,9 @@ File.mkdir_p("build/pastes") pastes = Path.wildcard("pastes/**/*") - |> Enum.map(fn x -> {x, FileX.created(x)} end) + |> Enum.map(fn path -> {path, Git.get_file_commit(path)} end) |> Enum.sort_by(fn {_, t} -> t end, :desc) - |> Enum.map(fn {x, _} -> x end) + |> Enum.map(fn {path, _} -> path end) pastes |> Task.async_stream(fn file -> Builders.paste(file, paste_template, bricks) end) @@ -245,7 +252,7 @@ thoughts_template = File.read!("templates/thoughts.html") thoughts = Path.wildcard("thoughts/**/*") - |> Enum.map(fn path -> {path, FileX.created(path)} end) + |> Enum.map(fn path -> {path, Git.get_file_commit(path)} end) |> Enum.sort_by(fn {_, t} -> t end, :desc) |> Enum.map(fn {path, date} -> Builders.thought(path, date) end) |> Enum.join("
") diff --git a/thoughts/colours b/thoughts/colours deleted file mode 100644 index 52f5907527f041d8e8b47327389782d6348a21a6..0000000000000000000000000000000000000000 --- a/thoughts/colours +++ /dev/null @@ -1 +0,0 @@ -colours are so cool :)) shame i cant use them :(( \ No newline at end of file diff --git a/thoughts/html b/thoughts/html new file mode 100644 index 0000000000000000000000000000000000000000..17858ac43e7028590ee8a2240cd09b9f606603a3 --- /dev/null +++ b/thoughts/html @@ -0,0 +1 @@ +html is a really nice format its just that we kinda fucked it up :(( \ No newline at end of file