Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions .github/workflows/www.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ on:
permissions:
contents: read

env:
# name of the netlify site, used to predict the url of a preview deploy
NETLIFY_SITE_NAME: effection

jobs:
deploy-preview:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 15
environment:
name: Preview
url: ${{ steps.netlify.outputs.unique-url }}
# the alias deploy, the one this build's urls were written for
url: ${{ steps.netlify.outputs.stable-url }}
permissions:
contents: read
pull-requests: write
Expand All @@ -33,6 +38,23 @@ jobs:
with:
deno-version: v2.9.1

- name: Compute Site URL
id: site
env:
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
# an alias deploy lands on a predictable url, so a preview can point
# at itself. a fork deploys anonymously to a url that is not known
# until after the deploy, so it points at the netlify site instead.
if [[ "$IS_FORK" == "true" ]]; then
URL="https://${NETLIFY_SITE_NAME}.netlify.app"
else
URL="https://pr-${PR_NUMBER}--${NETLIFY_SITE_NAME}.netlify.app"
fi
echo "url=$URL" >> "$GITHUB_OUTPUT"
echo "Preview will be served from $URL" >> "$GITHUB_STEP_SUMMARY"

- name: Serve Website
run: |
deno run -A main.tsx &
Expand All @@ -48,7 +70,7 @@ jobs:

- name: Download Staticalize
run: |
wget https://github.com/thefrontside/staticalize/releases/download/v0.2.6/staticalize-linux.tar.gz \
wget https://github.com/thefrontside/staticalize/releases/download/v0.3.0/staticalize-linux.tar.gz \
-O /tmp/staticalize-linux.tar.gz
tar -xzf /tmp/staticalize-linux.tar.gz -C /usr/local/bin
chmod +x /usr/local/bin/staticalize-linux
Expand All @@ -58,7 +80,9 @@ jobs:
staticalize-linux \
--site=http://127.0.0.1:8000 \
--output=www/built \
--base=https://effection.netlify.app
--base=${{ steps.site.outputs.url }} \
--concurrency=75 \
--retries=3

- name: Deploy Preview to Netlify
id: netlify
Expand Down Expand Up @@ -90,6 +114,11 @@ jobs:

DEPLOY_ID=$(echo "$DEPLOY_OUTPUT" | jq -er '.deploy_id')
SITE_NAME=$(echo "$DEPLOY_OUTPUT" | jq -er '.site_name')

if [[ "$SITE_NAME" != "$NETLIFY_SITE_NAME" ]]; then
echo "::warning::deployed to '$SITE_NAME' but urls were built for" \
"'$NETLIFY_SITE_NAME'; update NETLIFY_SITE_NAME in this workflow"
fi
UNIQUE_URL="https://${DEPLOY_ID}--${SITE_NAME}.netlify.app"
STABLE_URL="https://pr-${PR_NUMBER}--${SITE_NAME}.netlify.app"
fi
Expand Down Expand Up @@ -144,7 +173,7 @@ jobs:

- name: Download Staticalize
run: |
wget https://github.com/thefrontside/staticalize/releases/download/v0.2.6/staticalize-linux.tar.gz \
wget https://github.com/thefrontside/staticalize/releases/download/v0.3.0/staticalize-linux.tar.gz \
-O /tmp/staticalize-linux.tar.gz
tar -xzf /tmp/staticalize-linux.tar.gz -C /usr/local/bin
chmod +x /usr/local/bin/staticalize-linux
Expand All @@ -154,7 +183,9 @@ jobs:
staticalize-linux \
--site=http://127.0.0.1:8000 \
--output=www/built \
--base=https://effection.netlify.app
--base=https://frontside.com/effection \
--concurrency=75 \
--retries=3

- name: Deploy to Production
run: |
Expand Down
2 changes: 1 addition & 1 deletion www/deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tasks": {
"dev": "deno run -A @effectionx/watch deno run -A main.tsx",
"staticalize": "deno run -A jsr:@frontside/staticalize@0.2.2/cli --site http://localhost:8000 --output=built --base=http://localhost:8000",
"staticalize": "deno run -A jsr:@frontside/staticalize@0.3.0/cli --site http://localhost:8000 --output=built --base=http://localhost:8000 --concurrency=75 --retries=3",
"test": "deno test --allow-run --allow-write --allow-read --allow-env"
},
"lint": {
Expand Down
43 changes: 24 additions & 19 deletions www/routes/blog-feed-route.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Operation } from "effection";
import { all, type Operation } from "effection";
import { stringify } from "@libs/xml";

import { useBlog } from "../resources/blog.ts";
import { url } from "../context/url.ts";

