@@ -4,7 +4,7 @@ import * as inquirer from 'inquirer';
44import { shortSiteName } from '../common' ;
55import { getFirebaseTools } from '../firebaseTools' ;
66import { FEATURES , FirebaseApp , FirebaseHostingSite , FirebaseProject , PROJECT_TYPE , WorkspaceProject , featureOptions } from '../interfaces' ;
7- import { shortAppId } from '../utils' ;
7+ import { isSSRApp , isUniversalApp , shortAppId } from '../utils' ;
88
99// eslint-disable-next-line @typescript-eslint/no-var-requires
1010inquirer . registerPrompt ( 'autocomplete' , require ( 'inquirer-autocomplete-prompt' ) ) ;
@@ -251,13 +251,19 @@ const ALLOWED_SSR_REGIONS = [
251251] ;
252252
253253export const projectTypePrompt = async ( project : WorkspaceProject , name : string ) => {
254- const buildTarget = `${ name } :build:${ project . architect ?. build ?. defaultConfiguration || 'production' } ` ;
255- const { ssrRegion } = await inquirer . prompt ( {
256- type : 'list' ,
257- name : 'ssrRegion' ,
258- choices : ALLOWED_SSR_REGIONS ,
259- message : 'In which region would you like to host server-side content?' ,
260- default : DEFAULT_REGION ,
261- } ) as { ssrRegion : string } ;
262- return { projectType : PROJECT_TYPE . WebFrameworks , ssrRegion, buildTarget } ;
254+ const buildTarget = [ `${ name } :build:production` , `${ name } :build:development` ] ;
255+ const serveTarget = isUniversalApp ( project ) ?
256+ [ `${ name } :serve-ssr:production` , `${ name } :serve-ssr:development` ] :
257+ [ `${ name } :serve:production` , `${ name } :serve:development` ] ;
258+ if ( isUniversalApp ( project ) || isSSRApp ( project ) ) {
259+ const { ssrRegion } = await inquirer . prompt ( {
260+ type : 'list' ,
261+ name : 'ssrRegion' ,
262+ choices : ALLOWED_SSR_REGIONS ,
263+ message : 'In which region would you like to host server-side content?' ,
264+ default : DEFAULT_REGION ,
265+ } ) as { ssrRegion : string } ;
266+ return { projectType : PROJECT_TYPE . WebFrameworks , ssrRegion, buildTarget, serveTarget } ;
267+ }
268+ return { projectType : PROJECT_TYPE . WebFrameworks , buildTarget, serveTarget } ;
263269} ;
0 commit comments