Complete refactor (#123)

This commit is contained in:
Misode
2020-11-23 14:29:16 +01:00
committed by GitHub
parent 0ad33cd88f
commit 982b4728e7
45 changed files with 1162 additions and 1113 deletions

View File

@@ -5,7 +5,7 @@ const webpack = require('webpack');
const config = require('./src/config.json')
module.exports = (env, argv) => ({
entry: './src/app/app.ts',
entry: './src/app/Router.ts',
output: {
path: __dirname + '/dist',
filename: 'js/bundle.js'
@@ -47,20 +47,10 @@ module.exports = (env, argv) => ({
filename: '404.html',
template: 'src/index.html'
}),
...config.models.flatMap(buildModel)
...config.models.map(m => new HtmlWebpackPlugin({
title: `${m.name} Generator${m.category === true ? 's' : ''} Minecraft 1.16, 1.17`,
filename: `${m.id}/index.html`,
template: 'src/index.html'
}))
]
})
function buildModel(model) {
const page = new HtmlWebpackPlugin({
title: `${model.name} Generator Minecraft 1.16, 1.17`,
filename: `${model.id}/index.html`,
template: 'src/index.html'
})
if (model.schema) {
return page
} else if (model.children) {
return [page, ...model.children.flatMap(buildModel)]
}
return []
}