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">
|
<div class="article-timestamp">
|
||||||
<relative-time data-time="{{item.timestamp}}">{{ item.timestamp | relative}}</relative-time>
|
<relative-time data-time="{{item.timestamp}}">{{ item.timestamp | relative}}</relative-time>
|
||||||
</div>
|
</div>
|
||||||
|
{% if yazzyUrl %}
|
||||||
|
<div class="article-links">
|
||||||
|
<a href="{{ yazzyUrl }}/{{ item.link }}" target="_blank" rel="noreferrer noopener">yazzy</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -141,7 +146,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<footer>
|
<footer>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Last updated {{ now }}.</p>
|
<p>Last updated <relative-time data-time="{{ now }}">{{ now | relative}}</relative-time>.</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="https://github.com/carterworks/rss-reader">View on GitHub</a>
|
<a href="https://github.com/carterworks/rss-reader">View on GitHub</a>
|
||||||
</p>
|
</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": {
|
"scripts": {
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"build": "bun src/index.ts",
|
"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": {
|
"author": {
|
||||||
"name": "George Mandis",
|
"name": "George Mandis",
|
||||||
|
|
@ -40,7 +40,5 @@
|
||||||
"typescript": "^5.1.3",
|
"typescript": "^5.1.3",
|
||||||
"typescript-eslint": "^7.13.1"
|
"typescript-eslint": "^7.13.1"
|
||||||
},
|
},
|
||||||
"trustedDependencies": [
|
"trustedDependencies": ["@biomejs/biome"]
|
||||||
"@biomejs/biome"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,8 @@ details:has(li.has-recent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-timestamp,
|
.article-timestamp,
|
||||||
.feed-url {
|
.feed-url,
|
||||||
|
.article-links {
|
||||||
font-size: 0.75em;
|
font-size: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ const finishBuild: () => void = async () => {
|
||||||
data: sortedFeeds,
|
data: sortedFeeds,
|
||||||
errors: errors,
|
errors: errors,
|
||||||
info: buboInfo,
|
info: buboInfo,
|
||||||
|
yazzyUrl: process.env.YAZZY_URL,
|
||||||
});
|
});
|
||||||
|
|
||||||
// write the output to public/index.html
|
// 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 { getRelativeTime } from "@feelinglovelynow/get-relative-time";
|
||||||
import type { Feeds, JSONValue } from "./@types/bubo";
|
import type { Feeds, JSONValue } from "./@types/bubo";
|
||||||
|
|
||||||
|
const yazzyUrl = process.env.YAZZY_URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global filters for my Nunjucks templates
|
* Global filters for my Nunjucks templates
|
||||||
*/
|
*/
|
||||||
|
|
@ -23,7 +25,7 @@ env.addFilter("formatTime", (dateString): string => {
|
||||||
return !Number.isNaN(date.getTime()) ? date.toLocaleTimeString() : dateString;
|
return !Number.isNaN(date.getTime()) ? date.toLocaleTimeString() : dateString;
|
||||||
});
|
});
|
||||||
|
|
||||||
env.addGlobal("now", new Date().toUTCString());
|
env.addGlobal("now", new Date().getTime());
|
||||||
|
|
||||||
// load the template
|
// load the template
|
||||||
const template: string = (
|
const template: string = (
|
||||||
|
|
@ -35,15 +37,18 @@ const render = ({
|
||||||
data,
|
data,
|
||||||
errors,
|
errors,
|
||||||
info,
|
info,
|
||||||
|
yazzyUrl,
|
||||||
}: {
|
}: {
|
||||||
data: Feeds;
|
data: Feeds;
|
||||||
errors: unknown[];
|
errors: unknown[];
|
||||||
info?: JSONValue;
|
info?: JSONValue;
|
||||||
|
yazzyUrl?: string;
|
||||||
}) => {
|
}) => {
|
||||||
return env.renderString(template, {
|
return env.renderString(template, {
|
||||||
data,
|
data,
|
||||||
errors,
|
errors,
|
||||||
info,
|
info,
|
||||||
|
yazzyUrl,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,17 +14,10 @@
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"typeRoots": [
|
"typeRoots": ["src/@types"],
|
||||||
"src/@types"
|
|
||||||
],
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"*": [
|
"*": ["node_modules/*", "src/@types"]
|
||||||
"node_modules/*",
|
|
||||||
"src/@types"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src/**/*"]
|
||||||
"src/**/*"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue