mirror of
https://github.com/mleem97/gregWiki.git
synced 2026-04-11 03:29:19 +02:00
docs: update docusaurus configuration and documentation structure
- Revised the tagline in `docusaurus.config.js` for improved clarity on the documentation's focus. - Removed German localization support from the configuration to streamline the user experience. - Updated navigation items in the sidebar to better reflect the current structure, emphasizing player and developer resources. - Enhanced the README and various documentation files to clarify the repository layout and improve accessibility for users. - Adjusted links and descriptions throughout the documentation to ensure consistency and accuracy. This commit aims to enhance the overall clarity and usability of the documentation.
This commit is contained in:
@@ -24,13 +24,7 @@ function walk(dir) {
|
||||
}
|
||||
}
|
||||
|
||||
const roots = [
|
||||
path.resolve(import.meta.dirname, '../docs/legacy/wiki-import'),
|
||||
path.resolve(
|
||||
import.meta.dirname,
|
||||
'../i18n/de/docusaurus-plugin-content-docs/current/legacy/wiki-import',
|
||||
),
|
||||
];
|
||||
const roots = [path.resolve(import.meta.dirname, '../docs/legacy/wiki-import')];
|
||||
for (const r of roots) {
|
||||
if (fs.existsSync(r)) walk(r);
|
||||
}
|
||||
|
||||
@@ -1,164 +1,8 @@
|
||||
/**
|
||||
* Split legacy wiki-import pairs (Base.md = DE, Base-en.md = EN) into:
|
||||
* - docs/legacy/wiki-import/** → default locale (en), Docusaurus
|
||||
* - i18n/de/.../current/legacy/wiki-import/** → Deutsch
|
||||
*
|
||||
* German-only pages (no Base-en.md) → DE in i18n/de, EN stub in docs/legacy/wiki-import.
|
||||
*
|
||||
* Usage (from gregWiki repo root):
|
||||
* node scripts/normalize-wiki-import-i18n.mjs
|
||||
* node scripts/normalize-wiki-import-i18n.mjs --dry-run
|
||||
* Legacy: split DE/EN wiki-import pairs. Retired together with docs/legacy/wiki-import/.
|
||||
*/
|
||||
|
||||
import {
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
readFileSync,
|
||||
readdirSync,
|
||||
rmSync,
|
||||
statSync,
|
||||
writeFileSync,
|
||||
} from 'node:fs';
|
||||
import {basename, dirname, join, relative, resolve} from 'node:path';
|
||||
|
||||
const repoRoot = resolve(import.meta.dirname, '..');
|
||||
const docsWikiImport = join(repoRoot, 'docs', 'legacy', 'wiki-import');
|
||||
const deWikiImport = join(
|
||||
repoRoot,
|
||||
'i18n',
|
||||
'de',
|
||||
'docusaurus-plugin-content-docs',
|
||||
'current',
|
||||
'legacy',
|
||||
'wiki-import',
|
||||
console.log(
|
||||
'[wiki:normalize-i18n] Skipped: legacy wiki-import i18n split is no longer used.\n' +
|
||||
'Curated docs are English-only under docs/.',
|
||||
);
|
||||
|
||||
const dryRun = process.argv.includes('--dry-run');
|
||||
|
||||
function englishStub(title) {
|
||||
return `---
|
||||
title: ${title}
|
||||
description: English translation pending; use the Deutsch locale for the full legacy page.
|
||||
---
|
||||
|
||||
:::note
|
||||
This page is available in **German** in the legacy wiki import. Use the language menu (**Deutsch**) for the full text, or contribute an English translation under \`docs/legacy/wiki-import\`.
|
||||
:::
|
||||
|
||||
`;
|
||||
}
|
||||
|
||||
function ensureDir(p) {
|
||||
mkdirSync(p, {recursive: true});
|
||||
}
|
||||
|
||||
function walkMarkdownFiles(root, base = root) {
|
||||
const out = [];
|
||||
for (const name of readdirSync(root)) {
|
||||
const full = join(root, name);
|
||||
const st = statSync(full);
|
||||
if (st.isDirectory()) {
|
||||
out.push(...walkMarkdownFiles(full, base));
|
||||
} else if (st.isFile() && name.toLowerCase().endsWith('.md')) {
|
||||
out.push(relative(base, full).replace(/\\/g, '/'));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function toEnSibling(rel) {
|
||||
if (!rel.endsWith('.md')) return null;
|
||||
const d = dirname(rel);
|
||||
const base = basename(rel, '.md');
|
||||
return d === '.' ? `${base}-en.md` : `${d}/${base}-en.md`;
|
||||
}
|
||||
|
||||
function main() {
|
||||
if (!existsSync(docsWikiImport)) {
|
||||
console.error(`Missing ${docsWikiImport}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const allRel = new Set(walkMarkdownFiles(docsWikiImport));
|
||||
const pairBases = new Set();
|
||||
const germanOnly = [];
|
||||
|
||||
for (const rel of allRel) {
|
||||
const file = basename(rel);
|
||||
if (file.endsWith('-en.md')) continue;
|
||||
|
||||
const enRel = toEnSibling(rel);
|
||||
if (enRel && allRel.has(enRel)) {
|
||||
pairBases.add(rel);
|
||||
continue;
|
||||
}
|
||||
|
||||
germanOnly.push(rel);
|
||||
}
|
||||
|
||||
// Paired: Base.md + Base-en.md
|
||||
for (const relBase of pairBases) {
|
||||
const enRel = toEnSibling(relBase);
|
||||
const pathBase = join(docsWikiImport, relBase);
|
||||
const pathEn = join(docsWikiImport, enRel);
|
||||
const german = readFileSync(pathBase, 'utf8');
|
||||
const english = readFileSync(pathEn, 'utf8');
|
||||
const deTarget = join(deWikiImport, relBase);
|
||||
const enTarget = join(docsWikiImport, relBase);
|
||||
|
||||
if (dryRun) {
|
||||
console.log(`[pair] ${relBase} + ${enRel} → EN docs + DE i18n`);
|
||||
continue;
|
||||
}
|
||||
|
||||
ensureDir(dirname(deTarget));
|
||||
writeFileSync(deTarget, german, 'utf8');
|
||||
writeFileSync(enTarget, english, 'utf8');
|
||||
rmSync(pathEn);
|
||||
console.log(`[pair] ${relBase}`);
|
||||
}
|
||||
|
||||
// English-only sibling (Home-en.md without Home.md) — rare
|
||||
for (const rel of allRel) {
|
||||
if (!rel.endsWith('-en.md')) continue;
|
||||
const baseRel = rel.replace(/-en\.md$/, '.md');
|
||||
if (pairBases.has(baseRel)) continue;
|
||||
|
||||
const pathEn = join(docsWikiImport, rel);
|
||||
const pathBase = join(docsWikiImport, baseRel);
|
||||
const english = readFileSync(pathEn, 'utf8');
|
||||
|
||||
if (dryRun) {
|
||||
console.log(`[en-only] ${rel} → ${baseRel}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
ensureDir(dirname(pathBase));
|
||||
writeFileSync(pathBase, english, 'utf8');
|
||||
rmSync(pathEn);
|
||||
console.log(`[en-only] ${rel} → ${baseRel}`);
|
||||
}
|
||||
|
||||
// German-only: no Base-en.md (pair bases are excluded from germanOnly)
|
||||
for (const rel of germanOnly) {
|
||||
const pathBase = join(docsWikiImport, rel);
|
||||
const german = readFileSync(pathBase, 'utf8');
|
||||
const deTarget = join(deWikiImport, rel);
|
||||
const titleMatch = german.match(/^title:\s*(.+)$/m);
|
||||
const title = titleMatch ? titleMatch[1].trim().replace(/"/g, '\\"') : basename(rel, '.md');
|
||||
|
||||
if (dryRun) {
|
||||
console.log(`[de-only] ${rel} → i18n/de + EN stub`);
|
||||
continue;
|
||||
}
|
||||
|
||||
ensureDir(dirname(deTarget));
|
||||
writeFileSync(deTarget, german, 'utf8');
|
||||
writeFileSync(pathBase, englishStub(title), 'utf8');
|
||||
console.log(`[de-only] ${rel}`);
|
||||
}
|
||||
|
||||
console.log(dryRun ? 'Dry run complete.' : 'Done. Next: npm run build');
|
||||
}
|
||||
|
||||
main();
|
||||
process.exit(0);
|
||||
|
||||
@@ -1,50 +1,9 @@
|
||||
import {existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync} from 'node:fs';
|
||||
import {join, resolve} from 'node:path';
|
||||
|
||||
const projectRoot = resolve(process.cwd());
|
||||
const gregFrameworkRoot = resolve(projectRoot, '..');
|
||||
const wikiDir = join(gregFrameworkRoot, '.wiki');
|
||||
const outDir = join(projectRoot, 'docs', 'legacy', 'wiki-import');
|
||||
|
||||
if (!existsSync(wikiDir)) {
|
||||
console.error(
|
||||
`Missing ${wikiDir}. Clone or restore the GitHub Wiki working tree there, then re-run this script.\n` +
|
||||
'Existing files under docs/legacy/wiki-import/ are left unchanged.',
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
mkdirSync(outDir, {recursive: true});
|
||||
|
||||
function collectMarkdownFiles(rootDir, prefix = '') {
|
||||
const entries = readdirSync(join(rootDir, prefix), {withFileTypes: true});
|
||||
const results = [];
|
||||
|
||||
for (const entry of entries) {
|
||||
const relativePath = prefix ? join(prefix, entry.name) : entry.name;
|
||||
if (entry.isDirectory()) {
|
||||
results.push(...collectMarkdownFiles(rootDir, relativePath));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.isFile() && entry.name.toLowerCase().endsWith('.md')) {
|
||||
results.push(relativePath);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
const files = collectMarkdownFiles(wikiDir);
|
||||
|
||||
for (const file of files) {
|
||||
const source = join(wikiDir, file);
|
||||
const sanitizedRelative = file.replace(/\s+/g, '-');
|
||||
const target = join(outDir, sanitizedRelative);
|
||||
const targetDir = resolve(target, '..');
|
||||
mkdirSync(targetDir, {recursive: true});
|
||||
const raw = readFileSync(source, 'utf8');
|
||||
writeFileSync(target, raw, 'utf8');
|
||||
}
|
||||
|
||||
console.log(`Synced ${files.length} wiki files to ${outDir}`);
|
||||
/**
|
||||
* Legacy GitHub Wiki → docs/ mirror. Removed: content now lives only under docs/ (curated).
|
||||
* Keep this script as a no-op so old CI or docs do not reference a missing file.
|
||||
*/
|
||||
console.log(
|
||||
'[wiki:sync] Skipped: the bulk wiki-import under docs/legacy/wiki-import/ was retired.\n' +
|
||||
'Author and edit Markdown under docs/ in gregWiki; use git history for old mirror text.',
|
||||
);
|
||||
process.exit(0);
|
||||
|
||||
@@ -17,13 +17,7 @@ const pairs = [
|
||||
['TechnicalReference/Troubleshooting', 'wiki-import-techref-troubleshooting'],
|
||||
];
|
||||
|
||||
const bases = [
|
||||
path.resolve(import.meta.dirname, '../docs/legacy/wiki-import'),
|
||||
path.resolve(
|
||||
import.meta.dirname,
|
||||
'../i18n/de/docusaurus-plugin-content-docs/current/legacy/wiki-import',
|
||||
),
|
||||
];
|
||||
const bases = [path.resolve(import.meta.dirname, '../docs/legacy/wiki-import')];
|
||||
|
||||
for (const base of bases) {
|
||||
if (!fs.existsSync(base)) continue;
|
||||
|
||||
Reference in New Issue
Block a user