config.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { join, dirname } from "node:path";
  2. import { fileURLToPath } from "node:url";
  3. import { defineUserConfig } from "vuepress/cli";
  4. import { defaultTheme } from "@vuepress/theme-default";
  5. import { viteBundler } from "@vuepress/bundler-vite";
  6. import { seoPlugin } from "@vuepress/plugin-seo";
  7. import { sitemapPlugin } from "@vuepress/plugin-sitemap";
  8. import { registerComponentsPlugin } from "@vuepress/plugin-register-components";
  9. import "dotenv/config";
  10. import rootPkgJson from "../../package.json";
  11. import { navbarEn, sidebarEn } from "./configs/index.js";
  12. const verMajor = Number(rootPkgJson.version.split(".")![0]);
  13. const customComponents = [
  14. "ManualSearch",
  15. ];
  16. export default defineUserConfig({
  17. lang: "en-US",
  18. base: process.env.HOST_HOMEPAGE === "true" ? `/v${verMajor}/docs/` : "/",
  19. title: "geniURL",
  20. description: "A simple JSON and XML REST API to search for song metadata, the lyrics URL and lyrics translations on genius.com",
  21. theme: defaultTheme({
  22. logo: "https://vuejs.press/images/hero.png",
  23. navbar: navbarEn,
  24. sidebar: sidebarEn,
  25. }),
  26. bundler: viteBundler(),
  27. plugins: [
  28. seoPlugin({
  29. hostname: "https://api.sv443.net",
  30. author: rootPkgJson.author,
  31. }),
  32. sitemapPlugin({
  33. hostname: "https://api.sv443.net",
  34. }),
  35. registerComponentsPlugin({
  36. components: customComponents.reduce((a, c) => {
  37. a[c] = join(dirname(fileURLToPath(import.meta.url)), `./components/${c}.vue`);
  38. return a;
  39. }, {}),
  40. }),
  41. ],
  42. });