@@ -2,7 +2,7 @@ const angularApplication = require('./applications/application.angular');
22const reactApplication = require ( './applications/application.react' ) ;
33const nextjsApplication = require ( './applications/application.nextjs' ) ;
44const vueApplication = require ( './applications/application.vue' ) ;
5- const getReactAppType = require ( './utility/prompts/react- app-type' ) ;
5+ const getReactAppType = require ( './utility/prompts/app-type' ) ;
66const printHelp = require ( './help' ) . printHelp ;
77
88const isApplicationCommand = ( command ) => {
@@ -17,30 +17,40 @@ const run = async(commands, options, devextremeConfig) => {
1717 }
1818
1919 if ( commands [ 0 ] === 'new' ) {
20- let app = commands [ 1 ] ;
20+ const app = commands [ 1 ] ;
2121 const appName = commands [ 2 ] || 'my-app' ;
2222
23- if ( app === 'react-app' ) {
24- app = await getReactAppType ( options [ 'react-app-type' ] ) ;
25- }
23+ const handleWrongAppType = ( input ) => {
24+ console . error ( `The '${ input } ' application type is not valid` ) ;
25+ printHelp ( commands [ 0 ] ) ;
26+ } ;
2627
2728 switch ( app ) {
2829 case 'angular-app' :
2930 await angularApplication . create ( appName , options ) ;
3031 return ;
31- case 'vite-app' :
32- await reactApplication . create ( appName , options ) ;
33- return ;
34- case 'nextjs-app' :
35- await nextjsApplication . create ( appName , options ) ;
32+ case 'react-app' :
33+ const appType = await getReactAppType ( options [ 'app-type' ] ) ;
34+
35+ switch ( appType ) {
36+ case 'vite' :
37+ await reactApplication . create ( appName , options ) ;
38+ return ;
39+ case 'nextjs' :
40+ await nextjsApplication . create ( appName , options ) ;
41+ return ;
42+ default :
43+ handleWrongAppType ( appType ) ;
44+ }
45+
3646 return ;
3747 case 'vue-app' :
3848 await vueApplication . create ( appName , options ) ;
3949 return ;
4050 default :
41- console . error ( `The '${ app } ' application type is not valid` ) ;
42- printHelp ( commands [ 0 ] ) ;
51+ handleWrongAppType ( app ) ;
4352 }
53+
4454 } else {
4555 if ( commands [ 0 ] === 'add' ) {
4656 if ( commands [ 1 ] === 'devextreme-angular' ) {
0 commit comments