about summary refs log tree commit diff
path: root/scripts/generateApi.js
blob: 82bd583e1b7097346a7fd2d4e0afd1860fba35db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const fs = require('fs')

let { getPosts } = require('../api/api')

let posts = getPosts()

posts = posts.map(({ year, month, day, title, attributes, route }) => {
    return {
        date: `${year}-${month}-${day}`,
        title,
        attributes,
        route
    }
})

fs.writeFile('./dist/api/posts.json', JSON.stringify(posts), (err) => err ? console.log(err) : null)
console.log(posts)