1+ import { deepMerge } from '@repo/utils/std/objects' ;
12import tailwindcss from '@tailwindcss/vite' ;
23
34import { getDocumentedExtensionBuilders } from '@repo/netlogo-docs/extension-docs' ;
@@ -7,166 +8,183 @@ import autogenConfig from './lib/docs/autogen.config';
78import * as MarkdownConfig from './lib/docs/markdown.config' ;
89import runDocsAutogen from './lib/docs/runDocsAutogen' ;
910
11+ import type { DefineNuxtConfig } from 'nuxt/config' ;
1012import { publicEnvironmentVariables , verifyEnvironmentVariables } from './env.public' ;
13+ import pdfOverrides from './nuxt.config.pdf' ;
1114import { vueUiSrc , vueUiStyles } from './turbo' ;
1215
16+ type NuxtConfigInput = Parameters < DefineNuxtConfig > [ 0 ] ;
1317const basePath = process . env [ 'BASE_PATH' ] ?? '/' ;
1418
15- // https://nuxt.com/docs/api/configuration/nuxt-config
16- export default defineNuxtConfig ( {
17- compatibilityDate : '2025-07-15' ,
18- app : {
19- baseURL : basePath ,
20- rootId : '__netlogo' ,
21- } ,
22- devtools : { enabled : true } ,
23- ssr : true ,
24- // prettier-ignore
25- modules : [
26- '@nuxtjs/sitemap' , // Adds sitemap.xml
27- '@repo/nuxt-content-assets' , // Local asset loading based on relative paths in Markdowns
28- '@nuxt/content' , // Query, navigation, search, and rendering of Markdown files
29- '@nuxt/ui' , // Reka-UI library for Nuxt
30- '@nuxt/icon' , // Optimized icons with iconify
31- 'nuxt-svgo' , // SVG loader from file
32- '@nuxt/eslint' , // Linter
33- 'nuxt-gtag' , // Google
34- 'nuxt-og-image' , // Dynamic Open Graph image generation
35- 'nuxt-link-checker' , // Link checking post-build
36- ] ,
37- site : { url : 'https://docs.netlogo.org' , name : process . env [ 'PRODUCT_NAME' ] } ,
38- css : [ '~/assets/styles/main.scss' , '~/assets/styles/tailwind.css' , vueUiStyles ] ,
39- colorMode : {
40- preference : 'light' ,
41- } ,
42-
43- gtag : {
44- id : 'G-ZET3KSPLMC' ,
45- } ,
46-
47- imports : {
48- autoImport : true ,
49- transform : {
50- exclude : [ / \b n o d e _ m o d u l e s \b / , / \b \. g i t \b / ] ,
51- } ,
52- } ,
19+ const isUsingPdfConfig = process . env [ 'DOCS_ENV_PDF' ] === '1' ;
20+ const optionalPdfLayer = isUsingPdfConfig ? pdfOverrides : { } ;
5321
54- $development : {
55- experimental : {
56- payloadExtraction : false ,
57- } ,
58- } ,
22+ if ( isUsingPdfConfig ) {
23+ console . info ( '[repo] Running with PDF generation configuration overrides' ) ;
24+ }
5925
60- icon : {
61- mode : 'css' ,
62- cssLayer : 'base' ,
63- } ,
26+ // https://nuxt.com/docs/api/configuration/nuxt-config
6427
65- components : [
28+ export default defineNuxtConfig (
29+ deepMerge < NuxtConfigInput , NuxtConfigInput > (
6630 {
67- path : vueUiSrc ,
68- global : true ,
69- pattern : '**/*.vue' ,
70- ignore : [ '**/examples/*.vue' , '**/tests/*.vue' ] ,
71- pathPrefix : false ,
72- watch : true ,
73- } ,
74- {
75- path : '~/components' ,
76- global : true ,
77- pattern : '**/*.vue' ,
78- ignore : [ '**/examples/*.vue' , '**/tests/*.vue' ] ,
79- pathPrefix : false ,
80- watch : true ,
81- } ,
82- ] ,
31+ compatibilityDate : '2025-07-15' ,
32+ app : {
33+ baseURL : basePath ,
34+ rootId : '__netlogo' ,
35+ } ,
36+ devtools : { enabled : true } ,
37+ ssr : true ,
38+ // prettier-ignore
39+ modules : [
40+ '@nuxtjs/sitemap' , // Adds sitemap.xml
41+ '@repo/nuxt-content-assets' , // Local asset loading based on relative paths in Markdowns
42+ '@nuxt/content' , // Query, navigation, search, and rendering of Markdown files
43+ '@nuxt/ui' , // Reka-UI library for Nuxt
44+ '@nuxt/icon' , // Optimized icons with iconify
45+ 'nuxt-svgo' , // SVG loader from file
46+ '@nuxt/eslint' , // Linter
47+ 'nuxt-gtag' , // Google
48+ 'nuxt-og-image' , // Dynamic Open Graph image generation
49+ 'nuxt-link-checker' , // Link checking post-build
50+ ] ,
51+ site : { url : 'https://docs.netlogo.org' , name : process . env [ 'PRODUCT_NAME' ] } ,
52+ css : [ '~/assets/styles/main.scss' , '~/assets/styles/tailwind.css' , vueUiStyles ] ,
53+ colorMode : {
54+ preference : 'light' ,
55+ } ,
8356
84- ignore : [ '.build/' , '.latest/' , '.static/' , '.preview/' ] ,
57+ gtag : {
58+ id : 'G-ZET3KSPLMC' ,
59+ } ,
8560
86- svgo : {
87- customComponent : 'SvgImport' ,
88- } ,
61+ imports : {
62+ autoImport : true ,
63+ transform : {
64+ exclude : [ / \b n o d e _ m o d u l e s \b / , / \b \. g i t \b / ] ,
65+ } ,
66+ } ,
8967
90- vite : {
91- plugins : [ tailwindcss ( ) ] ,
92- optimizeDeps : {
93- include : [ '@repo/vue-ui' , ...MarkdownConfig . externalImports ] ,
94- } ,
95- server : {
96- hmr : {
97- overlay : true ,
68+ $development : {
69+ experimental : {
70+ payloadExtraction : false ,
71+ } ,
9872 } ,
99- watch : { usePolling : true } ,
100- } ,
101- } ,
10273
103- content : {
104- build : MarkdownConfig . buildOptions ,
105- renderer : {
106- anchorLinks : false ,
107- } ,
108- watch : { enabled : false } ,
109- } ,
110-
111- contentAssets : {
112- imageSize : 'style attrs' ,
113- contentExtensions : 'md' ,
114- debug : true ,
115- overrideStaticDimensions : false ,
116- } ,
117-
118- ogImage : {
119- defaults : {
120- extension : 'jpeg' ,
121- sharp : {
122- quality : 70 ,
74+ icon : {
75+ mode : 'css' ,
76+ cssLayer : 'base' ,
12377 } ,
124- } ,
125- } ,
12678
127- linkChecker : {
128- excludeLinks : [ '/*.pdf' , `${ basePath } NetLogo_User_Manual.pdf` ] ,
129- skipInspections : [ 'no-baseless' , 'no-underscores' , 'trailing-slash' ] ,
130- report : {
131- html : process . env [ 'CHECK' ] === 'true' ,
132- } ,
133- } ,
134-
135- runtimeConfig : {
136- public : {
137- extensions : ( await getDocumentedExtensionBuilders ( autogenConfig ) ) . map ( ( ext ) => ( {
138- title : ext . fullName ,
139- href : `/${ ext . name . toLowerCase ( ) } ` ,
140- } ) ) ,
141- ...publicEnvironmentVariables ,
142- } ,
143- } ,
79+ components : [
80+ {
81+ path : vueUiSrc ,
82+ global : true ,
83+ pattern : '**/*.vue' ,
84+ ignore : [ '**/examples/*.vue' , '**/tests/*.vue' ] ,
85+ pathPrefix : false ,
86+ watch : true ,
87+ } ,
88+ {
89+ path : '~/components' ,
90+ global : true ,
91+ pattern : '**/*.vue' ,
92+ ignore : [ '**/examples/*.vue' , '**/tests/*.vue' ] ,
93+ pathPrefix : false ,
94+ watch : true ,
95+ } ,
96+ ] ,
97+
98+ ignore : [ '.build/' , '.latest/' , '.static/' , '.preview/' ] ,
99+
100+ svgo : {
101+ customComponent : 'SvgImport' ,
102+ } ,
144103
145- hooks : {
146- async ready ( ) {
147- verifyEnvironmentVariables ( ) ;
104+ vite : {
105+ plugins : [ tailwindcss ( ) ] ,
106+ optimizeDeps : {
107+ include : [ '@repo/vue-ui' , ...MarkdownConfig . externalImports ] ,
108+ } ,
109+ server : {
110+ hmr : {
111+ overlay : true ,
112+ } ,
113+ watch : { usePolling : true } ,
114+ } ,
115+ } ,
148116
149- console . info ( `[repo] Using @repo/vue-ui source path: ${ vueUiSrc } ` ) ;
150- console . info ( `[repo] Using @repo/vue-ui styles path: ${ vueUiStyles } ` ) ;
117+ content : {
118+ build : MarkdownConfig . buildOptions ,
119+ renderer : {
120+ anchorLinks : false ,
121+ } ,
122+ watch : { enabled : false } ,
123+ } ,
151124
152- const noAutogen = process . env [ 'NO_AUTOGEN' ] === 'true' ;
153- if ( noAutogen === true ) return ;
154- await runDocsAutogen ( ) ;
155- } ,
156- 'content:file:beforeParse' ( ctx ) {
157- addNuxtContentAssetsRoot ( ctx . file ) ;
158- } ,
159- } ,
160-
161- nitro : {
162- static : true ,
163- serveStatic : true ,
164- baseURL : basePath ,
165- prerender : {
166- autoSubfolderIndex : false ,
167- crawlLinks : true ,
168- concurrency : 1 ,
169- routes : await getRoutes ( ) ,
125+ contentAssets : {
126+ imageSize : 'style attrs' ,
127+ contentExtensions : 'md' ,
128+ debug : true ,
129+ overrideStaticDimensions : false ,
130+ } ,
131+
132+ ogImage : {
133+ defaults : {
134+ extension : 'jpeg' ,
135+ sharp : {
136+ quality : 70 ,
137+ } ,
138+ } ,
139+ } ,
140+
141+ linkChecker : {
142+ excludeLinks : [ '/*.pdf' , `${ basePath } NetLogo_User_Manual.pdf` ] ,
143+ skipInspections : [ 'no-baseless' , 'no-underscores' , 'trailing-slash' ] ,
144+ report : {
145+ html : process . env [ 'CHECK' ] === 'true' ,
146+ } ,
147+ } ,
148+
149+ runtimeConfig : {
150+ public : {
151+ extensions : ( await getDocumentedExtensionBuilders ( autogenConfig ) ) . map ( ( ext ) => ( {
152+ title : ext . fullName ,
153+ href : `/${ ext . name . toLowerCase ( ) } ` ,
154+ } ) ) ,
155+ ...publicEnvironmentVariables ,
156+ } ,
157+ } ,
158+
159+ hooks : {
160+ async ready ( ) {
161+ verifyEnvironmentVariables ( ) ;
162+
163+ console . info ( `[repo] Using @repo/vue-ui source path: ${ vueUiSrc } ` ) ;
164+ console . info ( `[repo] Using @repo/vue-ui styles path: ${ vueUiStyles } ` ) ;
165+
166+ const noAutogen = process . env [ 'NO_AUTOGEN' ] === 'true' ;
167+ if ( noAutogen === true ) return ;
168+ await runDocsAutogen ( ) ;
169+ } ,
170+ 'content:file:beforeParse' ( ctx ) {
171+ addNuxtContentAssetsRoot ( ctx . file ) ;
172+ } ,
173+ } ,
174+
175+ nitro : {
176+ static : true ,
177+ serveStatic : true ,
178+ baseURL : basePath ,
179+ prerender : {
180+ autoSubfolderIndex : false ,
181+ crawlLinks : true ,
182+ concurrency : 1 ,
183+ routes : await getRoutes ( ) ,
184+ } ,
185+ } ,
170186 } ,
171- } ,
172- } ) ;
187+ optionalPdfLayer ,
188+ { mergeArrays : false } ,
189+ ) ,
190+ ) ;
0 commit comments