From 4d76c7eee4a6717961ed9bc365be08c3054b4820 Mon Sep 17 00:00:00 2001 From: nojaf Date: Mon, 11 Mar 2024 10:57:28 +0100 Subject: [PATCH 1/2] Backers as F# script --- .config/dotnet-tools.json | 12 ++++++++++++ backers.fsx | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .config/dotnet-tools.json create mode 100644 backers.fsx diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..e9530e2 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "fable": { + "version": "4.14.0", + "commands": [ + "fable" + ] + } + } +} \ No newline at end of file diff --git a/backers.fsx b/backers.fsx new file mode 100644 index 0000000..0cc9c61 --- /dev/null +++ b/backers.fsx @@ -0,0 +1,34 @@ +#r "nuget: Fable.Fetch, 2.6.0" + +open Fable.Core +open Fetch + +type Member = {| + isActive: bool + role: string + name: string + profile: string + image: string option + company: string option +|} + +fetch "https://opencollective.com/amplifying-fsharp/members/all.json" [] +|> Promise.bind (fun res -> res.json()) +|> Promise.iter (fun json -> + json + |> JS.Constructors.Array.from + |> Array.filter (fun m -> m.isActive && m.role = "BACKER") + |> Array.iter (fun m -> + let markdownImage = + match m.image with + | None -> "" + | Some image -> $"![%s{m.name}](%s{image}&s=50) " + + let andCompany = + match m.company with + | None -> "" + | Some company -> $", %s{company}" + + JS.console.log ($"%s{markdownImage}[%s{m.name}%s{andCompany}](%s{m.profile})\n") + ) +) \ No newline at end of file From 5026e2741f4b9eea25f4639de41fbe459a4e2bcd Mon Sep 17 00:00:00 2001 From: nojaf Date: Tue, 12 Mar 2024 09:12:42 +0100 Subject: [PATCH 2/2] Format dotnet-tools.json --- .config/dotnet-tools.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index e9530e2..0e07099 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -4,9 +4,7 @@ "tools": { "fable": { "version": "4.14.0", - "commands": [ - "fable" - ] + "commands": ["fable"] } } -} \ No newline at end of file +}