forked from workshopper/javascripting
-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.js
33 lines (30 loc) · 825 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
const path = require("path");
const fs = require("fs");
const problem = require("./lib/problem");
const i18nDir = path.join(__dirname, "i18n");
const languages = ["ja"].concat(
fs
.readdirSync(i18nDir)
.filter((f) => f.match(/\w+\.json/))
.map((f) => f.replace(".json", ""))
.filter((f) => f !== "ja"),
);
const jsing = require("workshopper-adventure")({
appDir: __dirname,
languages,
header: require("workshopper-adventure/default/header"),
footer: require("./lib/footer.js"),
});
jsing.addAll(
require("./menu.json").map(function (name) {
return {
name,
fn: function () {
const p = name.toLowerCase().replace(/\s/g, "-");
const dir = require("path").join(__dirname, "problems", p);
return problem(dir);
},
};
}),
);
module.exports = jsing;