forked from LizAinslie/inappropriate-content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
31 lines (28 loc) · 827 Bytes
/
build.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
const fs = require("fs");
const path = require("path");
if (!fs.existsSync(path.resolve(__dirname, "./dist")))
fs.mkdirSync(path.resolve(__dirname, "./dist"));
fs.readdir(path.resolve(__dirname, "./websites"), function(err, files) {
if (err) throw err;
const json = files.map(function(file) {
let content = JSON.parse(
fs.readFileSync(path.resolve(__dirname, "./websites", file))
);
content.domain = file;
return content;
});
fs.writeFileSync(
path.resolve(__dirname, "./dist/websites.json"),
JSON.stringify(json)
);
});
fs.readdir(path.resolve(__dirname, "./words"), function(err, files) {
if (err) throw err;
const json = files.map(function(file) {
return file;
});
fs.writeFileSync(
path.resolve(__dirname, "./dist/words.json"),
JSON.stringify(json)
);
});