You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/02/16 12:57:20 UTC

[cordova-windows] 02/03: clean up switch by pkg.type (is always `windows10` now)

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

janpio pushed a commit to branch janpio-win10only
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit f732f52d120c2c8e2d55fbcc9ea7fdaf1667b81e
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Fri Feb 16 13:56:32 2018 +0100

    clean up switch by pkg.type (is always `windows10` now)
---
 template/cordova/lib/run.js | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/template/cordova/lib/run.js b/template/cordova/lib/run.js
index 98e69fc..53577cc 100644
--- a/template/cordova/lib/run.js
+++ b/template/cordova/lib/run.js
@@ -80,30 +80,15 @@ module.exports.run = function (options) {
     return buildPackages
         .then(function (pkg) {
             events.emit('log', 'Deploying ' + pkg.type + ' package to ' + deployTarget + ':\n' + pkg.appx);
-            switch (pkg.type) {
-            case 'phone': // TODO remove I guess?
-                return packages.deployToPhone(pkg, deployTarget, args.win10tools)
-                    .catch(function (e) {
-                        if (options.target || options.emulator || options.device) {
-                            return Q.reject(e); // Explicit target, carry on
-                        }
-                        // 'device' was inferred initially, because no target was specified
-                        return packages.deployToPhone(pkg, 'emulator', args.win10tools);
-                    });
-            case 'windows10':
-                if (args.phone) {
-                    // Win10 emulator launch is not currently supported, always force device
-                    if (options.emulator || options.target === 'emulator') {
-                        events.emit('warn', 'Windows 10 Phone emulator is currently not supported. ' +
-                                'If you want to deploy to emulator, use Visual Studio instead. ' +
-                                'Attempting to deploy to device...');
-                    }
-                    return packages.deployToPhone(pkg, deployTarget, true);
-                } else {
-                    return packages.deployToDesktop(pkg, deployTarget);
+            if (args.phone) {
+                // Win10 emulator launch is not currently supported, always force device
+                if (options.emulator || options.target === 'emulator') {
+                    events.emit('warn', 'Windows 10 Phone emulator is currently not supported. ' +
+                            'If you want to deploy to emulator, use Visual Studio instead. ' +
+                            'Attempting to deploy to device...');
                 }
-                break; /* eslint no-unreachable : 0 */
-            default: // 'windows'
+                return packages.deployToPhone(pkg, deployTarget);
+            } else {
                 return packages.deployToDesktop(pkg, deployTarget);
             }
         });

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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