@@ -25,7 +25,7 @@ import {
2525} from "@contentstack/cli-utilities" ;
2626
2727import { BaseCommand } from "../../base-command" ;
28- import { AppManifest , AppType } from "../../types" ;
28+ import { AppManifest , AppType , BoilerplateAppType } from "../../types" ;
2929import { appCreate , commonMsg } from "../../messages" ;
3030import {
3131 getOrg ,
@@ -97,23 +97,18 @@ export default class Create extends BaseCommand<typeof Create> {
9797 message : this . messages . CONFIRM_CLONE_BOILERPLATE ,
9898 } ) )
9999 ) {
100- const boilerplate = await selectedBoilerplate ( ) ;
100+ const boilerplate : BoilerplateAppType = await selectedBoilerplate ( ) ;
101101
102- if ( boilerplate && boilerplate ?. link ) {
103- this . sharedConfig . boilerplateName = boilerplate . name
104- . toLowerCase ( )
105- . replace ( / / g, "-" ) ;
102+ if ( boilerplate ) {
103+ if ( boilerplate . name ) {
104+ this . sharedConfig . boilerplateName = boilerplate . name
105+ . toLowerCase ( )
106+ . replace ( / / g, "-" ) ;
107+ }
106108 this . sharedConfig . appBoilerplateGithubUrl = boilerplate . link ;
107109 this . sharedConfig . appName = await getAppName (
108110 this . sharedConfig . boilerplateName
109111 ) ;
110-
111- // Handle case where user does not provide a new name
112- if ( ! this . sharedConfig . appName ) {
113- console . error ( "App name is required." ) ;
114- process . exit ( 1 ) ;
115- }
116-
117112 await this . boilerplateFlow ( ) ;
118113 }
119114 } else {
@@ -139,7 +134,7 @@ export default class Create extends BaseCommand<typeof Create> {
139134 await this . unZipBoilerplate ( await this . cloneBoilerplate ( ) ) ;
140135 tmp . setGracefulCleanup ( ) ; // NOTE If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit
141136
142- // Update the sharedConfig.appName with the actual folder name
137+ // To remove the default app name from flag and replace it with the actual folder name
143138 this . sharedConfig . appName =
144139 this . sharedConfig . folderPath . split ( "/" ) . pop ( ) ||
145140 this . sharedConfig . appName ;
@@ -254,10 +249,6 @@ export default class Create extends BaseCommand<typeof Create> {
254249 reject ( error ) ;
255250 } ) ;
256251 } ) ;
257- // Update the app name and folder path
258- this . sharedConfig . appName =
259- this . sharedConfig . folderPath . split ( "/" ) . pop ( ) ||
260- this . sharedConfig . appName ;
261252 }
262253
263254 /**
0 commit comments