-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
54 lines (49 loc) · 1.34 KB
/
index.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
47
48
49
50
51
52
53
54
const fs = require('file-system');
const package = require('./package.json');
const { Parser } = require('./parser/');
const { Compiler } = require('./compiler/');
var config = {
"compilerVersion": package.version,
"inDir": "./",
"outDir": "./"
};
var parser;
async function main() {
await setup().catch(e => {
throw new Error(e);
});
console.log(config)
if (fs.existsSync(config.inDir)) {
fs.mkdirSync(config.outDir);
parser = new Parser(config);
parser.initDir();
}
else {
throw new Error("InputDir Does Not Exist");
}
}
function setup() {
return new Promise(async (resolve, reject) => {
var error = [];
var args = process.argv.slice(2);
if (args.length > 0) {
if (fs.existsSync('./scar.config.json')) {
console.log("Ignoring Duplicate Config Entries and Preffering args");
}
console.log(args)
}
else {
if (fs.existsSync('./scar.config.json')) {
config = JSON.parse(fs.readFileSync('./scar.config.json'));
}
else {
console.log("using Standard Config");
}
}
if (error.length > 0) {
reject("Something Went Wrong with the Setup");
}
else resolve();
})
}
main();