Skip to content

Commit efecef5

Browse files
committed
feat: print published issue titles during build
1 parent 20f6af4 commit efecef5

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

‎scripts/prepare-static-data.mjs‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ function isPublishedIssue(issue) {
3838
);
3939
}
4040

41+
function getPublishedIssues(issues) {
42+
return issues
43+
.filter(isPublishedIssue)
44+
.sort(
45+
(left, right) =>
46+
new Date(right.updated_at).getTime() - new Date(left.updated_at).getTime()
47+
);
48+
}
49+
4150
function sleep(ms) {
4251
return new Promise((resolve) => setTimeout(resolve, ms));
4352
}
@@ -240,11 +249,15 @@ async function main() {
240249

241250
await writeArtifacts(data);
242251

252+
const publishedIssues = getPublishedIssues(data.issues);
253+
243254
console.log(
244-
`[prepare-static-data] snapshot refreshed with ${
245-
data.issues.filter(isPublishedIssue).length
246-
} published posts`
255+
`[prepare-static-data] snapshot refreshed with ${publishedIssues.length} published posts`
247256
);
257+
console.log("[prepare-static-data] published issue titles (newest first):");
258+
publishedIssues.forEach((issue) => {
259+
console.log(`- ${issue.updated_at} ${issue.title}`);
260+
});
248261
} catch (error) {
249262
if (!allowStaleSnapshot) {
250263
throw error;

0 commit comments

Comments
 (0)