Skip to content

Commit

Permalink
CB-12397 cleanup remove whitespace before fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher J. Brody committed May 10, 2017
1 parent 8e7ad89 commit 1ade9c4
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ if (!global_config_path) {
* This will make the create internal events visible outside
* @param {EventEmitter} externalEventEmitter An EventEmitter instance that will be used for
* logging purposes. If no EventEmitter provided, all events will be logged to console
* @return {EventEmitter}
*/
* @return {EventEmitter}
*/
function setupEvents(externalEventEmitter) {
if (externalEventEmitter) {
// This will make the platform internal events visible outside
events.forwardEventsTo(externalEventEmitter);
}
// There is no logger if external emitter is not present,
// so attach a console logger
else {
else {
CordovaLogger.subscribe(events);
}
return events;
Expand All @@ -59,9 +59,9 @@ function setupEvents(externalEventEmitter) {
* Usage:
* @dir - directory where the project will be created. Required.
* @optionalId - app id. Required (but be "undefined")
* @optionalName - app name. Required (but can be "undefined").
* @optionalName - app name. Required (but can be "undefined").
* @cfg - extra config to be saved in .cordova/config.json Required (but can be "{}").
* @extEvents - An EventEmitter instance that will be used for logging purposes. Required (but can be "undefined").
* @extEvents - An EventEmitter instance that will be used for logging purposes. Required (but can be "undefined").
**/
// Returns a promise.
module.exports = function(dir, optionalId, optionalName, cfg, extEvents) {
Expand Down Expand Up @@ -224,7 +224,7 @@ module.exports = function(dir, optionalId, optionalName, cfg, extEvents) {
}).then(function(input_directory) {
var import_from_path = input_directory;

//handle when input wants to specify sub-directory (specified in index.js as "dirname" export);
//handle when input wants to specify sub-directory (specified in index.js as "dirname" export);
var isSubDir = false;
try {
// Delete cached require incase one exists
Expand Down Expand Up @@ -254,7 +254,7 @@ module.exports = function(dir, optionalId, optionalName, cfg, extEvents) {

// get stock hooks; used if template does not contain hooks
paths.hooks = path.join(require('cordova-app-hello-world').dirname, 'hooks');

// ToDo: get stock package.json if template does not contain package.json;
var dirAlreadyExisted = fs.existsSync(dir);
if (!dirAlreadyExisted) {
Expand Down Expand Up @@ -326,7 +326,7 @@ module.exports = function(dir, optionalId, optionalName, cfg, extEvents) {
if (cfg.name) conf.setName(cfg.name);
conf.setVersion('1.0.0');
conf.write();
}
}
});
};

Expand Down Expand Up @@ -365,16 +365,16 @@ function copyTemplateFiles(templateDir, projectDir, isSubDir) {
// Remove directories, and files that are unwanted
if (!isSubDir) {
var excludes = ['package.json', 'RELEASENOTES.md' , '.git', 'NOTICE', 'LICENSE', 'COPYRIGHT', '.npmignore'];
templateFiles = templateFiles.filter( function (value) {
return excludes.indexOf(value) < 0;
});
templateFiles = templateFiles.filter( function (value) {
return excludes.indexOf(value) < 0;
});
}
// Copy each template file after filter
for (var i = 0; i < templateFiles.length; i++) {
copyPath = path.resolve(templateDir, templateFiles[i]);
shell.cp('-R', copyPath, projectDir);
}
}
}
}

/**
Expand Down Expand Up @@ -406,9 +406,9 @@ function projectConfig(projectDir) {

/**
* Retrieve and read the .cordova/config file of a cordova project
*
*
* @param {String} project directory
* @return {JSON data} config file's contents
* @return {JSON data} config file's contents
*/
function dotCordovaConfig(project_root) {
var configPath = path.join(project_root, '.cordova', 'config.json');
Expand All @@ -422,7 +422,7 @@ function dotCordovaConfig(project_root) {

/**
* Write opts to .cordova/config.json
*
*
* @param {String} project directory
* @param {Object} opts containing the additions to config.json
* @param {Boolean} autopersist option
Expand All @@ -443,13 +443,13 @@ function writeToConfigJson(project_root, opts, autoPersist) {
}
return json;
} else {
return json;
}
return json;
}
}

/**
* Removes existing files and symlinks them if they exist.
* Symlinks folders: www, merges, hooks
* Symlinks folders: www, merges, hooks
* Symlinks file: config.xml (but only if it exists outside of the www folder)
* If config.xml exists inside of template/www, COPY (not link) it to project/
* */
Expand All @@ -464,7 +464,7 @@ function writeToConfigJson(project_root, opts, autoPersist) {
fs.symlinkSync(src, dst, type);
}
}
}
}
// if template is a www dir
if (path.basename(templateDir) === 'www') {
linkSrc = path.resolve(templateDir);
Expand Down

0 comments on commit 1ade9c4

Please sign in to comment.