Add hashnode support for posts plugin and additional options (#165)

This commit is contained in:
Simon Lecoq
2021-03-02 10:17:00 +01:00
committed by GitHub
parent 4452fa36b5
commit df6638fc9e
8 changed files with 122 additions and 19 deletions

View File

@@ -0,0 +1,23 @@
/**Mocked data */
export default function({faker, url, body, login = faker.internet.userName()}) {
if (/^https:..api.hashnode.com.*$/.test(url)) {
console.debug(`metrics/compute/mocks > mocking hashnode result > ${url}`)
return ({
status:200,
data:{
data:{
user:{
publication:{
posts:new Array(30).fill(null).map(_ => ({
title:faker.lorem.sentence(),
brief:faker.lorem.paragraph(),
coverImage:null,
dateAdded:faker.date.recent(),
})),
},
},
},
},
})
}
}

View File

@@ -344,9 +344,13 @@
...(set.plugins.enabled.posts ? ({
posts:{
source:options["posts.source"],
descriptions:options["posts.descriptions"],
covers:options["posts.covers"],
list:new Array(Number(options["posts.limit"])).fill(null).map(_ => ({
title:faker.lorem.sentence(),
date:faker.date.recent().toString().substring(4, 10).trim()
description:faker.lorem.paragraph(),
date:faker.date.recent(),
image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
}))
}
}) : null),