nuxt.config.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import { existsSync, readFileSync } from 'node:fs'
  2. import { dirname, resolve } from 'node:path'
  3. import { templateCompilerOptions } from '@tresjs/core'
  4. function findMonorepoRootPackageJson(startDir: string): string | undefined {
  5. let dir = startDir
  6. while (true) {
  7. const pkgPath = resolve(dir, 'package.json')
  8. if (existsSync(pkgPath)) {
  9. const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
  10. // Check for a field unique to your monorepo root
  11. if (pkg.workspaces || pkg.name === '@tresjs/core') {
  12. return pkgPath
  13. }
  14. }
  15. const parentDir = dirname(dir)
  16. if (parentDir === dir) {
  17. break
  18. }
  19. dir = parentDir
  20. }
  21. return undefined
  22. }
  23. const rootPkgPath = findMonorepoRootPackageJson(__dirname)
  24. const pkg = JSON.parse(readFileSync(rootPkgPath!, 'utf-8'))
  25. // https://nuxt.com/docs/api/configuration/nuxt-config
  26. export default defineNuxtConfig({
  27. modules: [
  28. '@nuxt/image',
  29. '@nuxt/ui-pro',
  30. '@nuxt/content',
  31. 'nuxt-llms',
  32. ],
  33. image: {
  34. quality: 80,
  35. format: ['webp', 'png', 'jpg'],
  36. },
  37. router: {
  38. options: {
  39. strict: true,
  40. },
  41. },
  42. devtools: {
  43. enabled: true,
  44. },
  45. css: ['~/assets/css/main.css'],
  46. vue: {
  47. compilerOptions: templateCompilerOptions.template.compilerOptions,
  48. },
  49. content: {
  50. build: {
  51. markdown: {
  52. toc: {
  53. searchDepth: 1,
  54. },
  55. },
  56. },
  57. },
  58. runtimeConfig: {
  59. public: {
  60. pkgVersion: pkg.version,
  61. },
  62. },
  63. future: {
  64. compatibilityVersion: 4,
  65. },
  66. compatibilityDate: '2024-07-11',
  67. nitro: {
  68. prerender: {
  69. routes: [
  70. '/',
  71. ],
  72. crawlLinks: true,
  73. },
  74. },
  75. icon: {
  76. provider: 'iconify',
  77. },
  78. llms: {
  79. domain: 'https://docs.tresjs.org/',
  80. title: 'TresJS Docs',
  81. description: 'A documentation for building 3D scenes with TresJS.',
  82. full: {
  83. title: 'TresJS - Full Documentation',
  84. description: 'This is the full documentation for the TresJS written in markdown (MDC Syntax)',
  85. },
  86. sections: [
  87. {
  88. title: 'Getting Started', // docs/content/1.getting-started
  89. contentCollection: 'docs',
  90. contentFilters: [
  91. { field: 'path', operator: 'LIKE', value: '/getting-started%' },
  92. ],
  93. },
  94. {
  95. title: 'Essentials', // docs/content/2.essentials
  96. contentCollection: 'docs',
  97. contentFilters: [
  98. { field: 'path', operator: 'LIKE', value: '/essentials%' },
  99. ],
  100. },
  101. {
  102. title: 'API Reference', // docs/content/3.api
  103. contentCollection: 'docs',
  104. contentFilters: [
  105. { field: 'path', operator: 'LIKE', value: '/api%' },
  106. ],
  107. },
  108. {
  109. title: 'Cookbook', // docs/content/4.cookbook
  110. contentCollection: 'docs',
  111. contentFilters: [
  112. { field: 'path', operator: 'LIKE', value: '/cookbook%' },
  113. ],
  114. },
  115. ],
  116. },
  117. })