🐛 updated rss by hand
All checks were successful
Update RSS / update-rss (push) Successful in 5m17s

currently new drop detection not working!!!
This commit is contained in:
2024-08-28 21:14:11 +02:00
parent 200669791c
commit 1ffe1ab293
3 changed files with 99 additions and 4 deletions

17
cli.mjs
View File

@ -53,6 +53,13 @@ $.api()
if(is_git) gitCommit(changed, "pull");
$.exit(0);
})
.command("only-rss", "Update RSS from known sitemap")
.action(async function onlyRSS(){
const { path, json }= knownSitemap();
const status= await toRSS({ json, changed: [ path ] });
echo({ status });
$.exit(0);
})
.parse();
function gitCommit(files, des= "not specified"){
@ -116,9 +123,7 @@ async function toRSS({ json, changed }){
import { JSDOM } from "jsdom";
/** @returns {Promise<State>} */
async function sitemap(){
const path= "sitemap.json";
/** @type {Sitemap} */
const json= s.test("-f", path) ? s.cat(path).xargs(JSON.parse) : { drops: [], articles: [] };
const { json, path }= knownSitemap();
await syncDrops(json);
const [ { drop: drop_last } ]= json.drops;
@ -149,6 +154,12 @@ async function sitemap(){
s.echo(JSON.stringify(json, null, "\t")).to(path);
return { json, changed: [ path ] };
}
function knownSitemap(){
const path= "sitemap.json";
/** @type {Sitemap} */
const json= s.test("-f", path) ? s.cat(path).xargs(JSON.parse) : { drops: [], articles: [] };
return { json, path };
}
/**
* Assumes that articles are sorted from newest to oldest
* @param {Drop.drop} drop