1
0

nuxt.config.ts 2.7 KB

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