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/27 12:43:34 UTC

[cordova-windows] 16/26: fix eslint

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 d0b78c36d66a9721eea8bb0c76698846c60cfd15
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Fri Feb 16 00:43:49 2018 +0100

    fix eslint
---
 spec/unit/AppxManifest.spec.js       | 14 +++++++-------
 spec/unit/ConfigChanges.spec.js      |  6 +++---
 spec/unit/Prepare.Win10.spec.js      |  2 +-
 spec/unit/deployment.spec.js         |  3 +--
 template/cordova/lib/MSBuildTools.js |  4 ----
 template/cordova/lib/prepare.js      |  7 +------
 template/cordova/lib/run.js          | 14 +++-----------
 7 files changed, 16 insertions(+), 34 deletions(-)

diff --git a/spec/unit/AppxManifest.spec.js b/spec/unit/AppxManifest.spec.js
index b11fb9f..fd2cbd9 100644
--- a/spec/unit/AppxManifest.spec.js
+++ b/spec/unit/AppxManifest.spec.js
@@ -47,7 +47,7 @@ describe('AppxManifest', function () {
 
         it('Test #000 : should create a new AppxManifest instance', function () {
             var manifest;
-            expect(function () { manifest = new AppxManifest(WINDOWS_MANIFEST); }).not.toThrow();
+            expect(function () { manifest = new AppxManifest(WINDOWS_10_MANIFEST); }).not.toThrow();
             expect(manifest instanceof AppxManifest).toBe(true);
         });
 
@@ -60,7 +60,7 @@ describe('AppxManifest', function () {
         });
 
         it('Test #003 : should add ":" to manifest prefix if needed', function () {
-            expect(new AppxManifest(WINDOWS_MANIFEST, 'prefix').prefix).toEqual('prefix:');
+            expect(new AppxManifest(WINDOWS_10_MANIFEST, 'prefix').prefix).toEqual('prefix:');
         });
     });
 
