forked from workshopper/javascripting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (25 loc) · 744 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
const path = require('path')
const fs = require('fs')
const problem = require('./lib/problem')
const i18nDir = path.join(__dirname, 'i18n')
const languages = ['en'].concat(fs.readdirSync(i18nDir)
.filter((f) => f.match(/\w+\.json/))
.map((f) => f.replace('.json', ''))
)
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