forked from timmson/java-interview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (16 loc) · 842 Bytes
/
index.js
File metadata and controls
25 lines (16 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const fs = require("./lib/fs");
const Logger = require("./lib/logger");
const Transformer = require("./lib/transformer");
const logger = new Logger();
logger.info("File spellchecking and generation:");
let transformer = new Transformer();
const mdFilesContents = fs.getListOfMDFiles(__dirname).map((mdFile) => transformer.transform(__dirname + "/" + mdFile));
Promise.all(mdFilesContents.reduce((accumulator, current) => accumulator.concat(current.promises), [])).then(results => {
let errorResults = results.filter(er => er.errors && er.errors.length > 0);
if (errorResults.length > 0) {
errorResults.forEach(v => logger.errorFile(v));
process.exit(1);
}
transformer.transformRootFile(__dirname + "/" + "README.md", mdFilesContents);
transformer.persistStructure(__dirname + "/lib/" + "questions.js", mdFilesContents);
});