-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (26 loc) · 934 Bytes
/
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
#!/usr/local/bin/node
const fs = require("fs");
const Handler = require("./handlers/handler");
const Store = require("./store/store");
const scanFiles = require("./utils/scan-files");
const getRootConfiguration = require("./utils/get-root-configuration");
function createDataFile(store) {
fs.writeFileSync("data.json", JSON.stringify(store.texts, null, 2));
}
function createMetaData(store) {
fs.writeFileSync("meta-data.json", JSON.stringify(store.toJson(), null, 2));
}
// // todo
// function createGroups({ data, index, groups }) {}
// // todo
// const langConfJson = /langconf.json$/;
// const langTextJson = /langtexts.json$/;
const configuration = getRootConfiguration();
const store = new Store();
const handler = new Handler(configuration.checkFiles);
const files = scanFiles(__dirname, configuration.ignore);
files.forEach(data => {
handler.run(data, store);
});
createDataFile(store);
createMetaData(store);