Skip to content

Commit

Permalink
fix : simple-git cannot be used on a directory that does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Juknum committed Aug 29, 2024
1 parent 94fe816 commit 51df4c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server/actions/simple-git.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use server';
import 'server-only';

import { existsSync, readdirSync, writeFileSync } from 'fs';
import { existsSync, mkdirSync, readdirSync, writeFileSync } from 'fs';
import { join } from 'path';

import simpleGit from 'simple-git';
Expand All @@ -17,6 +17,10 @@ const LOCAL_REPOSITORY_PATH = process.env.NODE_ENV === 'production'
? '/var/www/html/data.faithfulmods.net/textures/'
: process.env.DEV_LOCAL_REPOSITORY_PATH!;

if (!existsSync(LOCAL_REPOSITORY_PATH)) {
mkdirSync(LOCAL_REPOSITORY_PATH, { recursive: true });
}

const git = simpleGit(LOCAL_REPOSITORY_PATH);

/**
Expand Down

0 comments on commit 51df4c6

Please sign in to comment.