11const path = require ( 'path' )
22const { join } = path
33const { copySync, existsSync } = require ( 'fs-extra' )
4+ const { logTitle, logItem } = require ( './logger' )
45const { NEXT_DIST_DIR , NETLIFY_PUBLISH_PATH ,
56 NETLIFY_FUNCTIONS_PATH ,
67 FUNCTION_TEMPLATE_PATH } = require ( './config' )
@@ -10,17 +11,17 @@ const getNetlifyFunctionName = require('./getNetlifyFunctionNam
1011// Identify all pages that require server-side rendering and create a separate
1112// Netlify Function for every page.
1213const setupSsgPages = ( ) => {
13- console . log ( `\x1b[1m 🔥 Setting up SSG pages\x1b[22m` )
14+ logTitle ( " 🔥 Setting up SSG pages" )
1415
1516 // Get SSG pages
1617 const ssgPages = allNextJsPages . filter ( page => page . isSsg ( ) )
1718
1819 // Copy pre-rendered SSG pages to Netlify publish folder
19- console . log ( " " , "1. Copying pre-rendered SSG pages to" , NETLIFY_PUBLISH_PATH )
20+ logItem ( "1. Copying pre-rendered SSG pages to" , NETLIFY_PUBLISH_PATH )
2021
2122 ssgPages . forEach ( ( { htmlFile } ) => {
2223 const filePath = join ( "pages" , htmlFile )
23- console . log ( " " , " " , filePath )
24+ logItem ( " " , filePath )
2425
2526 copySync (
2627 join ( NEXT_DIST_DIR , "serverless" , filePath ) ,
@@ -34,11 +35,11 @@ const setupSsgPages = () => {
3435
3536 // Copy SSG page data to _next/data/ folder
3637 const nextDataFolder = join ( NETLIFY_PUBLISH_PATH , "_next" , "data/" )
37- console . log ( " " , "2. Copying SSG page data to" , nextDataFolder )
38+ logItem ( "2. Copying SSG page data to" , nextDataFolder )
3839
3940 ssgPages . forEach ( ( { jsonFile, dataRoute } ) => {
4041 const dataPath = join ( "pages" , jsonFile )
41- console . log ( " " , " " , dataPath )
42+ logItem ( " " , dataPath )
4243
4344 copySync (
4445 join ( NEXT_DIST_DIR , "serverless" , dataPath ) ,
@@ -52,10 +53,10 @@ const setupSsgPages = () => {
5253
5354 // Set up Netlify Functions to handle fallbacks for SSG pages
5455 const ssgFallbackPages = allNextJsPages . filter ( page => page . isSsgFallback ( ) )
55- console . log ( " " , "3. Setting up Netlify Functions for SSG pages with fallback: true" )
56+ logItem ( "3. Setting up Netlify Functions for SSG pages with fallback: true" )
5657
5758 ssgFallbackPages . forEach ( ( { filePath } ) => {
58- console . log ( " " , " " , filePath )
59+ logItem ( " " , filePath )
5960
6061 // Set function name based on file path
6162 const functionName = getNetlifyFunctionName ( filePath )
0 commit comments