1
0

nuxt.config.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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: ['@nuxt/image', '@nuxt/ui-pro', '@nuxt/content', 'nuxt-llms', '@nuxt/scripts'],
  28. $production: {
  29. scripts: {
  30. registry: {
  31. fathomAnalytics: {
  32. site: 'NLLAFMJJ',
  33. },
  34. },
  35. },
  36. },
  37. image: {
  38. quality: 80,
  39. format: ['webp', 'png', 'jpg'],
  40. },
  41. router: {
  42. options: {
  43. strict: true,
  44. },
  45. },
  46. devtools: {
  47. enabled: true,
  48. },
  49. css: ['~/assets/css/main.css'],
  50. vue: {
  51. compilerOptions: templateCompilerOptions.template.compilerOptions,
  52. },
  53. content: {
  54. build: {
  55. markdown: {
  56. toc: {
  57. searchDepth: 1,
  58. },
  59. },
  60. },
  61. },
  62. runtimeConfig: {
  63. public: {
  64. pkgVersion: pkg.version,
  65. },
  66. },
  67. future: {
  68. compatibilityVersion: 4,
  69. },
  70. compatibilityDate: '2024-07-11',
  71. nitro: {
  72. prerender: {
  73. routes: [
  74. '/',
  75. ],
  76. crawlLinks: true,
  77. },
  78. },
  79. icon: {
  80. provider: 'iconify',
  81. },
  82. llms: {
  83. domain: 'https://docs.tresjs.org/',
  84. title: 'TresJS Docs',
  85. description: 'A documentation for building 3D scenes with TresJS.',
  86. full: {
  87. title: 'TresJS - Full Documentation',
  88. description: 'This is the full documentation for the TresJS written in markdown (MDC Syntax)',
  89. },
  90. sections: [
  91. {
  92. title: 'Getting Started', // docs/content/1.getting-started
  93. contentCollection: 'docs',
  94. contentFilters: [
  95. { field: 'path', operator: 'LIKE', value: '/getting-started%' },
  96. ],
  97. },
  98. {
  99. title: 'Essentials', // docs/content/2.essentials
  100. contentCollection: 'docs',
  101. contentFilters: [
  102. { field: 'path', operator: 'LIKE', value: '/essentials%' },
  103. ],
  104. },
  105. {
  106. title: 'API Reference', // docs/content/3.api
  107. contentCollection: 'docs',
  108. contentFilters: [
  109. { field: 'path', operator: 'LIKE', value: '/api%' },
  110. ],
  111. },
  112. {
  113. title: 'Cookbook', // docs/content/4.cookbook
  114. contentCollection: 'docs',
  115. contentFilters: [
  116. { field: 'path', operator: 'LIKE', value: '/cookbook%' },
  117. ],
  118. },
  119. ],
  120. },
  121. })