-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.mjs
65 lines (56 loc) · 1.46 KB
/
setup.mjs
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { dirname, join } from 'path';
import { asyncProcess } from './utils/utils.mjs';
const __dirname = decodeURI(dirname(new URL(import.meta.url).pathname));
console.log(__dirname);
debugger;
(async () => {
console.log('Cloning Imgur Clone');
// ============================
// ==== Imgur Installation ====
// ============================
try {
await asyncProcess('git clone https://github.com/Twiggeh/ImgurClone', {
cwd: __dirname,
shell: true,
})[0];
} catch (e) {
console.error('Could not download Imgur Clone.');
console.error(e);
}
try {
console.log('Starting Imgur installation');
await asyncProcess('node setup.js', {
cwd: join(__dirname, 'ImgurClone'),
shell: true,
})[0];
} catch (e) {
console.error('Could not install Imgur.');
console.error(e);
}
// ================================
// ==== Portfolio Installation ====
// ================================
try {
console.log('Installing Client dependencies');
await asyncProcess('ls', {
cwd: join(__dirname, 'client'),
shell: true,
})[0];
} catch (e) {
console.error('Could not install client dependencies.');
console.error(e);
}
try {
console.log('Installing Server dependencies');
await asyncProcess('yarn', {
cwd: join(__dirname, 'server'),
shell: true,
})[0];
} catch (e) {
console.error('Could not install server dependencies.');
console.error(e);
}
// TODO: Build server and client once
console.log('Done :D');
process.exit(0);
})();