Remove guides, they moved to the minecraft wiki

This commit is contained in:
Misode
2023-11-23 01:35:58 +01:00
parent 27e5ea707b
commit 1394711d08
30 changed files with 143 additions and 1716 deletions
+5 -42
View File
@@ -1,8 +1,5 @@
import preact from '@preact/preset-vite'
import html from '@rollup/plugin-html'
import glob from 'fast-glob'
import fs from 'fs'
import yaml from 'js-yaml'
import { env } from 'process'
import { visualizer } from 'rollup-plugin-visualizer'
import { defineConfig } from 'vite'
@@ -10,22 +7,6 @@ import { viteStaticCopy } from 'vite-plugin-static-copy'
const config = require('./src/config.json')
const English = require('./src/locales/en.json')
const guides = glob.sync('src/guides/**/*.md').flatMap(g => {
const content = fs.readFileSync(g).toString('utf-8')
if (!content.startsWith('---')) return []
try {
const frontMatter = yaml.load(content.substring(3, content.indexOf('---', 3)))
if (typeof frontMatter !== 'object') return []
return [{
id: g.replace('src/guides/', '').replace('.md', ''),
...frontMatter,
}]
} catch (e) {
console.warn('Failed loading guide', g, e.message)
return []
}
})
export default defineConfig({
server: {
port: 3000,
@@ -57,13 +38,11 @@ export default defineConfig({
title: `${English[m.id] ?? ''} Generator${m.category === true ? 's' : ''} - ${getVersions(m)}`,
template,
})),
...guides.map(g => {
return html({
fileName: `guides/${g.id}/index.html`,
title: `${g.title} - Minecraft${g.versions ? ` ${g.versions.join(' ')}` : ''}`,
template,
})
}),
...config.legacyGuides.map(g => html({
fileName: `guides/${g.id}/index.html`,
title: `${g.title} - ${getVersions()}`,
template,
})),
],
},
},
@@ -72,7 +51,6 @@ export default defineConfig({
},
define: {
__LATEST_VERSION__: env.latest_version,
__GUIDES__: guides,
},
plugins: [
preact(),
@@ -80,24 +58,9 @@ export default defineConfig({
targets: [
{ src: 'src/styles/giscus.css', dest: 'assets' },
{ src: 'src/styles/giscus-burn.css', dest: 'assets' },
{ src: 'src/guides/*', dest: 'guides' },
],
}),
visualizer({ open: true }),
{
name: 'watch-guides',
enforce: 'post',
handleHotUpdate({ file, server }) {
const match = file.match(/src\/guides\/([a-z0-9-]+)\.md/)
if (match && match[1]) {
server.ws.send({
type: 'custom',
event: 'guide-update',
data: match[1],
})
}
},
},
],
})