about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generateApi.js13
-rwxr-xr-xscripts/postbuild.sh6
-rwxr-xr-xscripts/prebuild.sh12
3 files changed, 31 insertions, 0 deletions
diff --git a/scripts/generateApi.js b/scripts/generateApi.js
new file mode 100755
index 0000000..f439252
--- /dev/null
+++ b/scripts/generateApi.js
@@ -0,0 +1,13 @@
+let { getPosts } = require('../api/api')
+
+let posts = getPosts()
+
+posts = posts.map(({ year, month, day, title, route }) => {
+    return {
+        date: `${year}-${month}-${day}`,
+        title,
+        route
+    }
+})
+
+console.log(posts)
\ No newline at end of file
diff --git a/scripts/postbuild.sh b/scripts/postbuild.sh
new file mode 100755
index 0000000..6a0d1df
--- /dev/null
+++ b/scripts/postbuild.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+mkdir ./dist/api
+
+node ./script/generateApi.js > ./dist/api/posts.json
+
diff --git a/scripts/prebuild.sh b/scripts/prebuild.sh
new file mode 100755
index 0000000..22d8e00
--- /dev/null
+++ b/scripts/prebuild.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+set -x
+set -eou pipefail
+
+if [ -d ./kronika ]; then
+    cd kronika
+    git pull
+    cd ..
+else
+    git clone https://github.com/19pdh/kronika
+fi