blob: 92a4f3c83a5f8bb4d7dca2b3896a6ac41b58f8ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { access, mkdir, remove } from "fs-extra";
import { promisify } from "util";
import { exec } from "child_process";
import { config } from "dotenv";
const promiseExec = promisify(exec);
config({ path: "test/test.env" });
export default async function init() {
jest.setTimeout(10000);
const can_access = await access(process.env.BASE_DIR)
.then(() => true)
.catch(() => false);
if(can_access) {
await remove(process.env.BASE_DIR);
}
await mkdir(process.env.BASE_DIR);
const git_clone = await promiseExec(`git clone -q --bare ${process.env.AVAIL_REPO_URL} ${process.env.BASE_DIR}/${process.env.AVAIL_REPO}`);
if(git_clone.stderr) {
throw(git_clone.stderr);
}
}
|