@@ -35,6 +35,7 @@ import {
3535 sanitizePath ,
3636 selectedBoilerplate ,
3737 validateBoilerplate ,
38+ validateAppName ,
3839} from "../../util" ;
3940
4041export default class Create extends BaseCommand < typeof Create > {
@@ -53,13 +54,14 @@ export default class Create extends BaseCommand<typeof Create> {
5354 "$ <%= config.bin %> <%= command.id %> --name App-1 --app-type stack" ,
5455 "$ <%= config.bin %> <%= command.id %> --name App-2 --app-type stack -d ./boilerplate" ,
5556 "$ <%= config.bin %> <%= command.id %> --name App-3 --app-type organization --org <UID> -d ./boilerplate -c ./external-config.json" ,
56- "$ <%= config.bin %> <%= command.id %> --name App-4 --app-type organization --org <UID> --boilerplates <boilerplate-name>" ,
57+ "$ <%= config.bin %> <%= command.id %> --name App-4 --app-type organization --org <UID> --boilerplate <App Boilerplate>" ,
58+ "$ <%= config.bin %> <%= command.id %> --name App-4 --app-type organization --org <UID> --boilerplate <DAM App Boilerplate>" ,
59+ "$ <%= config.bin %> <%= command.id %> --name App-4 --app-type organization --org <UID> --boilerplate <Ecommerce App Boilerplate>" ,
5760 ] ;
5861
5962 static flags : FlagInput = {
6063 name : flags . string ( {
6164 char : "n" ,
62- default : "app-boilerplate" ,
6365 description : appCreate . NAME_DESCRIPTION ,
6466 } ) ,
6567 "app-type" : flags . string ( {
@@ -75,7 +77,7 @@ export default class Create extends BaseCommand<typeof Create> {
7577 char : "d" ,
7678 description : commonMsg . CURRENT_WORKING_DIR ,
7779 } ) ,
78- " boilerplate" : flags . string ( {
80+ boilerplate : flags . string ( {
7981 description : appCreate . BOILERPLATE_TEMPLATES ,
8082 } ) ,
8183 } ;
@@ -150,27 +152,32 @@ export default class Create extends BaseCommand<typeof Create> {
150152 * @memberof Create
151153 */
152154 async flagsPromptQueue ( ) {
153- if ( isEmpty ( this . sharedConfig . appName ) ) {
154- this . sharedConfig . appName = await getAppName (
155- this . sharedConfig . defaultAppName
156- ) ;
155+ if ( this . sharedConfig . appName ) {
156+ validateAppName ( this . sharedConfig . appName ) ;
157157 }
158+
159+ let boilerplate : BoilerplateAppType | null = null ;
158160 if ( isEmpty ( this . sharedConfig . boilerplateName ) ) {
159- const boilerplate : BoilerplateAppType = await selectedBoilerplate ( ) ;
161+ boilerplate = await selectedBoilerplate ( ) ;
162+ } else {
163+ boilerplate = ( await validateBoilerplate (
164+ this . sharedConfig . boilerplateName
165+ ) ) as BoilerplateAppType ;
166+ }
160167
161- if ( boilerplate ) {
162- this . sharedConfig . boilerplateName = boilerplate . name
168+ if ( boilerplate ) {
169+ let boilerplateName = this . sharedConfig . appName || boilerplate . name ;
170+ if ( isEmpty ( this . sharedConfig . appName ) ) {
171+ boilerplateName = boilerplateName
163172 . toLowerCase ( )
164- . replace ( / / g, "-" ) ;
165- this . sharedConfig . appBoilerplateGithubUrl = boilerplate . link ;
166- this . sharedConfig . appName = await getAppName (
167- this . sharedConfig . boilerplateName
168- ) ;
173+ . replace ( / / g, "-" )
174+ . substring ( 0 , 20 ) ;
169175 }
170- } else {
171- await validateBoilerplate ( this . sharedConfig . boilerplateName ) ;
176+
177+ this . sharedConfig . boilerplateName = boilerplateName ;
178+ this . sharedConfig . appBoilerplateGithubUrl = boilerplate . link ;
179+ this . sharedConfig . appName = boilerplateName ;
172180 }
173- this . sharedConfig . appName = this . sharedConfig . boilerplateName ;
174181
175182 //Auto select org in case of oauth
176183 this . sharedConfig . org =
0 commit comments