@@ -35,16 +35,20 @@ const ROOT = path.join(__dirname, '..');
35
35
* @returns {Promise<void> } resolves when the project has been created
36
36
*/
37
37
exports . createProject = async ( project_path , package_name , project_name , opts ) => {
38
- package_name = package_name || 'io.cordova.helloCordova' ;
39
- project_name = project_name || 'Hello Cordova' ;
38
+ opts = opts || { } ;
40
39
41
- // check that project path doesn't exist
40
+ // Set default values for path, package and name
41
+ project_path = path . relative ( process . cwd ( ) , project_path ) ;
42
+ // Check if project already exists
42
43
if ( fs . existsSync ( project_path ) ) {
43
- throw new CordovaError ( 'Project already exists' ) ;
44
+ throw new CordovaError ( 'Project already exists! Delete and recreate ' ) ;
44
45
}
45
46
47
+ package_name = package_name || 'io.cordova.helloCordova' ;
48
+ project_name = project_name || 'Hello Cordova' ;
49
+
46
50
events . emit ( 'log' , 'Creating Cordova project for the iOS platform:' ) ;
47
- events . emit ( 'log' , `\tPath: ${ path . relative ( process . cwd ( ) , project_path ) } ` ) ;
51
+ events . emit ( 'log' , `\tPath: ${ project_path } ` ) ;
48
52
events . emit ( 'log' , `\tPackage: ${ package_name } ` ) ;
49
53
events . emit ( 'log' , `\tName: ${ project_name } ` ) ;
50
54
0 commit comments