mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 15:17:09 +00:00
Add config file and support categories
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin");
|
||||
const config = require('./src/config.json')
|
||||
|
||||
module.exports = (env, argv) => ({
|
||||
entry: './src/app/app.ts',
|
||||
@@ -28,12 +29,10 @@ module.exports = (env, argv) => ({
|
||||
}),
|
||||
new MergeJsonWebpackPlugin({
|
||||
output: {
|
||||
groupBy: [ 'de', 'en', 'fr', 'it', 'ja', 'pt', 'ru', 'zh-cn' ].map(code => (
|
||||
{
|
||||
pattern: `{./src/locales/${code}.json,./node_modules/@mcschema/core/locales/${code}.json}`,
|
||||
fileName: `./locales/${code}.json`
|
||||
}
|
||||
))
|
||||
groupBy: config.languages.map(lang => ({
|
||||
pattern: `{./src/locales/${lang.code}.json,./node_modules/@mcschema/core/locales/${lang.code}.json}`,
|
||||
fileName: `./locales/${lang.code}.json`
|
||||
}))
|
||||
}
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
@@ -41,23 +40,20 @@ module.exports = (env, argv) => ({
|
||||
filename: 'index.html',
|
||||
template: 'src/index.html'
|
||||
}),
|
||||
...[
|
||||
[ 'loot-table', 'Loot Table' ],
|
||||
[ 'predicate', 'Predicate' ],
|
||||
[ 'advancement', 'Advancement' ],
|
||||
[ 'dimension', 'Dimension' ],
|
||||
[ 'dimension-type', 'Dimension Type' ],
|
||||
[ 'worldgen/biome', 'Biome' ],
|
||||
[ 'worldgen/carver', 'Carver' ],
|
||||
[ 'worldgen/feature', 'Feature' ],
|
||||
[ 'worldgen/structure-feature', 'Structure Feature' ],
|
||||
[ 'worldgen/surface-builder', 'Surface Builder' ],
|
||||
[ 'worldgen/processor-list', 'Processor List' ],
|
||||
[ 'worldgen/template-pool', 'Template Pool' ],
|
||||
].map(page => new HtmlWebpackPlugin({
|
||||
title: `${page[1]} Generators Minecraft`,
|
||||
filename: `${page[0]}/index.html`,
|
||||
template: 'src/index.html'
|
||||
}))
|
||||
...config.models.flatMap(buildModel)
|
||||
]
|
||||
})
|
||||
|
||||
function buildModel(model) {
|
||||
const page = new HtmlWebpackPlugin({
|
||||
title: `${model.name} Generators Minecraft`,
|
||||
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 []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user