Gérer le statut draft pour Lemmy et la météo
This commit is contained in:
@@ -6,6 +6,7 @@ const { extractRawDate, readFrontmatter, writeFrontmatter } = require("./lib/wea
|
||||
const { resolveArticleDate } = require("./lib/weather/time");
|
||||
const { fetchWeather, hasConfiguredProvider, mergeWeather } = require("./lib/weather/providers");
|
||||
const { loadWeatherConfig } = require("./lib/weather/config");
|
||||
const { isEffectivelyPublishedDocument } = require("./lib/publication");
|
||||
|
||||
const CONTENT_ROOT = path.resolve("content");
|
||||
|
||||
@@ -16,6 +17,10 @@ async function processFile(filePath, config, { force = false } = {}) {
|
||||
return { status: "no-frontmatter" };
|
||||
}
|
||||
|
||||
if (isEffectivelyPublishedDocument(frontmatter.doc) === false) {
|
||||
return { status: "draft" };
|
||||
}
|
||||
|
||||
let existingWeather = null;
|
||||
if (frontmatter.doc.has("weather")) {
|
||||
existingWeather = frontmatter.doc.get("weather");
|
||||
@@ -124,6 +129,10 @@ async function main() {
|
||||
updated += 1;
|
||||
console.log(`• Added empty weather to ${relativePath}`);
|
||||
break;
|
||||
case "draft":
|
||||
skipped += 1;
|
||||
console.log(`• Skipped draft article ${relativePath}`);
|
||||
break;
|
||||
default:
|
||||
skipped += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user