-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.js
46 lines (38 loc) · 1.52 KB
/
setup.js
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
const fs = require('fs');
const path = require('path');
const colors = require('colors')
const configPath = path.join('../../interintel.config.js');
const templatePath = path.join(__dirname, '/resources/interintel.config.template.js');
const readMePath = path.join('../../interintel/interintelReadMe.md');
const readMeTemplate = path.join(__dirname, '/README.md');
// Creating directory to hold onto assets
try {
fs.mkdirSync('../../interintel')
} catch (error) {
console.log('Error occurred during setup:', error)
}
// Cloning config outside of node_modules and where root typically is
try {
if (!fs.existsSync(configPath)) {
console.log('Config file does not exist, creating...');
fs.copyFileSync(templatePath, configPath);
console.log('Interintel config created. Please update it with your settings.'.yellow);
} else {
console.log('Interintel config file already exists.');
}
} catch (error) {
console.error('Error occurred during setup:', error);
}
// Cloning README outside of node_modules and where root typically is
try {
if (!fs.existsSync(readMePath)) {
console.log('Readme file does not exist, creating...');
fs.copyFileSync(readMeTemplate, readMePath);
console.log('Interintel readme created. Please update it with your settings.'.yellow);
} else {
console.log('Interintel readme file already exists.');
}
} catch (error) {
console.error('Error occurred during setup:', error);
}
console.log("Finished running setup.js script.");