@@ -17,7 +17,8 @@ program.version(projectPackageJson.version, "-v, --version");
1717
1818program
1919 . command ( "init <projectName>" )
20- . option ( "--no-crna" , "Create Normal RN Project" )
20+ // .command("init <projectName>", "create a Vue-Native project")
21+ . option ( "--no-crna" , "use react-native-cli instead of expo-cli" )
2122 . action ( function ( projectName , cmd ) {
2223 let isCrnaProject = false ;
2324 if ( cmd . crna ) {
@@ -26,13 +27,12 @@ program
2627 // check if Create-react-native-app dependency is present or not
2728 if ( ! isCrnaInstalledPackageVersion ) {
2829 terminateTheProcess (
29- "Please globally install create-react-native-app dependency "
30+ "Please globally install expo-cli "
3031 ) ;
3132 return ;
3233 } else {
3334 console . log (
34- "Installed Crna Version" ,
35- chalk . green ( isCrnaInstalledPackageVersion )
35+ chalk . cyan ( "Using globally installed expo-cli " + isCrnaInstalledPackageVersion + "\n" ) ,
3636 ) ;
3737 }
3838 } else {
@@ -48,10 +48,12 @@ program
4848 ) ;
4949 }
5050 }
51+
5152 const isProjectNameValidResponse = validationObjects . isProjectNameValid (
5253 projectName ,
5354 isCrnaProject
5455 ) ;
56+
5557 // if project Name is invalid Ask User, Do They Want to Continue
5658 if ( ! isProjectNameValidResponse ) {
5759 promptModule . promptForInvalidProjectName (
@@ -103,7 +105,7 @@ function createReactNativeCLIProject(projectName, cmd) {
103105 if ( fs . existsSync ( projectName ) ) {
104106 removeExistingDirectory ( projectName ) ;
105107 }
106- console . log ( chalk . green ( `Creating Vue- Native ${ projectName } App ` ) ) ;
108+ console . log ( chalk . green ( `Creating Vue Native project ${ chalk . bold ( projectName ) } ` ) ) ;
107109 createRNProjectSync ( projectName , cmd ) ;
108110 handleAndAddVueNativePackageDependencySync ( projectName , cmd ) ;
109111 setupVueNativeApp ( projectName , cmd ) ;
@@ -114,44 +116,50 @@ function createExpoProject(projectName, cmd) {
114116 if ( fs . existsSync ( projectName ) ) {
115117 removeExistingDirectory ( projectName ) ;
116118 }
117- console . log ( chalk . green ( `Creating Vue- Native ${ projectName } App ` ) ) ;
119+ console . log ( chalk . green ( `Creating Vue Native project ${ chalk . bold ( projectName ) } \n ` ) ) ;
118120 createCrnaProjectSync ( projectName , cmd ) ;
119121 handleAndAddVueNativePackageDependencySync ( projectName , cmd ) ;
120122 setupVueNativeApp ( projectName , cmd , true ) ;
121123}
122124
123125function createCrnaProjectSync ( projectName , cmd ) {
124126 const spinner = ora (
125- `Creating Crna ${ chalk . green ( projectName ) } project \n`
127+ chalk . cyan ( "Creating project with expo-cli\n" ) ,
126128 ) . start ( ) ;
127129 const crnaProjectCreationResponse = spawnSync (
128130 constantObjects . crnaPackageName ,
129131 [ 'init' , '--template=blank' , projectName ] ,
130132 { stdio : "inherit" , shell : true }
131133 ) ;
132- spinner . succeed ( `Create Crna ${ chalk . green ( projectName ) } project` ) ;
134+ spinner . succeed (
135+ chalk . green ( "Created project with expo-cli\n" ) ,
136+ ) ;
133137}
134138
135139function createRNProjectSync ( projectName , cmd ) {
136140 const spinner = ora (
137- `Creating react native app ${ chalk . green ( projectName ) } project \n`
141+ chalk . cyan ( "Creating project with react-native-cli\n" ) ,
138142 ) . start ( ) ;
139143 const rnProjectCreationResponse = spawnSync (
140144 constantObjects . rnPackageName ,
141145 [ "init" , projectName , "--version" , constantObjects . stableRNVersion ] ,
142146 { stdio : "inherit" , shell : true }
143147 ) ;
144- spinner . succeed ( `Create react-native ${ chalk . green ( projectName ) } project` ) ;
148+ spinner . succeed (
149+ chalk . green ( "Created project with react-native-cli\n" ) ,
150+ ) ;
145151}
146152
147153function removeExistingDirectory ( directoryName ) {
148154 const spinner = ora (
149- `Removing ${ chalk . green ( directoryName ) } project \n`
155+ chalk . yellow ( `Removing pre-existing directory with name ${ directoryName } \n` ) ,
150156 ) . start ( ) ;
151157 const crnaProjectCreationResponse = spawnSync ( "rm" , [ "-fr" , directoryName ] , {
152158 stdio : "inherit"
153159 } ) ;
154- spinner . succeed ( `Removed ${ chalk . green ( directoryName ) } project` ) ;
160+ spinner . succeed (
161+ chalk . yellow ( `Removed pre-existing directory with name ${ directoryName } \n` ) ,
162+ ) ;
155163}
156164
157165function handleAndAddVueNativePackageDependencySync ( projectName , cmd ) {
@@ -163,30 +171,30 @@ function handleAndAddVueNativePackageDependencySync(projectName, cmd) {
163171
164172function installVueNativeDependency ( ) {
165173 const spinner = ora (
166- `Installing ${ chalk . green ( " Vue Native Dependency" ) } Packages \n`
174+ chalk . cyan ( "Installing Vue Native dependencies\n" ) ,
167175 ) . start ( ) ;
168176 const commandObj = getVueNativeDependencyPackageInstallationCommand ( ) ;
169177 const crnaProjectCreationResponse = spawnSync (
170178 commandObj . commandName ,
171179 commandObj . optionsArr ,
172- { shell : true }
180+ { shell : true , stdio : "inherit" }
173181 ) ;
174182 spinner . succeed (
175- `Installed ${ chalk . green ( "Vue Native Dependency" ) } Packages \n`
183+ chalk . green ( "Installed Vue Native dependencies\n" )
176184 ) ;
177185}
178186function installVueNativeDevDependency ( ) {
179187 const spinner = ora (
180- `Installing ${ chalk . green ( " Vue Native Dev-dependency" ) } Packages`
188+ chalk . cyan ( "Installing Vue Native devDependencies\n" ) ,
181189 ) . start ( ) ;
182190 const commandObj = getVueNativeDevDependencyPackageInstallationCommand ( ) ;
183191 const crnaProjectCreationResponse = spawnSync (
184192 commandObj . commandName ,
185193 commandObj . optionsArr ,
186- { shell : true }
194+ { shell : true , stdio : "inherit" }
187195 ) ;
188196 spinner . succeed (
189- `Installed ${ chalk . green ( "Vue Native Dev-Dependency" ) } Packages`
197+ chalk . green ( "Installed Vue- Native devDependencies\n" ) ,
190198 ) ;
191199}
192200
@@ -285,7 +293,7 @@ function setupVueNativeApp(projectName, cmd, isCrna = false) {
285293 appVueFileContent
286294 ) ;
287295 console . log (
288- chalk . green ( `Completed Installing Vue Native ${ projectName } App` )
296+ chalk . green ( "Setup complete!" )
289297 ) ;
290298}
291299
0 commit comments