123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- import { existsSync, readFileSync } from 'node:fs'
- import { dirname, resolve } from 'node:path'
- import { templateCompilerOptions } from '@tresjs/core'
- function findMonorepoRootPackageJson(startDir: string): string | undefined {
- let dir = startDir
- while (true) {
- const pkgPath = resolve(dir, 'package.json')
- if (existsSync(pkgPath)) {
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
- // Check for a field unique to your monorepo root
- if (pkg.workspaces || pkg.name === '@tresjs/core') {
- return pkgPath
- }
- }
- const parentDir = dirname(dir)
- if (parentDir === dir) {
- break
- }
- dir = parentDir
- }
- return undefined
- }
- const rootPkgPath = findMonorepoRootPackageJson(__dirname)
- const pkg = JSON.parse(readFileSync(rootPkgPath!, 'utf-8'))
- // https://nuxt.com/docs/api/configuration/nuxt-config
- export default defineNuxtConfig({
- modules: [
- '@nuxt/image',
- '@nuxt/ui-pro',
- '@nuxt/content',
- 'nuxt-llms',
- ],
- devtools: {
- enabled: true,
- },
- css: ['~/assets/css/main.css'],
- vue: {
- compilerOptions: templateCompilerOptions.template.compilerOptions,
- },
- content: {
- build: {
- markdown: {
- toc: {
- searchDepth: 1,
- },
- },
- },
- },
- runtimeConfig: {
- public: {
- pkgVersion: pkg.version,
- },
- },
- future: {
- compatibilityVersion: 4,
- },
- compatibilityDate: '2024-07-11',
- nitro: {
- prerender: {
- routes: [
- '/',
- ],
- crawlLinks: true,
- },
- },
- icon: {
- provider: 'iconify',
- },
- llms: {
- domain: 'https://docs.tresjs.org/',
- title: 'TresJS Docs',
- description: 'A documentation for building 3D scenes with TresJS.',
- full: {
- title: 'TresJS - Full Documentation',
- description: 'This is the full documentation for the TresJS written in markdown (MDC Syntax)',
- },
- sections: [
- {
- title: 'Getting Started', // docs/content/1.getting-started
- contentCollection: 'docs',
- contentFilters: [
- { field: 'path', operator: 'LIKE', value: '/getting-started%' },
- ],
- },
- {
- title: 'Essentials', // docs/content/2.essentials
- contentCollection: 'docs',
- contentFilters: [
- { field: 'path', operator: 'LIKE', value: '/essentials%' },
- ],
- },
- {
- title: 'API Reference', // docs/content/3.api
- contentCollection: 'docs',
- contentFilters: [
- { field: 'path', operator: 'LIKE', value: '/api%' },
- ],
- },
- {
- title: 'Cookbook', // docs/content/4.cookbook
- contentCollection: 'docs',
- contentFilters: [
- { field: 'path', operator: 'LIKE', value: '/cookbook%' },
- ],
- },
- ],
- },
- })
|