Skip to content

Commit

Permalink
Merge pull request #1 from wydengyre/nodeless
Browse files Browse the repository at this point in the history
nodeless
  • Loading branch information
wydengyre authored Jan 25, 2024
2 parents efb053c + d94bee3 commit c68964e
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 111 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
raiplayrss
==========

`npm run build-podcast` to build the intermediate `podcast` lib.
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
},
"files": {
"include": ["cf/**/*.ts", "cf/**/*.json","lib/**/*.ts", "lib/**/*.json"],
"include": ["cf/**/*.ts", "cf/**/*.json","lib/**/*.ts", "lib/**/*.json", "tools/*.ts"],
"ignore": ["cf/.wrangler"]
}
}
3 changes: 3 additions & 0 deletions build/podcast/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
index.js
types
*.d.ts
3 changes: 3 additions & 0 deletions build/podcast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Podcast dependency gets inserted here so that we don't need any Node libraries to run the site.

Currently, the podcast lib we use depends on Node for a few things. We can just compile a version with stubs and we should be good to go.
1 change: 0 additions & 1 deletion cf/wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name = "raiplayrss"
main = "./worker.ts"
compatibility_date = "2024-01-16"
node_compat = true

[env.prod.vars]
BASE_URL = "https://raiplayrss.workers.dev/"
Expand Down
6 changes: 3 additions & 3 deletions lib/feed.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PromisePool } from "@supercharge/promise-pool";
import { FeedOptions, ItemOptions, Podcast } from "podcast";
import { z } from "zod";
import { Podcast } from "../build/podcast/index.js";
import { Fetcher as MediaFetcher } from "./media.js";

const cardSchema = z.object({
Expand Down Expand Up @@ -116,7 +116,7 @@ export class Convertor {
this.#raiBaseUrl,
).toString();

const options: FeedOptions = {
const options = {
// feedUrl: TODO
// siteUrl: TODO
imageUrl,
Expand All @@ -136,7 +136,7 @@ export class Convertor {
return new Podcast(options, results).buildXml();
}

async convertCard(card: Card): Promise<ItemOptions> {
async convertCard(card: Card) {
const imageUrl = new URL(card.image, this.#raiBaseUrl).toString();
const date = new Date(card.track_info.date);
const mediaInfo = await this.#fetcher.fetchInfo(
Expand Down
Loading

0 comments on commit c68964e

Please sign in to comment.