Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ import react from "@astrojs/react";
import starlightLlmsTxt from "starlight-llms-txt";
import favicons from "astro-favicons";
import icon from "astro-icon";
import lunaria from "@lunariajs/starlight";
import { sidebar } from "./astro.sidebar.ts";
import { ENV } from "./src/lib/env";
import { ogImagesIntegration } from "./src/integrations/ogImages";
import { SUPPORTED_LANGUAGES, SITE_TITLES } from "./src/config/18n";
import { SUPPORTED_LANGUAGES, SITE_TITLES } from "./src/config/i18n.mjs";
import { firebaseIntegration } from "./src/integrations/firebase";
import { remarkClientOnly } from "./src/plugins";
import { devServerFileWatcher } from "./src/integrations/dev-server-file-watcher";
import { filterBoolean } from "./src/utils/filterBoolean";
// import { isMoveReferenceEnabled } from "./src/utils/isMoveReferenceEnabled";
// import { rehypeAddDebug } from "./src/plugins";

Expand Down Expand Up @@ -111,12 +113,18 @@ export default defineConfig({
PageTitle: "./src/starlight-overrides/PageTitle.astro",
Sidebar: "./src/starlight-overrides/Sidebar.astro",
},
plugins: [
plugins: filterBoolean([
starlightLlmsTxt({
promote: ["index*", "get-started"],
demote: ["404"],
exclude: ["404"],
}),
// Skip lunaria plugin on CI, since it tries to clone the repo in all workflows
!process.env.GITHUB_RUN_ID &&
lunaria({
sync: true,
route: "/i18n-status",
}),
...(hasAlgoliaConfig
? [
starlightDocSearch({
Expand All @@ -142,7 +150,7 @@ export default defineConfig({
),
]
: []),
],
]),
sidebar,
customCss: ["./src/globals.css", "katex/dist/katex.min.css"],
}),
Expand Down
27 changes: 27 additions & 0 deletions lunaria.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "./node_modules/@lunariajs/core/config.schema.json",
"repository": {
"name": "aptos-labs/aptos-docs"
},
"files": [
{
"location": "src/content/docs/**/*.{md,mdx}",
"pattern": "src/content/docs/@lang/@path",
"type": "universal"
}
],
"locales": [
{
"label": "简体中文",
"lang": "zh"
},
{
"label": "日本語",
"lang": "ja"
}
],
"defaultLocale": {
"label": "English",
"lang": "en"
}
}
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
"format:eslint": "pnpm run lint --fix",
"format:prettier": "prettier . --write",
"format:content": "remark \"src/content/**/*.mdx\" --output --use remark-mdx",
"postinstall": "pnpm exec simple-git-hooks"
"postinstall": "pnpm exec simple-git-hooks",
"lunaria:build": "lunaria build",
"lunaria:preview": "lunaria preview"
},
"engines": {
"node": "22.x",
Expand All @@ -45,6 +47,8 @@
"@expressive-code/plugin-collapsible-sections": "^0.40.2",
"@graphiql/toolkit": "^0.11.1",
"@iconify/json": "^2.2.324",
"@lunariajs/core": "^0.1.1",
"@lunariajs/starlight": "^0.1.1",
"@nanostores/react": "^0.8.4",
"@octokit/graphql": "^8.2.1",
"@readme/openapi-parser": "^2.7.0",
Expand Down Expand Up @@ -126,7 +130,8 @@
"starlight-openapi": "patches/starlight-openapi.patch",
"@scalar/api-client": "patches/@scalar__api-client.patch",
"[email protected]": "patches/[email protected]",
"@vercel/node": "patches/@vercel__node.patch"
"@vercel/node": "patches/@vercel__node.patch",
"@lunariajs/[email protected]": "patches/@[email protected]"
},
"overrides": {
"vite": "^6",
Expand Down
26 changes: 26 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/dist/status/git.mjs b/dist/status/git.mjs
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/dist/status/git.mjs
+++ b/dist/status/git.mjs
@@ -22,7 +22,20 @@ async function handleShallowRepo({ cloneDir, repository }) {
const target = resolve(cloneDir);
if (existsSync(target))
rmSync(target, { recursive: true, force: true });
- await git.clone(gitHostingLinks.clone(), target, ["--bare", "--filter=blob:none"]);
+ // Try to use authentication token if available
+ const token = process.env.GITHUB_TOKEN_LUNARIA;
+ const originalCloneUrl = gitHostingLinks.clone();
+ const cloneUrl = token && repository.hosting === "github"
+ ? `https://${token}@github.com/${repository.name}.git`
+ : originalCloneUrl;
+
+ try {
+ await git.clone(cloneUrl, target, ["--bare", "--filter=blob:none"]);
+ } catch (e) {
+ // If authentication fails, fall back to the original URL
+ console.log(info("Authentication failed, falling back to public URL"));
+ await git.clone(originalCloneUrl, target, ["--bare", "--filter=blob:none"]);
+ }
await git.cwd({ path: target, root: true });
}
return isShallowRepo;
94 changes: 94 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/generate-middleware-matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const rootDir = path.resolve(__dirname, "..");
async function getSupportedLanguages() {
try {
// Dynamically import the languages from config file
const { SUPPORTED_LANGUAGES } = await import("../src/config/18n.ts");
const { SUPPORTED_LANGUAGES } = await import("../src/config/i18n.mjs");
return SUPPORTED_LANGUAGES;
} catch (error) {
console.error(
Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { getPathMaps } from "../loaders/breadcrumbsLoader";

// Extract locale from the URL path
import { SUPPORTED_LANGUAGES } from "~/config/18n";
import { SUPPORTED_LANGUAGES } from "~/config/i18n.mjs";

// --- Component Props ---
interface Props {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Move404/index.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { Code } from "@astrojs/starlight/components";
import defaultCode from "./code/404.move?raw";
import { SUPPORTED_LANGUAGES } from "~/config/18n";
import { SUPPORTED_LANGUAGES } from "~/config/i18n.mjs";

// Create a type from the supported language codes (excluding 'en' which uses default)
type SupportedLang = Exclude<(typeof SUPPORTED_LANGUAGES)[number]["code"], "en">;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/loaders/breadcrumbsLoader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCollection } from "astro:content";
import { SUPPORTED_LANGUAGES } from "~/config/18n";
import { SUPPORTED_LANGUAGES } from "~/config/i18n.mjs";

// Define the return type for the path maps
export interface PathMaps {
Expand Down
2 changes: 1 addition & 1 deletion src/middlewares/i18n-redirect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SUPPORTED_LANGUAGES } from "../config/18n";
import { SUPPORTED_LANGUAGES } from "../config/i18n.mjs";

const LANGUAGE_CODES = SUPPORTED_LANGUAGES.map((lang) => lang.code);
const DEFAULT_LANG = "en";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[...lang]/move-reference.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getCollection } from "astro:content";
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
import { Tabs, TabItem } from "@astrojs/starlight/components";
import FallbackContentNotice from "@astrojs/starlight/components/FallbackContentNotice.astro";
import { SUPPORTED_LANGUAGES } from "~/config/18n";
import { SUPPORTED_LANGUAGES } from "~/config/i18n.mjs";
import { MOVE_REFERENCE_BRANCHES, type MoveNetwork } from "~/content.config";
import { isMoveReferenceEnabled } from "~/utils/isMoveReferenceEnabled";
import MoveReferenceDisabled from "~/components/MoveReferenceDisabled.astro";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[...lang]/move-reference/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
import FallbackContentNotice from "@astrojs/starlight/components/FallbackContentNotice.astro";
import { getCollection, render } from "astro:content";
import { SUPPORTED_LANGUAGES } from "~/config/18n";
import { SUPPORTED_LANGUAGES } from "~/config/i18n.mjs";
import { isMoveReferenceEnabled } from "~/utils/isMoveReferenceEnabled";

export async function getStaticPaths() {
Expand Down
Loading