#!/bin/sh

web_root=/var/www/blog

cd $(dirname $0)

echo "-> generating posts.json..."
./genposts

cd ..

echo "-> building static files..."
npx next build

echo "-> exporting static files..."
npx next export

echo "-> cleaning $web_root..."
rm -rf $web_root/*

echo "-> moving static files to $web_root..."
cp -rv out/* $web_root

echo "-> cleaning out directory..."
rm -rfv out