/**
* RSS 2.0 feed for the blog
Expand All @@ -11,8 +12,26 @@ export function blogFeedRoute() {
*handler(): Operation<Response> {
let blog = yield* useBlog();
let posts = blog.getPosts();
let blogUrl = yield* url("/blog");
let feed = yield* url("/blog/feed.xml");
let items = yield* all(
posts.slice(0, 20).map(function* (post) {
let postUrl = yield* url(`/blog/${post.id}/`);

let baseUrl = "https://frontside.com/effection";
return {
title: post.title,
link: postUrl,
guid: {
"@isPermaLink": "true",
"#text": postUrl,
},
description: post.description,
pubDate: post.date.toUTCString(),
author: post.author,
category: post.tags,
};
}),
);

let xml = stringify({
"@version": "1.0",
Expand All @@ -22,31 +41,17 @@ export function blogFeedRoute() {
"@xmlns:atom": "http://www.w3.org/2005/Atom",
channel: {
title: "Effection Blog",
link: `${baseUrl}/blog`,
link: blogUrl,
description:
"Tutorials, announcements, and insights about structured concurrency in JavaScript with Effection.",
language: "en-us",
lastBuildDate: new Date().toUTCString(),
"atom:link": {
"@href": `${baseUrl}/blog/feed.xml`,
"@href": feed,
"@rel": "self",
"@type": "application/rss+xml",
},
item: posts.slice(0, 20).map((post) => {
let postUrl = `${baseUrl}/blog/${post.id}/`;
return {
title: post.title,
link: postUrl,
guid: {
"@isPermaLink": "true",
"#text": postUrl,
},
description: post.description,
pubDate: post.date.toUTCString(),
author: post.author,
category: post.tags,
};
}),
item: items,
},
},
});
Expand Down
64 changes: 40 additions & 24 deletions www/routes/llms-txt-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Operation } from "effection";
import { all } from "effection";
import { useWorkspaces } from "../lib/workspaces/mod.ts";
import type { SitemapRoute } from "../plugins/sitemap.ts";
import { url } from "../context/url.ts";
import type { Package } from "../lib/package/types.ts";
import {
groupPackagesByCategory,
Expand Down Expand Up @@ -45,24 +46,30 @@ export function llmsTxtRoute(): SitemapRoute<Response> {
);

// Group packages by category
let categorizedContent = groupPackagesByCategory(
categories,
packageEntries,
).map(
(category) => {
let packageLines = category.packages.map((pkg) => {
let shortDesc = truncateToFirstSentence(pkg.description, 120);
return `- [${pkg.name}](https://frontside.com/effection/x/${pkg.workspaceName}): ${shortDesc}`;
});

return [
`### ${category.label}`,
"",
category.description,
"",
...packageLines,
].join("\n");
},
let categorizedContent = yield* all(
groupPackagesByCategory(
categories,
packageEntries,
).map(
function* (category) {
let packageLines = yield* all(
category.packages.map(function* (pkg) {
let shortDesc = truncateToFirstSentence(pkg.description, 120);
let href = yield* url(`/x/${pkg.workspaceName}`);

return `- [${pkg.name}](${href}): ${shortDesc}`;
}),
);

return [
`### ${category.label}`,
"",
category.description,
"",
...packageLines,
].join("\n");
},
),
);

let content = [
Expand All @@ -73,7 +80,7 @@ export function llmsTxtRoute(): SitemapRoute<Response> {
"",
...categorizedContent,
"",
LLMS_TXT_FOOTER,
yield* llmsTxtFooter(),
].join("\n");

return new Response(content, {
Expand Down Expand Up @@ -146,16 +153,24 @@ If any other document conflicts with AGENTS.md, **AGENTS.md takes precedence**.
---
`;

const LLMS_TXT_FOOTER = `## Optional
function* llmsTxtFooter(): Operation<string> {
let [catalog, blog, api, guides] = yield* all([
url("/x/"),
url("/blog"),
url("/api/"),
url("/guides/v4"),
]);

return `## Optional

- [Full EffectionX catalog with documentation](https://frontside.com/effection/x/)
- [Effection Blog](https://frontside.com/effection/blog)
- [Full EffectionX catalog with documentation](${catalog})
- [Effection Blog](${blog})

---

[AGENTS.md]: https://raw.githubusercontent.com/thefrontside/effection/v4/AGENTS.md
[API]: https://frontside.com/effection/api/
[Guides]: https://frontside.com/effection/guides/v4
[API]: ${api}
[Guides]: ${guides}
[Thinking in Effection]: https://raw.githubusercontent.com/thefrontside/effection/v4/docs/thinking-in-effection.mdx
[Async Rosetta Stone]: https://raw.githubusercontent.com/thefrontside/effection/v4/docs/async-rosetta-stone.mdx
[Operations]: https://raw.githubusercontent.com/thefrontside/effection/v4/docs/operations.mdx
Expand All @@ -164,3 +179,4 @@ const LLMS_TXT_FOOTER = `## Optional
[Spawn]: https://raw.githubusercontent.com/thefrontside/effection/v4/docs/spawn.mdx
[Collections]: https://raw.githubusercontent.com/thefrontside/effection/v4/docs/collections.mdx
`;
}
Loading