feat(blog): add file-based blog with dynamic slugs, MDX content and layout shell

- Introduced blog routing using Next.js App Router
- Implemented dynamic [slug] pages for blog posts
- Added MDX-based content loading via lib/posts
- Integrated shared TopBar layout with navigation
- Established clear content, lib and component separation
This commit is contained in:
PascalSchattenburg
2026-01-22 14:14:15 +01:00
parent b717952234
commit d147843c76
10412 changed files with 2475583 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
import { promises } from 'fs';
import { bold, cyan, red } from './picocolors';
import path from 'path';
import { hasNecessaryDependencies } from './has-necessary-dependencies';
import { fileExists, FileType } from './file-exists';
import { FatalError } from './fatal-error';
import * as Log from '../build/output/log';
import { getPkgManager } from './helpers/get-pkg-manager';
async function missingDependencyError(dir) {
const packageManager = getPkgManager(dir);
throw Object.defineProperty(new FatalError(bold(red("It looks like you're trying to use Partytown with next/script but do not have the required package(s) installed.")) + '\n\n' + bold(`Please install Partytown by running:`) + '\n\n' + `\t${bold(cyan((packageManager === 'yarn' ? 'yarn add --dev' : packageManager === 'pnpm' ? 'pnpm install --save-dev' : 'npm install --save-dev') + ' @builder.io/partytown'))}` + '\n\n' + bold(`If you are not trying to use Partytown, please disable the experimental ${cyan('"nextScriptWorkers"')} flag in next.config.js.`) + '\n'), "__NEXT_ERROR_CODE", {
value: "E552",
enumerable: false,
configurable: true
});
}
async function copyPartytownStaticFiles(deps, staticDir) {
const partytownLibDir = path.join(staticDir, '~partytown');
const hasPartytownLibDir = await fileExists(partytownLibDir, FileType.Directory);
if (hasPartytownLibDir) {
await promises.rm(partytownLibDir, {
recursive: true,
force: true
});
}
const { copyLibFiles } = await Promise.resolve(require(path.join(deps.resolved.get('@builder.io/partytown'), '../utils')));
await copyLibFiles(partytownLibDir);
}
export async function verifyPartytownSetup(dir, targetDir) {
try {
var _partytownDeps_missing;
const partytownDeps = hasNecessaryDependencies(dir, [
{
file: '@builder.io/partytown',
pkg: '@builder.io/partytown',
exportsRestrict: false
}
]);
if (((_partytownDeps_missing = partytownDeps.missing) == null ? void 0 : _partytownDeps_missing.length) > 0) {
await missingDependencyError(dir);
} else {
try {
await copyPartytownStaticFiles(partytownDeps, targetDir);
} catch (err) {
Log.warn(`Partytown library files could not be copied to the static directory. Please ensure that ${bold(cyan('@builder.io/partytown'))} is installed as a dependency.`);
}
}
} catch (err) {
// Don't show a stack trace when there is an error due to missing dependencies
if (err instanceof FatalError) {
console.error(err.message);
// Throw to allow finally blocks to run (e.g., telemetry flush)
throw err;
}
throw err;
}
}
//# sourceMappingURL=verify-partytown-setup.js.map