mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 23:49:51 +00:00
feat(mdx): support _fumadocs_skipViteConfig flag for Vite plugin
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-mdx': patch
|
||||
---
|
||||
|
||||
Support `_fumadocs_skipViteConfig` internal flag
|
||||
@@ -7,7 +7,6 @@
|
||||
"clean": "turbo run clean",
|
||||
"dev": "turbo run dev",
|
||||
"dev:examples": "turbo run dev --filter=./examples/*",
|
||||
"sync-ui": "bash ./scripts/mirror-ui-change.sh",
|
||||
"lint": "turbo run lint",
|
||||
"lint:format": "oxfmt --check",
|
||||
"format": "oxfmt",
|
||||
|
||||
@@ -42,8 +42,8 @@ export function createMdxLoader({ getCore }: ConfigLoader): Loader {
|
||||
const cacheKey = `${collectionName ?? 'global'}_${generateCacheHash(filePath)}`;
|
||||
|
||||
const cached = await fs
|
||||
.readFile(path.join(cacheDir, cacheKey))
|
||||
.then((content) => cacheEntry.parse(JSON.parse(content.toString())))
|
||||
.readFile(path.join(cacheDir, cacheKey), 'utf-8')
|
||||
.then((content) => cacheEntry.parse(JSON.parse(content)))
|
||||
.catch(() => null);
|
||||
|
||||
if (cached && cached.hash === generateCacheHash(value)) return cached;
|
||||
|
||||
@@ -60,7 +60,8 @@ export default async function mdx(
|
||||
return [
|
||||
{
|
||||
name: 'fumadocs-mdx',
|
||||
async config() {
|
||||
async config(config) {
|
||||
if ('_fumadocs_skipViteConfig' in config && config._fumadocs_skipViteConfig) return;
|
||||
if (!options.updateViteConfig) return;
|
||||
|
||||
const { getConfig } = await import('@fumadocs/vite');
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage: ./mirror-ui-change.sh [commit_hash]
|
||||
# mirror changes in radix-ui to base-ui
|
||||
COMMIT_HASH=$1
|
||||
|
||||
SRC_PATH="packages/radix-ui/src"
|
||||
DEST_PATH="packages/base-ui/src"
|
||||
|
||||
# 1. Generate the patch
|
||||
if [ -z "$COMMIT_HASH" ]; then
|
||||
echo "Capturing local changes from $SRC_PATH..."
|
||||
PATCH_DATA=$(git diff HEAD -- "$SRC_PATH")
|
||||
else
|
||||
echo "Capturing commit $COMMIT_HASH from $SRC_PATH..."
|
||||
PATCH_DATA=$(git show "$COMMIT_HASH" -- "$SRC_PATH")
|
||||
fi
|
||||
|
||||
if [ -z "$PATCH_DATA" ]; then
|
||||
echo "No changes found in $SRC_PATH."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 2. Apply the patch
|
||||
# -p4 strips 'a/packages/radix-ui/src/' (4 levels)
|
||||
# --directory prepends 'packages/base-ui/src/'
|
||||
echo "$PATCH_DATA" | git apply --directory="$DEST_PATH" -p4
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Successfully mirrored to $DEST_PATH"
|
||||
else
|
||||
echo "Failed to apply patch. Ensure $DEST_PATH folder structure matches $SRC_PATH."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user