Fix build output and remove vestigal deps
This commit is contained in:
parent
2de8262704
commit
640a8d56fd
4 changed files with 2 additions and 188 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
|
@ -34,7 +34,7 @@ jobs:
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: public/
|
path: dist/
|
||||||
deploy:
|
deploy:
|
||||||
environment:
|
environment:
|
||||||
name: github-pages
|
name: github-pages
|
||||||
|
|
|
||||||
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
|
@ -1,179 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
|
||||||
<title>Carter's RSS Feeds</title>
|
|
||||||
<link rel="icon" href="news-emoji.svg" sizes="any" type="image/svg+xml">
|
|
||||||
<link rel="stylesheet" href="styles.css" />
|
|
||||||
<link rel="manifest" href="manifest.json" />
|
|
||||||
<script type="module" defer>
|
|
||||||
/**
|
|
||||||
* from @feelinglovelynow/get-relative-time
|
|
||||||
* MIT License
|
|
||||||
* Copyright (c) 2023 Feeling Lovely Now
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Simple function that recieves a `Date` object that is in the future or is in the past and gives back the relative time using `Intl.RelativeTimeFormat('en', { numeric: 'auto' })`
|
|
||||||
* Examples: `[ "last year", "6 months ago", "4 weeks ago", "7 days ago", "now", "in 1 minute", "in 6 hours", "tomorrow", "in 3 days", "in 4 weeks", "next month", "in 2 months", "in 12 months", "next year" ]`
|
|
||||||
* @param { Date } date
|
|
||||||
* @throws { { id: 'fln__get-relative-time__invalid-date', message: 'Please pass getRelativeTime() a valid date object', _errorData: { date } } } - `IF (!(date instanceof Date) || date.toString() === 'Invalid Date')`
|
|
||||||
* @returns { string }
|
|
||||||
*/
|
|
||||||
function getRelativeTime(date) {
|
|
||||||
if (!(date instanceof Date) || date.toString() === 'Invalid Date') throw { id: 'fln__get-relative-time__invalid-date', message: 'Please pass getRelativeTime() a valid date object', _errorData: { date } }
|
|
||||||
else {
|
|
||||||
/** @type { string } */
|
|
||||||
let response
|
|
||||||
|
|
||||||
const timestamp = date.getTime()
|
|
||||||
const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' })
|
|
||||||
|
|
||||||
const diffMilliSeconds = timestamp - ((new Date()).getTime())
|
|
||||||
const diffSeconds = Math.round(diffMilliSeconds / 1000)
|
|
||||||
const diffMinutes = Math.round(diffSeconds / 60)
|
|
||||||
const diffHours = Math.round(diffMinutes / 60)
|
|
||||||
const diffDays = Math.round(diffHours / 24)
|
|
||||||
|
|
||||||
if (!Boolean(diffDays) && !Boolean(diffHours) && !Boolean(diffMinutes)) response = rtf.format(diffSeconds, 'second')
|
|
||||||
else if (!Boolean(diffDays) && !Boolean(diffHours)) response = rtf.format(diffMinutes, 'minute')
|
|
||||||
else if (!Boolean(diffDays)) response = rtf.format(diffHours, 'hour')
|
|
||||||
else if (diffDays < -365) response = rtf.format(Math.round(diffDays / 365), 'year')
|
|
||||||
else if (diffDays < -33) response = rtf.format(Math.round(diffDays / 30), 'month')
|
|
||||||
else if (diffDays < -7) response = rtf.format(Math.round(diffDays / 7), 'week')
|
|
||||||
else if (diffDays > 365) response = rtf.format(Math.round(diffDays / 365), 'year')
|
|
||||||
else if (diffDays > 33) response = rtf.format(Math.round(diffDays / 30), 'month')
|
|
||||||
else if (diffDays > 7) response = rtf.format(Math.round(diffDays / 7), 'week')
|
|
||||||
else response = rtf.format(diffDays, 'day')
|
|
||||||
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param { Date } date
|
|
||||||
* @returns { number }
|
|
||||||
*/
|
|
||||||
function getUpdateInterval(date) {
|
|
||||||
const now = new Date();
|
|
||||||
const diffMilliSeconds = date.getTime() - now.getTime();
|
|
||||||
const diffSeconds = Math.round(diffMilliSeconds / 1000);
|
|
||||||
if (diffSeconds < 60) return 1000;
|
|
||||||
if (diffSeconds < 3600) return 1000 * 60;
|
|
||||||
if (diffSeconds < 86400) return 1000 * 60 * 60;
|
|
||||||
return 1000 * 60 * 60 * 24;
|
|
||||||
}
|
|
||||||
class RelativeTime extends HTMLElement {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
const date = new Date(parseInt(this.getAttribute("data-time")));
|
|
||||||
this.textContent = getRelativeTime(date);
|
|
||||||
setInterval(() => {
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
this.textContent = getRelativeTime(date);
|
|
||||||
});
|
|
||||||
}, getUpdateInterval(date));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
customElements.define("relative-time", RelativeTime);
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="font-system text-base m-4">
|
|
||||||
<header class="text-2xl">
|
|
||||||
<h1>📰 Carter's RSS Feeds</h1>
|
|
||||||
</header>
|
|
||||||
<main class="grid gap-4 grid-cols-[repeat(auto-fill,_minmax(300px,_1fr))] mt-2">
|
|
||||||
{% for group, feeds in data %}
|
|
||||||
<section>
|
|
||||||
<h2 class="text-xl">{{ group }}</h2>
|
|
||||||
<div class="lg:overflow-y-auto lg:max-h-96">
|
|
||||||
{% for feed in feeds %}
|
|
||||||
<details class="group">
|
|
||||||
<summary
|
|
||||||
class="cursor-pointer p-2 rounded-xl mt-1 transition-colors group-has-[.has-recent]:border-2 flex flex-row items-center">
|
|
||||||
{% if feed.hasRecent %}
|
|
||||||
<div class="text-xl mr-2" aria-label="Feed has recent items">✳︎</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="w-full">
|
|
||||||
<div>{{ feed.title }}</div>
|
|
||||||
<div class="text-sm whitespace-nowrap text-ellipsis w-11/12 overflow-hidden" title="{{feed.feed}}">({{
|
|
||||||
feed.feed }})</div>
|
|
||||||
</div>
|
|
||||||
</summary>
|
|
||||||
<ul class=" overflow-y-auto list-none ml-6">
|
|
||||||
{% for item in feed.items %}
|
|
||||||
<li
|
|
||||||
class="{% if item.isRecent %}has-recent {% endif %} flex flex-row items-center p-2 rounded-xl mt-1 transition-colors">
|
|
||||||
{% if item.isRecent %}
|
|
||||||
<div class="text-xl mr-2" aria-label="Item is recent">✳︎</div>
|
|
||||||
{% endif %}
|
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
<a class="no-underline hover:text-inherit" href="{{ item.link }}" target="_blank"
|
|
||||||
rel="noopener norefferer nofollow">{{
|
|
||||||
item.title | safe}}</a>
|
|
||||||
</div>
|
|
||||||
<div class="text-sm">
|
|
||||||
<relative-time data-time="{{item.timestamp}}">{{ item.timestamp | formatDateTime}}</relative-time>
|
|
||||||
</div>
|
|
||||||
{% if yazzyUrl %}
|
|
||||||
<div class="text-sm">
|
|
||||||
<a href="{{ yazzyUrl }}/{{ item.link }}" target="_blank" rel="noreferrer noopener">yazzy</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
{% endfor %}
|
|
||||||
</main>
|
|
||||||
{% if errors | length > 0 %}
|
|
||||||
<section class="mt-4">
|
|
||||||
<h2 class="text-xl">Errors</h2>
|
|
||||||
<p>There were errors trying to parse these feeds:</p>
|
|
||||||
<ul class="errors">
|
|
||||||
{% for error in errors %}
|
|
||||||
<li class="break-all">{{ error }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
<footer>
|
|
||||||
<hr class="my-4">
|
|
||||||
<p>Last updated <relative-time data-time="{{ now }}">{{ now | formatDateTime}}</relative-time>.</p>
|
|
||||||
<p>
|
|
||||||
<a href="https://github.com/carterworks/rss-reader">View on GitHub</a>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Powered by
|
|
||||||
<a href="https://github.com/georgemandis/bubo-rss">Bubo Reader (v{{ info.version }})</a>, a project by <a
|
|
||||||
href="https://george.mand.is">George Mandis</a>. ❤️
|
|
||||||
</p>
|
|
||||||
</footer>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
@ -28,22 +28,15 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/tailwind": "^5.1.0",
|
"@astrojs/tailwind": "^5.1.0",
|
||||||
"@feelinglovelynow/get-relative-time": "^1.1.2",
|
|
||||||
"astro": "^4.14.4",
|
"astro": "^4.14.4",
|
||||||
"chalk": "^5.2.0",
|
|
||||||
"node-fetch": "^3.3.1",
|
|
||||||
"nunjucks": "^3.2.4",
|
|
||||||
"rss-parser": "^3.13.0"
|
"rss-parser": "^3.13.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^1.8.1",
|
"@biomejs/biome": "^1.8.1",
|
||||||
"@types/bun": "latest",
|
"@types/bun": "latest",
|
||||||
"@types/nunjucks": "^3.2.2",
|
|
||||||
"@types/xml2js": "^0.4.11",
|
"@types/xml2js": "^0.4.11",
|
||||||
"tailwindcss": "^3.4.6",
|
"tailwindcss": "^3.4.6",
|
||||||
"tslib": "^2.5.3",
|
"typescript": "^5.1.3"
|
||||||
"typescript": "^5.1.3",
|
|
||||||
"typescript-eslint": "^7.13.1"
|
|
||||||
},
|
},
|
||||||
"trustedDependencies": ["@biomejs/biome"]
|
"trustedDependencies": ["@biomejs/biome"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue