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

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


The following commit(s) were added to refs/heads/master by this push:
     new f26778f  refactor: hide implementation of build & run (#1188)
f26778f is described below

commit f26778f2045f10ccaa3f5e943fbec450c41589c4
Author: Raphael von der GrĂ¼n <raphine...@gmail.com>
AuthorDate: Tue Nov 9 22:26:23 2021 +0100

    refactor: hide implementation of build & run (#1188)
    
    This makes build and run modules more closed by avoiding to expose
    internals via the resolved promise value. Both modules' main exports
    previously returned a promise that resolved to a subrocess spawn result.
    Now these promises resolve to undefined.
    
    The public API methods that return these promises did not document a
    specific promise return value, just when the promise would resolve or
    reject. Thus, this change is not breaking.
---
 bin/templates/scripts/cordova/lib/build.js | 4 +++-
 bin/templates/scripts/cordova/lib/run.js   | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bin/templates/scripts/cordova/lib/build.js 
b/bin/templates/scripts/cordova/lib/build.js
index db43ccc..cfe1e6e 100644
--- a/bin/templates/scripts/cordova/lib/build.js
+++ b/bin/templates/scripts/cordova/lib/build.js
@@ -87,6 +87,7 @@ function getDefaultSimulatorTarget () {
         });
 }
 
+/** @returns {Promise<void>} */
 module.exports.run = buildOpts => {
     let emulatorTarget = '';
     const projectPath = path.join(__dirname, '..', '..');
@@ -263,7 +264,8 @@ module.exports.run = buildOpts => {
             return fs.writeFile(exportOptionsPath, exportOptionsPlist, 'utf-8')
                 .then(checkSystemRuby)
                 .then(packageArchive);
-        });
+        })
+        .then(() => {}); // resolve to undefined
 };
 
 /**
diff --git a/bin/templates/scripts/cordova/lib/run.js 
b/bin/templates/scripts/cordova/lib/run.js
index b6d849e..1918edf 100644
--- a/bin/templates/scripts/cordova/lib/run.js
+++ b/bin/templates/scripts/cordova/lib/run.js
@@ -30,6 +30,7 @@ const fs = require('fs-extra');
 const cordovaPath = path.join(__dirname, '..');
 const projectPath = path.join(__dirname, '..', '..');
 
+/** @returns {Promise<void>} */
 module.exports.run = runOptions => {
     // Validate args
     if (runOptions.device && runOptions.emulator) {
@@ -108,7 +109,8 @@ module.exports.run = runOptions => {
             } else {
                 return module.exports.deployToSim(appPath, runOptions.target);
             }
-        });
+        })
+        .then(() => {}); // resolve to undefined
 };
 
 module.exports.filterSupportedArgs = filterSupportedArgs;

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

Reply via email to