@@ -25,7 +25,7 @@ import {
25
25
} from "@contentstack/cli-utilities" ;
26
26
27
27
import { BaseCommand } from "../../base-command" ;
28
- import { AppManifest , AppType } from "../../types" ;
28
+ import { AppManifest , AppType , BoilerplateAppType } from "../../types" ;
29
29
import { appCreate , commonMsg } from "../../messages" ;
30
30
import {
31
31
getOrg ,
@@ -97,23 +97,18 @@ export default class Create extends BaseCommand<typeof Create> {
97
97
message : this . messages . CONFIRM_CLONE_BOILERPLATE ,
98
98
} ) )
99
99
) {
100
- const boilerplate = await selectedBoilerplate ( ) ;
100
+ const boilerplate : BoilerplateAppType = await selectedBoilerplate ( ) ;
101
101
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
+ }
106
108
this . sharedConfig . appBoilerplateGithubUrl = boilerplate . link ;
107
109
this . sharedConfig . appName = await getAppName (
108
110
this . sharedConfig . boilerplateName
109
111
) ;
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
-
117
112
await this . boilerplateFlow ( ) ;
118
113
}
119
114
} else {
@@ -139,7 +134,7 @@ export default class Create extends BaseCommand<typeof Create> {
139
134
await this . unZipBoilerplate ( await this . cloneBoilerplate ( ) ) ;
140
135
tmp . setGracefulCleanup ( ) ; // NOTE If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit
141
136
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
143
138
this . sharedConfig . appName =
144
139
this . sharedConfig . folderPath . split ( "/" ) . pop ( ) ||
145
140
this . sharedConfig . appName ;
@@ -254,10 +249,6 @@ export default class Create extends BaseCommand<typeof Create> {
254
249
reject ( error ) ;
255
250
} ) ;
256
251
} ) ;
257
- // Update the app name and folder path
258
- this . sharedConfig . appName =
259
- this . sharedConfig . folderPath . split ( "/" ) . pop ( ) ||
260
- this . sharedConfig . appName ;
261
252
}
262
253
263
254
/**
0 commit comments