@@ -71,7 +71,8 @@ if (listOnly) {
7171function groupBySource ( shots ) {
7272 const groups = new Map ( ) ;
7373 for ( const s of shots ) {
74- const key = s . source . type === 'example' ? s . source . project
74+ const key = s . source . type === 'example'
75+ ? s . source . project + ( s . source . profile ? `:${ s . source . profile } ` : '' )
7576 : s . source . type === 'url' ? `url:${ s . source . url } `
7677 : `local:${ s . source . page || 'site' } ` ;
7778 if ( ! groups . has ( key ) ) groups . set ( key , [ ] ) ;
@@ -111,11 +112,14 @@ function startServer(dir) {
111112}
112113
113114// Render a Quarto project
114- function renderProject ( projectDir ) {
115+ function renderProject ( projectDir , profile ) {
115116 const renderScript = join ( TOOLS_DIR , 'scripts' , 'render.js' ) ;
116- console . log ( ` Rendering ${ projectDir } ...` ) ;
117+ const profileLabel = profile ? ` (profile: ${ profile } )` : '' ;
118+ console . log ( ` Rendering ${ projectDir } ${ profileLabel } ...` ) ;
117119 if ( ! dryRun ) {
118- execSync ( `node "${ renderScript } " "${ projectDir } "` , { stdio : 'inherit' } ) ;
120+ const args = [ renderScript , projectDir ] ;
121+ if ( profile ) args . push ( '--profile' , profile ) ;
122+ execSync ( `node ${ args . map ( a => `"${ a } "` ) . join ( ' ' ) } ` , { stdio : 'inherit' } ) ;
119123 }
120124}
121125
@@ -248,7 +252,7 @@ async function main() {
248252 // Prepare source
249253 if ( shots [ 0 ] . source . type === 'example' ) {
250254 const projectDir = resolve ( TOOLS_DIR , shots [ 0 ] . source . project ) ;
251- renderProject ( projectDir ) ;
255+ renderProject ( projectDir , shots [ 0 ] . source . profile ) ;
252256 const siteDir = join ( projectDir , '_site' ) ;
253257 if ( ! dryRun ) {
254258 server = await startServer ( siteDir ) ;
@@ -278,7 +282,8 @@ async function main() {
278282 if ( ! dryRun ) {
279283 await page . goto ( firstUrl , { waitUntil : 'domcontentloaded' } ) ;
280284 } else {
281- console . log ( ` [dry-run] goto ${ firstUrl } ` ) ;
285+ const profileLabel = shots [ 0 ] . source . profile ? ` [profile: ${ shots [ 0 ] . source . profile } ]` : '' ;
286+ console . log ( ` [dry-run] goto ${ firstUrl } ${ profileLabel } ` ) ;
282287 }
283288
284289 for ( const shot of shots ) {
0 commit comments