@@ -221,7 +221,6 @@ const envFileHandler = async (
221221 //default
222222 imageHostname = '*-images.contentstack.com' ;
223223 }
224- const production = environmentVariables . environment === 'production' ? true : false ;
225224 switch ( appConfigKey ) {
226225 case 'kickstart-next' :
227226 case 'kickstart-next-ssr' :
@@ -275,34 +274,6 @@ const envFileHandler = async (
275274 result = await writeEnvFile ( content , filePath ) ;
276275 break ;
277276
278- case 'reactjs' :
279- case 'reactjs-starter' :
280- fileName = `.env.${ environmentVariables . environment } .local` ;
281- filePath = pathValidator ( path . join ( sanitizePath ( clonedDirectory ) , sanitizePath ( fileName ) ) ) ;
282- content = `REACT_APP_CONTENTSTACK_API_KEY=${ environmentVariables . api_key
283- } \nREACT_APP_CONTENTSTACK_DELIVERY_TOKEN=${ environmentVariables . deliveryToken } ${ livePreviewEnabled
284- ? `\nREACT_APP_CONTENTSTACK_PREVIEW_TOKEN=${ environmentVariables . preview_token || `''`
285- } \nREACT_APP_CONTENTSTACK_PREVIEW_HOST=${ previewHost } \nREACT_APP_CONTENTSTACK_APP_HOST=${ appHost } \n`
286- : '\n'
287- } \nREACT_APP_CONTENTSTACK_ENVIRONMENT=${ environmentVariables . environment } \n${ customHost ? '\nREACT_APP_CONTENTSTACK_API_HOST=' + customHost : ''
288- } ${ ! isUSRegion && ! customHost ? '\nREACT_APP_CONTENTSTACK_REGION=' + region . name : ''
289- } \nSKIP_PREFLIGHT_CHECK=true\nREACT_APP_CONTENTSTACK_LIVE_PREVIEW=${ livePreviewEnabled } `;
290- result = await writeEnvFile ( content , filePath ) ;
291- break ;
292- case 'nextjs' :
293- case 'nextjs-starter' :
294- fileName = `.env.${ environmentVariables . environment } .local` ;
295- filePath = pathValidator ( path . join ( sanitizePath ( clonedDirectory ) , sanitizePath ( fileName ) ) ) ;
296- content = `CONTENTSTACK_API_KEY=${ environmentVariables . api_key } \nCONTENTSTACK_DELIVERY_TOKEN=${ environmentVariables . deliveryToken
297- } \n${ livePreviewEnabled
298- ? `\nCONTENTSTACK_PREVIEW_TOKEN=${ environmentVariables . preview_token || `''`
299- } \nCONTENTSTACK_PREVIEW_HOST=${ previewHost } \nCONTENTSTACK_APP_HOST=${ appHost } \n`
300- : '\n'
301- } CONTENTSTACK_ENVIRONMENT=${ environmentVariables . environment } \nCONTENTSTACK_API_HOST=${ customHost ? customHost : managementAPIHost
302- } ${ ! isUSRegion && ! customHost ? '\nCONTENTSTACK_REGION=' + region . name : ''
303- } \nCONTENTSTACK_LIVE_PREVIEW=${ livePreviewEnabled } \nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
304- result = await writeEnvFile ( content , filePath ) ;
305- break ;
306277 case 'compass-app' :
307278 fileName = '.env' ;
308279 filePath = pathValidator ( path . join ( sanitizePath ( clonedDirectory ) , sanitizePath ( fileName ) ) ) ;
@@ -318,75 +289,6 @@ const envFileHandler = async (
318289 } \nCONTENTSTACK_HOST=${ cdnHost } `;
319290 result = await writeEnvFile ( content , filePath ) ;
320291 break ;
321- case 'gatsby' :
322- case 'gatsby-starter' :
323- fileName = `.env.${ environmentVariables . environment } ` ;
324- filePath = pathValidator ( path . join ( sanitizePath ( clonedDirectory ) , sanitizePath ( fileName ) ) ) ;
325- content = `CONTENTSTACK_API_KEY=${ environmentVariables . api_key } \nCONTENTSTACK_DELIVERY_TOKEN=${ environmentVariables . deliveryToken
326- } \n${ livePreviewEnabled
327- ? `\nCONTENTSTACK_PREVIEW_TOKEN=${ environmentVariables . preview_token || `''`
328- } \nCONTENTSTACK_PREVIEW_HOST=${ previewHost } \nCONTENTSTACK_APP_HOST=${ appHost } \n`
329- : '\n'
330- } \nCONTENTSTACK_ENVIRONMENT=${ environmentVariables . environment
331- } \nCONTENTSTACK_API_HOST=${ managementAPIHost } \nCONTENTSTACK_LIVE_PREVIEW=${ livePreviewEnabled } `;
332- result = await writeEnvFile ( content , filePath ) ;
333- break ;
334- case 'angular' :
335- content = `export const environment = { \n\tproduction:${ environmentVariables . environment === 'production' ? true : false
336- } , \n\tconfig : { \n\t\tapi_key: '${ environmentVariables . api_key } ', \n\t\tdelivery_token: '${ environmentVariables . deliveryToken
337- } ',\n${ livePreviewEnabled
338- ? `\n\tpreivew_token:'${ environmentVariables . preview_token || `''`
339- } '\n\tpreview_host:'${ previewHost } '\n\tapp_host:'${ appHost } '\n`
340- : '\n'
341- } ,\n\t\tenvironment: '${ environmentVariables . environment } '${ ! isUSRegion && ! customHost ? `,\n\t\tregion: '${ region . name } '` : ''
342- } \n\t } \n };`;
343- fileName = `.env${ environmentVariables . environment === 'production' ? '.prod' : '' } ` ;
344- filePath = pathValidator ( path . join ( sanitizePath ( clonedDirectory ) , 'src' , 'environments' , sanitizePath ( fileName ) ) ) ;
345- result = await writeEnvFile ( content , filePath ) ;
346- break ;
347- case 'angular-starter' :
348- content = `CONTENTSTACK_API_KEY=${ environmentVariables . api_key } \nCONTENTSTACK_DELIVERY_TOKEN=${ environmentVariables . deliveryToken
349- } \n${ livePreviewEnabled
350- ? `\nCONTENTSTACK_PREVIEW_TOKEN=${ environmentVariables . preview_token || `''`
351- } \nCONTENTSTACK_PREVIEW_HOST=${ previewHost } \nCONTENTSTACK_APP_HOST=${ appHost } \n`
352- : '\n'
353- } CONTENTSTACK_ENVIRONMENT=${ environmentVariables . environment } \nCONTENTSTACK_API_HOST=${ customHost ? customHost : managementAPIHost
354- } ${ ! isUSRegion && ! customHost ? '\nCONTENTSTACK_REGION=' + region . name : ''
355- } \nCONTENTSTACK_LIVE_PREVIEW=${ livePreviewEnabled } \nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
356- fileName = `.env${ environmentVariables . environment === 'production' ? '.prod' : '' } ` ;
357- filePath = pathValidator ( path . join ( sanitizePath ( clonedDirectory ) , sanitizePath ( fileName ) ) ) ;
358- result = await writeEnvFile ( content , filePath ) ;
359- break ;
360- case 'nuxtjs' :
361- case 'nuxt-starter' :
362- case 'nuxt3-starter' :
363- case 'stencil-starter' :
364- fileName = production ? '.env.production' : '.env' ;
365- filePath = pathValidator ( path . join ( sanitizePath ( clonedDirectory ) , sanitizePath ( fileName ) ) ) ;
366- // Note: Stencil app needs all the env variables, even if they are not having values otherwise the rollup does not work properly and throws process in undefined error.
367- content = `CONTENTSTACK_API_KEY=${ environmentVariables . api_key } \nCONTENTSTACK_DELIVERY_TOKEN=${ environmentVariables . deliveryToken
368- } \n${ livePreviewEnabled
369- ? `\nCONTENTSTACK_PREVIEW_TOKEN=${ environmentVariables . preview_token || `''` } \nCONTENTSTACK_PREVIEW_HOST=${ customHost ?? previewHost
370- } \nCONTENTSTACK_APP_HOST=${ appHost } `
371- : '\n'
372- } \nCONTENTSTACK_ENVIRONMENT=${ environmentVariables . environment } ${ ! isUSRegion && ! customHost ? '\nCONTENTSTACK_REGION=' + region . name : ''
373- } \nCONTENTSTACK_API_HOST=${ customHost ? customHost : managementAPIHost
374- } \nCONTENTSTACK_LIVE_PREVIEW=${ livePreviewEnabled } \n\nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
375- result = await writeEnvFile ( content , filePath ) ;
376- break ;
377- case 'vue-starter' :
378- fileName = '.env' ;
379- filePath = pathValidator ( path . join ( sanitizePath ( clonedDirectory ) , sanitizePath ( fileName ) ) ) ;
380- content = `VUE_APP_CONTENTSTACK_API_KEY=${ environmentVariables . api_key } \nVUE_APP_CONTENTSTACK_DELIVERY_TOKEN=${ environmentVariables . deliveryToken
381- } \n${ livePreviewEnabled
382- ? `\nVUE_APP_CONTENTSTACK_PREVIEW_TOKEN=${ environmentVariables . preview_token || `''`
383- } \nVUE_APP_CONTENTSTACK_PREVIEW_HOST=${ previewHost } \nVUE_APP_CONTENTSTACK_APP_HOST=${ appHost } \n`
384- : '\n'
385- } \nVUE_APP_CONTENTSTACK_ENVIRONMENT=${ environmentVariables . environment } ${ customHost ? '\nVUE_APP_CONTENTSTACK_API_HOST=' + customHost : ''
386- } ${ ! isUSRegion && ! customHost ? '\nVUE_APP_CONTENTSTACK_REGION=' + region . name : ''
387- } \nVUE_APP_CONTENTSTACK_LIVE_PREVIEW=${ livePreviewEnabled } `;
388- result = await writeEnvFile ( content , filePath ) ;
389- break ;
390292 default :
391293 cliux . error ( messageHandler . parse ( 'CLI_BOOTSTRAP_INVALID_APP_NAME' ) ) ;
392294 }
0 commit comments