diff --git a/lib/create.js b/lib/create.js index 2818264429..508d45952b 100755 --- a/lib/create.js +++ b/lib/create.js @@ -211,15 +211,14 @@ exports.create = function (project_path, config, options, events) { options = options || {}; // Set default values for path, package and name - project_path = path.relative(process.cwd(), (project_path || 'CordovaExample')); + project_path = path.relative(process.cwd(), project_path); // Check if project already exists if (fs.existsSync(project_path)) { return Promise.reject(new CordovaError('Project already exists! Delete and recreate')); } - var package_name = config.android_packageName() || config.packageName() || 'my.cordova.project'; - var project_name = config.name() - ? config.name().replace(/[^\w.]/g, '_') : 'CordovaExample'; + var package_name = config.android_packageName() || config.packageName() || 'io.cordova.helloCordova'; + var project_name = config.name() || 'Hello Cordova'; var safe_activity_name = config.android_activityName() || options.activityName || 'MainActivity'; var target_api = check_reqs.get_target(project_path); @@ -229,7 +228,7 @@ exports.create = function (project_path, config, options, events) { .then(function () { return exports.validateProjectName(project_name); }).then(function () { - // Log the given values for the project + // Log the given values for the project events.emit('log', 'Creating Cordova project for the Android platform:'); events.emit('log', '\tPath: ' + project_path); events.emit('log', '\tPackage: ' + package_name); diff --git a/spec/unit/create.spec.js b/spec/unit/create.spec.js index 4e5a5a7584..e3ea9b487f 100644 --- a/spec/unit/create.spec.js +++ b/spec/unit/create.spec.js @@ -148,10 +148,10 @@ describe('create', function () { }); describe('parameter values and defaults', function () { - it('should have a default package name of my.cordova.project', () => { + it('should have a default package name of io.cordova.helloCordova', () => { config_mock.packageName.and.returnValue(undefined); return create.create(project_path, config_mock, {}, events_mock).then(() => { - expect(create.validatePackageName).toHaveBeenCalledWith('my.cordova.project'); + expect(create.validatePackageName).toHaveBeenCalledWith('io.cordova.helloCordova'); }); }); @@ -162,10 +162,10 @@ describe('create', function () { }); }); - it('should have a default project name of CordovaExample', () => { + it('should have a default project name of Hello Cordova', () => { config_mock.name.and.returnValue(undefined); return create.create(project_path, config_mock, {}, events_mock).then(() => { - expect(create.validateProjectName).toHaveBeenCalledWith('CordovaExample'); + expect(create.validateProjectName).toHaveBeenCalledWith('Hello Cordova'); }); }); @@ -176,10 +176,10 @@ describe('create', function () { }); }); - it('should replace any non-word characters (including unicode and spaces) in the ConfigParser-provided project name with underscores', () => { + it('should keep non-word characters (including unicode and spaces) in the ConfigParser-provided project name', () => { config_mock.name.and.returnValue('応応応応 hello 用用用用'); return create.create(project_path, config_mock, {}, events_mock).then(() => { - expect(create.validateProjectName).toHaveBeenCalledWith('_____hello_____'); + expect(create.validateProjectName).toHaveBeenCalledWith('応応応応 hello 用用用用'); }); });