diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..efced33
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,50 @@
+{
+ "env": {
+ "browser": true,
+ "es2021": true
+ },
+ "extends": [
+ "eslint:recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "parser": "@typescript-eslint/parser",
+ "parserOptions": {
+ "ecmaVersion": 6,
+ "sourceType": "module"
+ },
+ "plugins": [
+ "@typescript-eslint"
+ ],
+ "rules": {
+ "indent": [
+ "error",
+ 2
+ ],
+ "linebreak-style": [
+ "error",
+ "unix"
+ ],
+ "quotes": [
+ "error",
+ "double"
+ ],
+ "semi": [
+ "error",
+ "always"
+ ],
+ "no-trailing-spaces": [
+ 2,
+ {
+ "skipBlankLines": false
+ }
+ ],
+ "no-multiple-empty-lines": [
+ "error",
+ {
+ "max": 2,
+ "maxEOF": 1
+ }
+ ],
+ "@typescript-eslint/no-var-requires": 0
+ }
+}
\ No newline at end of file
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index dd46b4d..5da78b6 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,7 +1,7 @@
# These are supported funding model platforms
github: georgemandis
-patreon: georgemandis
+patreon: #
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
-custom: https://george.mand.is/sponsor
+custom: #
diff --git a/.gitignore b/.gitignore
index 2421137..6d0c112 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
node_modules/*
-output/index.html
+public/index.html
+dist/*
+.DS_Store
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 0000000..0baffb7
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+16.4.1
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..e1606d0
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 George Mandis
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index 7302620..e79b271 100644
--- a/README.md
+++ b/README.md
@@ -1,35 +1,102 @@
-# 🦉 Bubo Reader
+# 🦉 Bubo Reader (2.0)
-Bubo Reader is a somewhat irrationally minimalist RSS and JSON feed reader you can deploy on [Netlify](https://netlify.com) in a few steps or [Glitch](https://glitch.com) in even fewer steps! The goal of the project is to generate a webpage that shows a list of links from a collection of feeds organized by category and website. That's it.
+Bubo Reader is a hyper-minimalist RSS and JSON feed reader you can deploy on your own server, [Netlify](https://netlify.com) in a few steps or [Glitch](https://glitch.com) in even fewer steps! The goal of the project is to generate a webpage that shows a list of links from a collection of feeds organized by category and website. That's it.
It is named after this [silly robot owl](https://www.youtube.com/watch?v=MYSeCfo9-NI) from Clash of the Titans (1981).
-You can read more about how this project came about in my blog post '[Introducing Bubo RSS: An Absurdly Minimalist RSS Feed Reader](https://george.mand.is/2019/11/introducing-bubo-rss-an-absurdly-minimalist-rss-feed-reader/)'
+You can read more about how this project came about on my blog:
+- [Introducing Bubo RSS: An Absurdly Minimalist RSS Feed Reader](https://george.mand.is/2019/11/introducing-bubo-rss-an-absurdly-minimalist-rss-feed-reader/).
## Getting Started
-How to deploy Bubo Reader in a few easy steps with Netlify or Glitch:
+- Clone or fork the repo and run `npm install` to install the dependencies.
+- Update `feeds.json` to include categories and links to feeds you would like to see.
+- Run `npm run build:bubo`
-### Deploying to Glitch
+That's it! You should now have a static page with links to the latest content from your feeds in the `public` folder, ready to serve.
+
+## Differences in Bubo 2.0
+
+Version 2.0 has introduced some substantial changes for Bubo! While the static output remains endearingly spartan, the engine that builds it has changed a bit.
+
+Hopefully all of these changes are in services of making this project more useful to others and encouraging outside contributions.
+
+Changes of note:
+
+- Bubo has been rewritten in [TypeScript](https://www.typescriptlang.org/). It's pretty slick! I anticipate the typing could be improved, but it's a start.
+- You fill find an `.nvmrc` file in the root of this project. Learn more [about nvm](https://github.com/nvm-sh/nvm) if you're unfamiliar.
+- The script will actually write your `index.html` file for you (Previously the build script simply ran `node src/index.js > output/index.html`). It makes a strong assumption that this file lives in the `public` folder.
+- There is a somewhat sophisticated mechansim in-place for batching & throttling your requests, if needed.
+## Anatomy of Bubo Reader
+
+The static pieces:
+
+- `conf/feeds.json` - a JSON file containing your feed URLS separated into categories.
+- `config/template.html` - a [Nunjucks](https://mozilla.github.io/nunjucks/) template that lets you change how the feeds are displayed. This can be changed to anything else you like— see below.
+- `public/style.css` - a CSS file to stylize your feed output.
+- `public/index.html` - The HTML file that gets automatically generated when Bubo is run.
+
+The engine:
+
+- `src/index.ts` - The primary script you run when you want to build a new version of Bubo. It will automatically fetch the latest content from your feeds and build a new static file at `public/index.html`.
+- `src/renderer.ts` — The renderer that loads Nunjucks, the template and understands how to process the incoming feed data. Prefer something else? This is the place to change it!
+- `src/utilities.ts` — A variety of parsing and normalization utilities for Bubo, hidden away to try and keep things clean.
+
+## Throttling
+
+In the main `index.ts` file you will find two values that allow yout to batch and throttle your feed requests:
+
+- `MAX_CONNECTIONS` dictates the maximium number of requests a batch can have going at once.
+- `DELAY_MS` dictates the amount of de;ay time between each batch.
+
+The default configuration is **no batching or throttling** beacuse `MAX_CONNECTIONS` is set to `Infinity`. If you wanted to change Bubo to only fetch one feed at a time every second you could set these values to:
+
+```javascript
+const MAX_CONNECTIONS = 1;
+const DELAY_MS = 1000;
+```
+
+If you wanted to limit things to 10 simultaneous requests every 2.5 seconds you could set it like so:
+
+```javascript
+const MAX_CONNECTIONS = 10;
+const DELAY_MS = 2500;
+```
+
+In practice, I've never _really_ run into an issue leaving `MAX_CONNECTIONS` set to `Infinity` but this feels like a sensible safeguard to design.
+## Demos
+
+You can view live demos here:
+
+- [https://bubo-rss-demo.netlify.com/](https://bubo-rss-demo.netlify.com/)
+- [http://bubo-rss.glitch.me/](http://bubo-rss.glitch.me/)
+
+Not the most exciting-looking demos, I'll admit, but they work!
+
+**Getting Started**
+
+- [Deploying to Glitch](#glitch)
+- [Deploying to Netlify](#netlify)
+- [Keeping feeds updated](#updated)
+
+
+## Deploying to Glitch
The quickest way is to remix the project on Glitch:
[https://glitch.com/edit/#!/bubo-rss](https://glitch.com/edit/#!/bubo-rss)
-Just changed some feeds in `./src/feeds.json` file and you're set! If you'd like to modify the style or the template you can changed `./output/style.css` file or the `./src/template.html` file respectively.
+Just changed some feeds in `./config/feeds.json` file and you're set! If you'd like to modify the style or the template you can changed `./public/style.css` file or the `./config/template.html` file respectively.
-There is also a special `glitch` branch you can clone if you prefer:
-[https://github.com/georgemandis/bubo-rss/tree/glitch](https://github.com/georgemandis/bubo-rss/tree/glitch)
-
-The only difference between this branch and `master` is that it spins up a server using [Express](https://expressjs.com/) to serve your `./output/index.html` file on Glitch. Everything else is the same.
-
-### Deploying to Netlify
+
+## Deploying to Netlify
- [Fork the repository](https://github.com/georgemandis/bubo-rss/fork)
-- From your forked repository go to and edcit `src/feeds.json` to manage your feeds and categories
-- [Create a new site](https://app.netlify.com/start) on Netlify from GitHub
+- From your forked repository edit `config/feeds.json` to manage your feeds and categories
+- [Create a new site](https://app.netlify.com/start) on Netlify from GitHub
The deploy settings should automatically import from the `netlify.toml` file. All you'll need to do is confirm and you're ready to go!
+
### Keeping Feeds Updated
#### Using Netlify Webhooks
@@ -40,25 +107,21 @@ To keep your feeds up to date you'll want to [setup a Build Hook](https://www.ne
- [Zapier](https://zapier.com/)
- [EasyCron](https://www.easycron.com/)
-If you already have a server running Linux and some command-line experience it might be simpler to setup a [cron job](https://en.wikipedia.org/wiki/Cron).
-
#### Using GitHub Actions
-This approach is a little different and requires some modifications to the repository. Netlify started billing for [build minutes](https://www.netlify.com/pricing/faq/) very shortly after I published this project. Running `npm build` and downloading all of the RSS feeds took up a substantial number of this minutes, particulary if you had some kind of process pinging the webhook and trigger a build every 15 minutes or so.
+Coming soon—there is an old branch that demonstrates this, but it needs to be revisisted in light of Bubo 2.0.
-How is the The GitHub Action-based approach different? The same build process runs, but this time it's on GitHub's servers via the Action. It then **commits** the newly created file generated at `./output/index.html` back into the repository. Netlify still gets pinged when the repository is updated, but skips the `npm run build` step on their end, which significantly reduces the number of build minutes required.
+#### Rolling Your Own
-**Short Answer**: use the [`github-action-publishing`](https://github.com/georgemandis/bubo-rss/tree/github-action-publishing) branch for now if you'd prefer to use GitHub Actions to run your builds.
-
-The GitHub Action is setup to build and commit directly to the `master` branch, which is not the best practice. I'd suggest creating a separate branch to checkout and commit changes to in the Action. You could then specify that same branch as the one to checkout and publish on Netlify.
-
-## Anatomy of Bubo Reader
-
-- `src/index.html` - a [Nunjucks](https://mozilla.github.io/nunjucks/) template that lets you change how the feeds are displayed
-- `output/style.css` - a CSS file to stylize your feed output
-- `src/feeds.json` - a JSON file containing the URLs for various site's feeds separated into categories
-- `src/index.js` - the script that loads the feeds and does the actual parsinga and rendering
+If you already have a server running Linux and some command-line experience it might be simpler to setup a [cron job](https://en.wikipedia.org/wiki/Cron).
## Support
-If you found this useful please consider sponsoring me or this project. If you'd rather run this on your own server please consider using one of these affiliate links to setup a micro instance on [Linode](https://www.linode.com/?r=8729957ab02b50a695dcea12a5ca55570979d8b9), [Digital Ocean](https://m.do.co/c/31f58d367777) or [Vultr](https://www.vultr.com/?ref=8403978).
\ No newline at end of file
+If you found this useful please consider sponsoring me or this project.
+
+If you'd rather run this on your own server please consider using one of these affiliate links to setup a micro instance on [Linode](https://www.linode.com/?r=8729957ab02b50a695dcea12a5ca55570979d8b9), [Digital Ocean](https://m.do.co/c/31f58d367777) or [Vultr](https://www.vultr.com/?ref=8403978).
+
+## Showcase
+
+Here are some websites using Bubo Reader:
+- [Kevin Fiol](https://kevinfiol.com/reader/) ([repo](https://github.com/kevinfiol/reader))
diff --git a/src/feeds.json b/config/feeds.json
similarity index 71%
rename from src/feeds.json
rename to config/feeds.json
index 9d35c9c..3fecb56 100644
--- a/src/feeds.json
+++ b/config/feeds.json
@@ -1,7 +1,6 @@
{
"Web Development": [
- "https://hacks.mozilla.org/feed/",
- "https://blog.mozilla.org/feed/",
+ "https://hacks.mozilla.org/feed/",
"https://web.dev/feed.xml",
"https://v8.dev/blog.atom",
"https://alistapart.com/main/feed/",
@@ -14,11 +13,10 @@
],
"My GitHub Projects": [
"https://github.com/georgemandis.atom",
+ "https://github.com/georgemandis/bubo-rss/releases.atom",
"https://github.com/georgemandis/konami-js/releases.atom",
"https://github.com/georgemandis/konami-js/commits/main.atom",
"https://github.com/javascriptforartists/cheer-me-up-and-sing-me-a-song/commits/master.atom",
- "https://github.com/georgemandis/circuit-playground-midi-multi-tool/commits/master.atom",
- "https://github.com/georgemandis/remote-working-list/commits/master.atom",
- "https://github.com/georgemandis/tweeter-totter/commits/master.atom"
+ "https://github.com/georgemandis/circuit-playground-midi-multi-tool/commits/master.atom"
]
}
\ No newline at end of file
diff --git a/src/template.html b/config/template.html
similarity index 79%
rename from src/template.html
rename to config/template.html
index 0aa0d50..d1c9732 100644
--- a/src/template.html
+++ b/config/template.html
@@ -40,9 +40,17 @@
{% endif %}
+
- Last updated {{ now }}. Powered by Bubo Reader, a project by George Mandis + Last updated {{ now }}.
++ Powered by Bubo Reader (2.0.0), a project by George Mandis. +
+ +