Add Yazzy integration (#12)
* Remove eslint completely * Make the 'last updated' time relative * Restore accidentally commited feeds * Add yazzy link to each article
This commit is contained in:
parent
6b1e3157ec
commit
740191e050
8 changed files with 128 additions and 122 deletions
12
biome.json
Normal file
12
biome.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.8.1/schema.json",
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -122,6 +122,11 @@
|
|||
<div class="article-timestamp">
|
||||
<relative-time data-time="{{item.timestamp}}">{{ item.timestamp | relative}}</relative-time>
|
||||
</div>
|
||||
{% if yazzyUrl %}
|
||||
<div class="article-links">
|
||||
<a href="{{ yazzyUrl }}/{{ item.link }}" target="_blank" rel="noreferrer noopener">yazzy</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
@ -141,7 +146,7 @@
|
|||
{% endif %}
|
||||
<footer>
|
||||
<hr>
|
||||
<p>Last updated {{ now }}.</p>
|
||||
<p>Last updated <relative-time data-time="{{ now }}">{{ now | relative}}</relative-time>.</p>
|
||||
<p>
|
||||
<a href="https://github.com/carterworks/rss-reader">View on GitHub</a>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
import pluginJs from "@eslint/js";
|
||||
import globals from "globals";
|
||||
import tseslint from "typescript-eslint";
|
||||
|
||||
export default [
|
||||
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
|
||||
pluginJs.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
];
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
"scripts": {
|
||||
"clean": "rm -rf dist",
|
||||
"build": "bun src/index.ts",
|
||||
"check": "biome check --write ./{src,config,public} ./eslint.config.js"
|
||||
"check": "biome check --write ./{src,config,public} ./*.json --no-errors-on-unmatched"
|
||||
},
|
||||
"author": {
|
||||
"name": "George Mandis",
|
||||
|
|
@ -40,7 +40,5 @@
|
|||
"typescript": "^5.1.3",
|
||||
"typescript-eslint": "^7.13.1"
|
||||
},
|
||||
"trustedDependencies": [
|
||||
"@biomejs/biome"
|
||||
]
|
||||
"trustedDependencies": ["@biomejs/biome"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ details:has(li.has-recent) {
|
|||
}
|
||||
|
||||
.article-timestamp,
|
||||
.feed-url {
|
||||
.feed-url,
|
||||
.article-links {
|
||||
font-size: 0.75em;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ const finishBuild: () => void = async () => {
|
|||
data: sortedFeeds,
|
||||
errors: errors,
|
||||
info: buboInfo,
|
||||
yazzyUrl: process.env.YAZZY_URL,
|
||||
});
|
||||
|
||||
// write the output to public/index.html
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import { readFile } from "node:fs/promises";
|
|||
import { getRelativeTime } from "@feelinglovelynow/get-relative-time";
|
||||
import type { Feeds, JSONValue } from "./@types/bubo";
|
||||
|
||||
const yazzyUrl = process.env.YAZZY_URL;
|
||||
|
||||
/**
|
||||
* Global filters for my Nunjucks templates
|
||||
*/
|
||||
|
|
@ -23,7 +25,7 @@ env.addFilter("formatTime", (dateString): string => {
|
|||
return !Number.isNaN(date.getTime()) ? date.toLocaleTimeString() : dateString;
|
||||
});
|
||||
|
||||
env.addGlobal("now", new Date().toUTCString());
|
||||
env.addGlobal("now", new Date().getTime());
|
||||
|
||||
// load the template
|
||||
const template: string = (
|
||||
|
|
@ -35,15 +37,18 @@ const render = ({
|
|||
data,
|
||||
errors,
|
||||
info,
|
||||
yazzyUrl,
|
||||
}: {
|
||||
data: Feeds;
|
||||
errors: unknown[];
|
||||
info?: JSONValue;
|
||||
yazzyUrl?: string;
|
||||
}) => {
|
||||
return env.renderString(template, {
|
||||
data,
|
||||
errors,
|
||||
info,
|
||||
yazzyUrl,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,10 @@
|
|||
"resolveJsonModule": true,
|
||||
"outDir": "dist",
|
||||
"baseUrl": ".",
|
||||
"typeRoots": [
|
||||
"src/@types"
|
||||
],
|
||||
"typeRoots": ["src/@types"],
|
||||
"paths": {
|
||||
"*": [
|
||||
"node_modules/*",
|
||||
"src/@types"
|
||||
]
|
||||
"*": ["node_modules/*", "src/@types"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
Loading…
Reference in a new issue