@@ -103,12 +103,12 @@ describe('AppxManifest', function () {
     describe('static get() method', function () {
 
         it('Test #008 : should return an AppxManifest instance', function () {
-            expect(AppxManifest.get(WINDOWS_MANIFEST) instanceof AppxManifest).toBe(true);
+            expect(AppxManifest.get(WINDOWS_10_MANIFEST) instanceof AppxManifest).toBe(true);
         });
 
         it('Test #009 : should detect manifest prefix based on "Package" element attributes', function () {
-            expect(AppxManifest.get(WINDOWS_MANIFEST).prefix).toEqual('m2:');
-            expect(AppxManifest.get(WINDOWS_PHONE_MANIFEST).prefix).toEqual('m3:');
+            expect(AppxManifest.get(WINDOWS_10_MANIFEST).prefix).toEqual('m2:');
+            expect(AppxManifest.get(WINDOWS_10_MANIFEST).prefix).toEqual('m3:');
         });
 
         it('Test #010 : should instantiate either AppxManifest or Windows 10 AppxManifest based on manifest prefix', function () {
@@ -155,7 +155,7 @@ describe('AppxManifest', function () {
         var methods = ['getPhoneIdentity', 'getIdentity', 'getProperties', 'getApplication', 'getVisualElements'];
 
         it('Test #014 : should exists', function () {
-            var manifest = AppxManifest.get(WINDOWS_PHONE_MANIFEST);
+            var manifest = AppxManifest.get(WINDOWS_10_MANIFEST);
             var emptyManifest = AppxManifest.get('/no/prefixed');
 
             methods.forEach(function (method) {
@@ -187,7 +187,7 @@ describe('AppxManifest', function () {
         });
 
         it('Test #017 : setForegroundText should change the ForegroundText property on non-Windows 10 platforms', function () {
-            var visualElementsWindows = AppxManifest.get(WINDOWS_MANIFEST).getVisualElements();
+            var visualElementsWindows = AppxManifest.get(WINDOWS_10_MANIFEST).getVisualElements();
             var visualElementsWindows10 = AppxManifest.get(WINDOWS_10_MANIFEST).getVisualElements();
 
             var foregroundTextLight = 'light';
diff --git a/spec/unit/ConfigChanges.spec.js b/spec/unit/ConfigChanges.spec.js
index 77287d5..b823687 100644
--- a/spec/unit/ConfigChanges.spec.js
+++ b/spec/unit/ConfigChanges.spec.js
@@ -60,8 +60,8 @@ describe('PlatformMunger', function () {
     describe('apply_file_munge method', function () {
 
         it('should call parent\'s method with the same parameters', function () {
-            munger.apply_file_munge(WINDOWS_MANIFEST, munge, false);
-            expect(BaseMunger.prototype.apply_file_munge).toHaveBeenCalledWith(WINDOWS_MANIFEST, munge, false);
+            munger.apply_file_munge(WINDOWS10_MANIFEST, munge, false);
+            expect(BaseMunger.prototype.apply_file_munge).toHaveBeenCalledWith(WINDOWS10_MANIFEST, munge, false);
         });
 
         it('should additionally call parent\'s method with another munge if removing changes from windows 10 appxmanifest', function () {
@@ -96,7 +96,7 @@ describe('Capabilities within package.windows.appxmanifest', function () {
         shell.mkdir('-p', testDir);
         shell.cp('-rf', windowsProject + '/*', testDir);
         windowsPlatform = path.join(testDir, 'platforms/windows');
-        windowsManifest = path.join(windowsPlatform, WINDOWS_MANIFEST);
+        windowsManifest = path.join(windowsPlatform, WINDOWS10_MANIFEST);
         windowsManifest10 = path.join(windowsPlatform, WINDOWS10_MANIFEST);
         dummyPluginInfo = new PluginInfo(dummyPlugin);
         api = new Api();
diff --git a/spec/unit/Prepare.Win10.spec.js b/spec/unit/Prepare.Win10.spec.js
index afeff6e..a9fcd68 100644
--- a/spec/unit/Prepare.Win10.spec.js
+++ b/spec/unit/Prepare.Win10.spec.js
@@ -330,7 +330,7 @@ function createMockConfigAndManifestForDescription (description) {
         getPreference: function () { }
     };
 
-    var manifest = AppxManifest.get(Win81ManifestPath, /* ignoreCache= */true);
+    var manifest = AppxManifest.get(Win10ManifestPath, /* ignoreCache= */true);
     spyOn(fs, 'writeFileSync');
 
     return { config: config, manifest: manifest };
diff --git a/spec/unit/deployment.spec.js b/spec/unit/deployment.spec.js
index 24177d1..1b20ffc 100644
--- a/spec/unit/deployment.spec.js
+++ b/spec/unit/deployment.spec.js
@@ -21,7 +21,6 @@ var rewire = require('rewire');
 var deployment = rewire('../../template/cordova/lib/deployment');
 var Q = require('q');
 var path = require('path');
-var AppDeployCmdTool = deployment.__get__('AppDeployCmdTool');
 var WinAppDeployCmdTool = deployment.__get__('WinAppDeployCmdTool');
 
 var TEST_APP_PACKAGE_NAME = '"c:\\testapppackage.appx"';
@@ -141,4 +140,4 @@ describe('Windows 10 deployment interacts with the file system as expected.', fu
                 done();
             });
     });
-});
\ No newline at end of file
+});
diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index c479483..098d2dc 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -41,9 +41,6 @@ MSBuildTools.prototype.buildProject = function (projFile, buildType, buildarch,
     var checkWinSDK = function (target_platform) {
         return require('./check_reqs').isWinSDKPresent(target_platform);
     };
-    var checkPhoneSDK = function () {
-        return require('./check_reqs').isPhoneSDKPresent();
-    };
 
     // default build args
     var args = ['/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal', '/nologo',
@@ -275,7 +272,6 @@ function filterSupportedTargets (targets, msbuild) {
     }
 
     var targetFilters = {
-        '12.0': msBuild12TargetsFilter,
         '14.0': msBuild14TargetsFilter,
         '15.x': msBuild15TargetsFilter,
         '15.5': msBuild155TargetsFilter,
diff --git a/template/cordova/lib/prepare.js b/template/cordova/lib/prepare.js
index bc97c8f..421035d 100644
--- a/template/cordova/lib/prepare.js
+++ b/template/cordova/lib/prepare.js
@@ -50,7 +50,6 @@ var SUPPORTED_IMAGE_EXTENSIONS = ['.png', '.jpg', '.jpeg'];
 var SPLASH_SCREEN_SIZE_LIMIT = 200 * 1024; // 200 KBytes
 var TARGET_PROJECT_10 = 'TARGET_PROJECT_10';
 var SPLASH_SCREEN_DESKTOP_TARGET_NAME = 'SplashScreen';
-var SPLASH_SCREEN_PHONE_TARGET_NAME = 'SplashScreenPhone';
 
 /** Note: this is only for backward compatibility, since it is being called directly from windows_parser */
 module.exports.applyPlatformConfig = function () {
@@ -321,7 +320,7 @@ var PLATFORM_IMAGES = [
     {dest: 'Square150x150Logo.scale-240', width: 360, height: 360},
     {dest: 'Square310x310Logo.scale-100', width: 310, height: 310},
     {dest: 'Wide310x150Logo.scale-100', width: 310, height: 150},
-    {dest: 'Wide310x150Logo.scale-240', width: 744, height: 360},
+    {dest: 'Wide310x150Logo.scale-240', width: 744, height: 360}
 ];
 
 function findPlatformImage (width, height) {
@@ -557,10 +556,6 @@ function updateSplashScreenImageExtensions (cordovaProject, locations) {
         return checkTargetMatchAndUpdateUsedExtensions(img, SPLASH_SCREEN_DESKTOP_TARGET_NAME);
     })[0];
 
-    var phoneSplashScreen = splashScreens.filter(function (img) {
-        return checkTargetMatchAndUpdateUsedExtensions(img, SPLASH_SCREEN_PHONE_TARGET_NAME);
-    })[0];
-
     checkThatExtensionsAreNotMixed();
 
     var manifestSplashScreenMap = {};
diff --git a/template/cordova/lib/run.js b/template/cordova/lib/run.js
index e1f62c0..bfec351 100644
--- a/template/cordova/lib/run.js
+++ b/template/cordova/lib/run.js
@@ -81,7 +81,7 @@ module.exports.run = function (options) {
         .then(function (pkg) {
             events.emit('log', 'Deploying ' + pkg.type + ' package to ' + deployTarget + ':\n' + pkg.appx);
             switch (pkg.type) {
-            case 'phone':
+            case 'phone': // TODO remove I guess?
                 return packages.deployToPhone(pkg, deployTarget, args.win10tools)
                     .catch(function (e) {
                         if (options.target || options.emulator || options.device) {
@@ -100,23 +100,15 @@ module.exports.run = function (options) {
                     }
                     return packages.deployToPhone(pkg, deployTarget, true);
                 } else {
-                    return packages.deployToDesktop(pkg, deployTarget, projectType);
+                    return packages.deployToDesktop(pkg, deployTarget);
                 }
                 break; /* eslint no-unreachable : 0 */
             default: // 'windows'
-                return packages.deployToDesktop(pkg, deployTarget, projectType);
+                return packages.deployToDesktop(pkg, deployTarget);
             }
         });
 };
 
-// TODO remove as only one project type
-// Retrieves project type for the project file specified.
-// @param   {String}  projFile Project file, for example 'CordovaApp.Windows10.jsproj'
-// @returns {String}  Proejct type, for example 'windows10'
-function projFileToType (projFile) {
-    return projFile.replace(/CordovaApp|jsproj|\./gi, '').toLowerCase();
-}
-
 /**
  * Checks if current process is an with administrative permissions (e.g. from
  *   elevated command prompt).

-- 
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