about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-11 20:25:43 +0200
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-11 20:25:43 +0200
commit293388bf6c338fb5a2bc2d05ff526750f28bb4bc (patch)
tree98065e7cdd518f095634be903d48a6f898df4348 /scripts
parentc29fcbdf765e36023985996334ad711f4bc2b6fa (diff)
downloadpuszcza-293388bf6c338fb5a2bc2d05ff526750f28bb4bc.tar.gz
puszcza-293388bf6c338fb5a2bc2d05ff526750f28bb4bc.zip
Add attribute parsing
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generateApi.js8
-rwxr-xr-xscripts/postbuild.sh2
2 files changed, 7 insertions, 3 deletions
diff --git a/scripts/generateApi.js b/scripts/generateApi.js
index f439252..82bd583 100755
--- a/scripts/generateApi.js
+++ b/scripts/generateApi.js
@@ -1,13 +1,17 @@
+const fs = require('fs')
+
 let { getPosts } = require('../api/api')
 
 let posts = getPosts()
 
-posts = posts.map(({ year, month, day, title, route }) => {
+posts = posts.map(({ year, month, day, title, attributes, route }) => {
     return {
         date: `${year}-${month}-${day}`,
         title,
+        attributes,
         route
     }
 })
 
-console.log(posts)
\ No newline at end of file
+fs.writeFile('./dist/api/posts.json', JSON.stringify(posts), (err) => err ? console.log(err) : null)
+console.log(posts)
diff --git a/scripts/postbuild.sh b/scripts/postbuild.sh
index 53a1702..749bfdd 100755
--- a/scripts/postbuild.sh
+++ b/scripts/postbuild.sh
@@ -2,5 +2,5 @@
 
 mkdir ./dist/api
 
-node ./scripts/generateApi.js > ./dist/api/posts.json
+node ./scripts/generateApi.js