You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2019/02/21 06:45:22 UTC

[cordova-electron] branch master updated: Remove Unused and Unreachable Code (#24)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-electron.git


The following commit(s) were added to refs/heads/master by this push:
     new 6e23472  Remove Unused and Unreachable Code (#24)
6e23472 is described below

commit 6e23472ea758b4d5393929370afac49b9a37b087
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Thu Feb 21 15:45:17 2019 +0900

    Remove Unused and Unreachable Code (#24)
---
 bin/templates/cordova/Api.js | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/bin/templates/cordova/Api.js b/bin/templates/cordova/Api.js
index c21409f..91279d7 100644
--- a/bin/templates/cordova/Api.js
+++ b/bin/templates/cordova/Api.js
@@ -108,7 +108,6 @@ class Api {
             this.getPlatformInfo().version;
 
         const actions = new ActionStack();
-        const projectFile = this.handler.parseProjectFile && this.handler.parseProjectFile(this.root);
 
         let platform = this.platform;
         if (!pluginInfo.getPlatformsArray().includes(platform)) { // if `cordova-electron` is not defined in plugin.xml, `browser` is used instead.
@@ -122,18 +121,14 @@ class Api {
             .forEach((item) => {
                 actions.push(actions.createAction(
                     this._getInstaller(item.itemType),
-                    [item, pluginInfo.dir, pluginInfo.id, installOptions, projectFile],
+                    [item, pluginInfo.dir, pluginInfo.id, installOptions],
                     this._getUninstaller(item.itemType),
-                    [item, pluginInfo.dir, pluginInfo.id, installOptions, projectFile]));
+                    [item, pluginInfo.dir, pluginInfo.id, installOptions]));
             });
 
         // run through the action stack
         return actions.process(platform, this.root)
             .then(() => {
-                if (projectFile) {
-                    projectFile.write();
-                }
-
                 // Add PACKAGE_NAME variable into vars
                 if (!installOptions.variables.PACKAGE_NAME) {
                     installOptions.variables.PACKAGE_NAME = this.handler.package_name(this.root);
@@ -157,7 +152,6 @@ class Api {
         uninstallOptions.platformVersion = uninstallOptions.platformVersion || this.getPlatformInfo().version;
 
         const actions = new ActionStack();
-        const projectFile = this.handler.parseProjectFile && this.handler.parseProjectFile(this.root);
 
         let platform = this.platform;
         if (!plugin.getPlatformsArray().includes(platform)) { // if `cordova-electron` is not defined in plugin.xml, `browser` is used instead.
@@ -170,17 +164,13 @@ class Api {
             .concat(plugin.getJsModules(platform))
             .forEach((item) => {
                 actions.push(actions.createAction(
-                    this._getUninstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions, projectFile],
-                    this._getInstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions, projectFile]));
+                    this._getUninstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions],
+                    this._getInstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions]));
             });
 
         // run through the action stack
         return actions.process(platform, this.root)
             .then(() => {
-                if (projectFile) {
-                    projectFile.write();
-                }
-
                 this._munger
                     // Ignore passed `is_top_level` option since platform itself doesn't know
                     // anything about managing dependencies - it's responsibility of caller.
@@ -373,7 +363,6 @@ Api.createPlatform = function (dest, config, options, events) {
         return require('../../lib/create').createProject(dest, id, name, options).then(() => new Api(null, dest, events));
     } catch (e) {
         events.emit('error', 'createPlatform is not callable from the electron project API.');
-        throw (e);
     }
 };
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org