-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
setup.ts
34 lines (33 loc) · 902 Bytes
/
setup.ts
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
28
29
30
31
32
33
34
import { FS } from '@bcms/selfhosted-utils/fs';
export async function setup() {
const rootFs = new FS(process.cwd());
const dirs = [
['db'],
['uploads'],
['backups'],
['backend', 'logs'],
['backend', 'docs'],
['backend', 'additional'],
['backend', 'events'],
['backend', 'functions'],
['backend', 'jobs'],
['backend', 'plugins'],
];
for (let i = 0; i < dirs.length; i++) {
const dir = dirs[i];
if (!(await rootFs.exist(dir))) {
await rootFs.mkdir(dir);
}
}
const files = [
['backend', '.env'],
['backend', 'custom-package.json'],
['ui', '.env'],
];
for (let i = 0; i < files.length; i++) {
const file = files[i];
if (!(await rootFs.exist(file, true))) {
await rootFs.save(file, '');
}
}
}