feat: pull articles when database initialization

This commit is contained in:
Keisuke Hirata 2024-09-03 04:45:42 +09:00
parent bc0b59042e
commit 0da14f3ebf

View File

@ -2,8 +2,15 @@
import type { Postgres } from '$lib/server/database'; import type { Postgres } from '$lib/server/database';
import fs from 'fs'; import fs from 'fs';
import { compile } from 'mdsvex'; import { compile } from 'mdsvex';
import { execSync } from 'child_process';
export default async function init(db: Postgres) { export default async function init(db: Postgres) {
// Create tables(when not exists) if (fs.existsSync('./articles/')) {
console.log('Pulling articles from git..');
const stdout = execSync('git pull', { cwd: './articles/' });
console.log(stdout.toString());
}
const schemas = [ const schemas = [
{ {
name: 'article', name: 'article',