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 3d9072d  refactor: transform template strings (#123)
3d9072d is described below

commit 3d9072d9d2fe45ffb0885dff9ff44a8cac150b71
Author: エリス <[email protected]>
AuthorDate: Fri Dec 20 06:56:30 2019 +0900

    refactor: transform template strings (#123)
---
 bin/templates/cordova/Api.js         |  2 +-
 bin/templates/cordova/handler.js     |  2 +-
 bin/templates/cordova/lib/prepare.js |  2 +-
 bin/templates/cordova/parser.js      |  2 +-
 tests/spec/unit/Api.spec.js          | 24 ++++++++++++------------
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/bin/templates/cordova/Api.js b/bin/templates/cordova/Api.js
index 5ee2677..9198966 100644
--- a/bin/templates/cordova/Api.js
+++ b/bin/templates/cordova/Api.js
@@ -243,7 +243,7 @@ class Api {
         const modulesToInstall = plugin.getJsModules(platform)
             .filter((moduleToInstall) => 
installedPaths.indexOf(moduleToInstall.file) === -1)
             .map((moduleToInstall) => {
-                const moduleName = plugin.id + '.' + (moduleToInstall.name || 
moduleToInstall.src.match(/([^\/]+)\.js/)[1]);
+                const moduleName = `${plugin.id}.${moduleToInstall.name || 
moduleToInstall.src.match(/([^\/]+)\.js/)[1]}`;
                 const obj = {
                     file: ['plugins', plugin.id, 
moduleToInstall.src].join('/'),
                     id: moduleName,
diff --git a/bin/templates/cordova/handler.js b/bin/templates/cordova/handler.js
index c0fec63..8d1e810 100644
--- a/bin/templates/cordova/handler.js
+++ b/bin/templates/cordova/handler.js
@@ -48,7 +48,7 @@ module.exports = {
             const moduleSource = path.resolve(plugin_dir, jsModule.src);
             // Get module name based on existing 'name' attribute or filename
             // Must use path.extname/path.basename instead of path.parse due 
to CB-9981
-            const moduleName = plugin_id + '.' + (jsModule.name || 
path.basename(jsModule.src, path.extname(jsModule.src)));
+            const moduleName = `${plugin_id}.${jsModule.name || 
path.basename(jsModule.src, path.extname(jsModule.src))}`;
 
             // Read in the file, prepend the cordova.define, and write it back 
out.
             let scriptContent = fs.readFileSync(moduleSource, 
'utf-8').replace(/^\ufeff/, ''); // Window BOM
diff --git a/bin/templates/cordova/lib/prepare.js 
b/bin/templates/cordova/lib/prepare.js
index 3832d64..5c15560 100644
--- a/bin/templates/cordova/lib/prepare.js
+++ b/bin/templates/cordova/lib/prepare.js
@@ -188,7 +188,7 @@ function updateIcons (cordovaProject, locations) {
 function checkIconsAttributes (icon) {
     if (((icon.height && icon.width) >= 512 || (icon.height && icon.width) === 
undefined) && icon.src) return true;
 
-    events.emit('info', `The following${icon.target ? ' ' + icon.target : ''} 
icon with a size of width=${icon.width} height=${icon.height} does not meet the 
requirements and will be ignored.`);
+    events.emit('info', `The following${icon.target ? ` ${icon.target}` : ''} 
icon with a size of width=${icon.width} height=${icon.height} does not meet the 
requirements and will be ignored.`);
     return false;
 }
 
diff --git a/bin/templates/cordova/parser.js b/bin/templates/cordova/parser.js
index 4910e2b..87bd8cd 100644
--- a/bin/templates/cordova/parser.js
+++ b/bin/templates/cordova/parser.js
@@ -100,5 +100,5 @@ module.exports = function (project) {
  * Logs all file operations via the verbose event stream, indented.
  */
 function logFileOp (message) {
-    events.emit('verbose', '  ' + message);
+    events.emit('verbose', `  ${message}`);
 }
diff --git a/tests/spec/unit/Api.spec.js b/tests/spec/unit/Api.spec.js
index d1a4f1a..48a2574 100644
--- a/tests/spec/unit/Api.spec.js
+++ b/tests/spec/unit/Api.spec.js
@@ -193,7 +193,7 @@ describe('Api class', () => {
                     expect(fileExists(path.resolve(testProjectDir, 'www', 
'cordova_plugins.js'))).toBeTruthy();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -218,7 +218,7 @@ describe('Api class', () => {
                     expect(readJson(path.resolve(testProjectDir, 'www', 'js', 
'sample.json')).title).toEqual('sample');
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -245,7 +245,7 @@ describe('Api class', () => {
                     expect(fileExists(path.resolve(testProjectDir, 'www', 
'plugins', 'module-plugin', 'www', 'plugin.js'))).toBeTruthy();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -274,7 +274,7 @@ describe('Api class', () => {
                     api.events = _events;
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                     api.events = _events;
                 }
             );
@@ -297,7 +297,7 @@ describe('Api class', () => {
                     expect(logs.verbose.some(message => message === 
'source-file.install is currently not supported for electron')).toBeTruthy();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -318,7 +318,7 @@ describe('Api class', () => {
                     expect(fileExists(path.resolve(testProjectDir, 'www', 
'cordova_plugins.js'))).toBeTruthy();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -362,7 +362,7 @@ describe('Api class', () => {
                     expect(result).not.toBeDefined();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -388,7 +388,7 @@ describe('Api class', () => {
                     expect(fileExists(path.resolve(testProjectDir, 'www', 
'js', 'sample.json'))).toBeFalsy();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -418,7 +418,7 @@ describe('Api class', () => {
                     expect(fileExists(path.resolve(testProjectDir, 'www', 
'plugins', 'module-plugin', 'www', 'plugin.js'))).toBeFalsy();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -439,7 +439,7 @@ describe('Api class', () => {
                     expect(result).not.toBeDefined();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -461,7 +461,7 @@ describe('Api class', () => {
                     expect(logs.verbose.some(message => message === 
'source-file.uninstall is currently not supported for electron')).toBeTruthy();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });
@@ -479,7 +479,7 @@ describe('Api class', () => {
                     expect(result).not.toBeDefined();
                 },
                 (error) => {
-                    fail('Unwanted code branch: ' + error);
+                    fail(`Unwanted code branch: ${error}`);
                 }
             );
         });


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to