Skip to content

Commit 88d3d00

Browse files
committed
feat(create): redo init opts and project_path relative same as cdv-android
1 parent 5492818 commit 88d3d00

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/create.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,20 @@ const ROOT = path.join(__dirname, '..');
3535
* @returns {Promise<void>} resolves when the project has been created
3636
*/
3737
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 || {};
4039

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
4243
if (fs.existsSync(project_path)) {
43-
throw new CordovaError('Project already exists');
44+
throw new CordovaError('Project already exists! Delete and recreate');
4445
}
4546

47+
package_name = package_name || 'io.cordova.helloCordova';
48+
project_name = project_name || 'Hello Cordova';
49+
4650
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}`);
4852
events.emit('log', `\tPackage: ${package_name}`);
4953
events.emit('log', `\tName: ${project_name}`);
5054

0 commit comments

Comments
 (0)