Skip to content

Commit

Permalink
And a generator and content for the first issue (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
CrowdHailer committed Mar 23, 2024
1 parent ab8be8f commit 553ee41
Show file tree
Hide file tree
Showing 18 changed files with 811 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# [Gleam Weekly](https://gleamweekly.com/)

Handpicked articles and community news delivered to your inbox in one weekly email.

## `/mailer`

Script to build archive of issues and current email content.

```
(cd mailer; gleam run)
```

The output of this command is committed, see `email.html` and `website/issues`.
This output is used as the test suite. Any changes in output as a result of changing the build tooling can be checked by looking at the effect on previous issues.

## Future improvements

Things I haven't had time to build but that would be nice.

- Social previews, so that sharing links to issues or pages so some nice content.
- RSS feed.
- Index page.
- Render latest issue on homepage.
- Date -> issue functionality.
129 changes: 129 additions & 0 deletions email.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<!DOCTYPE html>

<html
lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:o="urn:schemas-microsoft-com:office:office"
>
<head>
<meta charset="UTF-8" />

<meta name="viewport" content="width=device-width,initial-scale=1" />

<meta name="x-apple-disable-message-reformatting" />
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />

<title></title>

<!--[if mso]>
<noscript>
<xml>
<o:OfficeDocumentSettings>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
</noscript>
<![endif]-->
</head>
<body style="margin: 0; padding: 0">
<table
role="presentation"
style="
width: 100%;
border-collapse: collapse;
border: 0;
border-spacing: 0;
background: #ffffff;
"
>
<tr>
<td align="center" style="padding: 0">
<table
role="presentation"
style="
width: 602px;
border-collapse: collapse;
border: 1px solid #cccccc;
border-spacing: 0;
text-align: left;
"
>
<tr>
<td style="padding: 0"><div style="font-family:Helvetica, Arial, sans-serif;line-height:1.5;"><div style="padding:.5rem 1.5rem;background:#fffbe8;"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="vertical-align:text-bottom;"><img src="https://gleamweekly.com/lucymail.png" width="80" height="64" style="width:80px;height:64px;vertical-align:text-bottom;margin-bottom:-30px;margin-top:-10px;"><span style="font-size:1.5rem;color:#151515;font-weight:bold;"><a href="https://gleamweekly.com/" style="text-decoration:none;color:#151515;">Gleam Weekly</a></span><span style="color:#584355;"> by <a href="https://twitter.com/crowdhailer" style="text-decoration:none;color:#151515;">@Crowdhailer</a></span></td><td align="right" style="text-align:right;vertical-align:text-bottom;"><a href="https://gleamweekly.com/issues/1" style="font-size:1.5rem;text-decoration:none;color:#151515;">Issue #1</a></td></tr></tbody></table></div><div style="padding:1.5rem 1.5rem 0rem 1.5rem;"><div style="color:#2f2f2f;font-size:1.25rem;font-weight:bold;">This week in Gleam</div><p><a href="https://gleam.run/news/gleam-version-1/" style="font-size:1.125rem;text-decoration:underline;">Gleam version 1</a><br><span style="color:#2f2f2f;">Today Gleam v1.0.0 has been released! This is the first “stable” release of the language and a big milestone for the ecosystem.</span></p><p><a href="https://0xca551e.github.io/n-sided-lucy/" style="font-size:1.125rem;text-decoration:underline;">n-sided-lucy</a><br><span style="color:#2f2f2f;">Create lucys of all sorts.</span></p><p><a href="https://github.com/MystPi/pprint" style="font-size:1.125rem;text-decoration:underline;">pprint 1.0</a><br><span style="color:#2f2f2f;">A simple pretty printer for debugging and testing.</span></p><p><a href="https://github.com/Acepie/p5js_gleam" style="font-size:1.125rem;text-decoration:underline;">p5js_gleam</a><br><span style="color:#2f2f2f;">A demo showcasing how to create and use bindings to create a little animation site with p5js.</span></p></div><div style="padding:1.5rem 1.5rem 0rem 1.5rem;"><div style="color:#2f2f2f;font-size:1.25rem;font-weight:bold;">Even more great Gleam stuff</div><p><a href="https://github.com/tovedetered/xmleam" style="font-size:1.125rem;text-decoration:underline;">A lean XML builder for Gleam</a> <span style="background-color:#fffbe8;color:#151515;border-radius:3px;padding:3px;font-size:12px;">Project update</span></p><p><a href="https://dev.to/bitcrshr/binary-data-in-gleam-implementing-the-rcon-protocol-2684" style="font-size:1.125rem;text-decoration:underline;">Binary Data in Gleam: Implementing The RCON Protocol</a> <span style="background-color:#292d3e;color:#fefefc;border-radius:3px;padding:3px;font-size:12px;">Blog post</span></p><p><a href="https://www.youtube.com/watch?v=NyKIvWvr9kw" style="font-size:1.125rem;text-decoration:underline;">Gleam for Impatient Devs</a> <span style="background-color:#ffaff3;color:#151515;border-radius:3px;padding:3px;font-size:12px;">Video</span></p><p><a href="https://github.com/LilyRose2798/typed_headers" style="font-size:1.125rem;text-decoration:underline;">Types for HTTP headers</a> <span style="background-color:#fffbe8;color:#151515;border-radius:3px;padding:3px;font-size:12px;">Project update</span></p><p><a href="https://ryanbrewer.dev/posts/simple-programming-languages.html" style="font-size:1.125rem;text-decoration:underline;">Simple Programming Languages</a> <span style="background-color:#292d3e;color:#fefefc;border-radius:3px;padding:3px;font-size:12px;">Blog post</span></p></div><div style="background:#fffbe8;padding:1.5rem 1.5rem 0rem 1.5rem;"><div style="text-align:center;padding:25px;"><a href="https://discord.com/channels/768594524158427167/1047101890707603547" style="background:#584355;padding:15px 20px;border-radius:30px;color:#fefefc;text-decoration:none;">Share your own Gleam news</a></div><p style="margin-bottom:0;">That&#39;s all for this week, have a lovely day.<br><a href="https://twitter.com/crowdhailer" style="text-decoration:none;">@Crowdhailer</a> from <a href="https://gleamweekly.com/" style="text-decoration:none;">Gleam Weekly</a><br><br>If you enjoyed this update, please tell your friends<br>This issue is available, and shareable, at <a href="https://gleamweekly.com/issues/1">gleamweekly.com/issues/1</a><br><br></p></div></div></td>
</tr>
</table>
<table
role="presentation"
style="
width: 602px;
border-collapse: collapse;
border-spacing: 0;
text-align: center;
"
>
<tr>
<td style="padding-top: 20px; padding-bottom: 10px">
<span
>You received this email because you subscribed to our list.
You can
<a href="{{UnsubscribeURL}}" style="color: inherit !important"
>unsubscribe</a
>
at any time.</span
>
<br />
<br />
{{SenderInfo}}
</td>
</tr>
</table>
<table
role="presentation"
class="container"
align="center"
cellpadding="0"
cellspacing="0"
width="100%"
style="margin-bottom: 10px; margin-top: 0px"
id="tc_0b4a"
>
<tbody>
<tr>
<td
align="center"
class="hero"
style="
border-collapse: collapse;
border-spacing: 0;
margin: 0;
padding: 0;
"
valign="top"
>
<a
href="{{RewardsURL}}"
style="display: block"
>
<img
src="https://eogallery1.com/8324eba2-72c3-11ea-a3d0-06b4694bee2a%2F1586536266496-bottom-badge.png"
alt="Powered by EmailOctopus"
width="150"
style="
width: 150px;
object-fit: cover;
padding: 0;
outline: none;
border: none;
display: block;
"
/>
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</body>
</html>
23 changes: 23 additions & 0 deletions mailer/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test

on:
push:
branches:
- master
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "26.0.2"
gleam-version: "1.0.0"
rebar3-version: "3"
# elixir-version: "1.15.4"
- run: gleam deps download
- run: gleam test
- run: gleam format --check src test
4 changes: 4 additions & 0 deletions mailer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.beam
*.ez
/build
erl_crash.dump
11 changes: 11 additions & 0 deletions mailer/gleam.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name = "mailer"
target = "javascript"
version = "1.0.0"

[dependencies]
gleam_stdlib = "~> 0.34 or ~> 1.0"
lustre = "~> 3.1"
simplifile = "~> 1.5"

[dev-dependencies]
gleeunit = "~> 1.0"
20 changes: 20 additions & 0 deletions mailer/manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was generated by Gleam
# You typically do not need to edit this file

packages = [
{ name = "argv", version = "1.0.1", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "A6E9009E50BBE863EB37D963E4315398D41A3D87D0075480FC244125808F964A" },
{ name = "gleam_community_ansi", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "FE79E08BF97009729259B6357EC058315B6FBB916FAD1C2FF9355115FEB0D3A4" },
{ name = "gleam_community_colour", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "A49A5E3AE8B637A5ACBA80ECB9B1AFE89FD3D5351FF6410A42B84F666D40D7D5" },
{ name = "gleam_stdlib", version = "0.36.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "C0D14D807FEC6F8A08A7C9EF8DFDE6AE5C10E40E21325B2B29365965D82EB3D4" },
{ name = "gleeunit", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "D364C87AFEB26BDB4FB8A5ABDE67D635DC9FA52D6AB68416044C35B096C6882D" },
{ name = "glint", version = "0.14.0", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "21AB16D5A50D4EF34DF935915FDBEE06B2DAEDEE3FCC8584C6E635A866566B38" },
{ name = "lustre", version = "3.1.4", build_tools = ["gleam"], requirements = ["argv", "gleam_community_ansi", "gleam_stdlib", "glint"], otp_app = "lustre", source = "hex", outer_checksum = "E651E39189F55473837FB7386C06BAED7276B37B5058302CAC880F89C25CB4E9" },
{ name = "simplifile", version = "1.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "EB9AA8E65E5C1E3E0FDCFC81BC363FD433CB122D7D062750FFDF24DE4AC40116" },
{ name = "snag", version = "0.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "54D32E16E33655346AA3E66CBA7E191DE0A8793D2C05284E3EFB90AD2CE92BCC" },
]

[requirements]
gleam_stdlib = { version = "~> 0.34 or ~> 1.0" }
gleeunit = { version = "~> 1.0" }
lustre = { version = "~> 3.1" }
simplifile = { version = "~> 1.5"}
28 changes: 28 additions & 0 deletions mailer/src/mailer.gleam
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import gleam/int
import gleam/list
import gleam/string
import mailer/template/archive
import mailer/template/email
import mailer/content
import simplifile

pub fn main() {
list.reverse(content.issues)
|> list.index_map(archive_issue)

let assert [latest, ..] = content.issues
let number = list.length(content.issues)
let assert Ok(_) =
email.render(latest, number)
|> simplifile.write("../email.html", _)
}

fn archive_issue(issue, index) {
let number = index + 1
let file =
string.concat(["../website/issues/", int.to_string(number), "/index.html"])

let assert Ok(_) =
archive.render(issue, number)
|> simplifile.write(file, _)
}
68 changes: 68 additions & 0 deletions mailer/src/mailer/content.gleam
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
pub type News {
News(title: String, url: String, description: String)
}

pub type Also {
Also(title: String, url: String, tag: Tag)
}

pub type Tag {
Podcast
Video
BlogPost
ProjectUpdate
}

pub const issues = [
#(
[
News(
"Gleam version 1",
"https://gleam.run/news/gleam-version-1/",
"Today Gleam v1.0.0 has been released! This is the first “stable” release of the language and a big milestone for the ecosystem.",
),
News(
"n-sided-lucy",
"https://0xca551e.github.io/n-sided-lucy/",
"Create lucys of all sorts.",
),
News(
"pprint 1.0",
"https://github.com/MystPi/pprint",
"A simple pretty printer for debugging and testing.",
),
News(
"p5js_gleam",
"https://github.com/Acepie/p5js_gleam",
"A demo showcasing how to create and use bindings to create a little animation site with p5js.",
),
],
[
Also(
"A lean XML builder for Gleam",
"https://github.com/tovedetered/xmleam",
ProjectUpdate,
),
Also(
"Binary Data in Gleam: Implementing The RCON Protocol",
"https://dev.to/bitcrshr/binary-data-in-gleam-implementing-the-rcon-protocol-2684",
BlogPost,
),
Also(
"Gleam for Impatient Devs",
"https://www.youtube.com/watch?v=NyKIvWvr9kw",
Video,
),
Also(
"Types for HTTP headers",
"https://github.com/LilyRose2798/typed_headers",
ProjectUpdate,
),
Also(
"Simple Programming Languages",
"https://ryanbrewer.dev/posts/simple-programming-languages.html",
BlogPost,
),
],
),
]
Loading

0 comments on commit 553ee41

Please sign in to comment.