Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/384#discussion_r52985929
  
    --- Diff: cordova-lib/src/cordova/build.js ---
    @@ -17,22 +17,26 @@
         under the License.
     */
     
    -var cordovaUtil      = require('./util'),
    -    HooksRunner           = require('../hooks/HooksRunner');
    +var Q = require('q'),
    +    cordovaUtil = require('./util'),
    +    HooksRunner = require('../hooks/HooksRunner');
     
     // Returns a promise.
     module.exports = function build(options) {
    -    var projectRoot = cordovaUtil.cdProjectRoot();
    -    options = cordovaUtil.preProcessOptions(options);
    -
    -    // fire build hooks
    -    var hooksRunner = new HooksRunner(projectRoot);
    -    return hooksRunner.fire('before_build', options)
    -    .then(function() {
    -        return require('./cordova').raw.prepare(options);
    -    }).then(function() {
    -        return require('./cordova').raw.compile(options);
    -    }).then(function() {
    -        return hooksRunner.fire('after_build', options);
    +    return Q().then(function() {
    +        var opts = cordovaUtil.preProcessOptions(options);
    +        var projectRoot = cordovaUtil.cdProjectRoot();
    +        return [new HooksRunner(projectRoot), opts];
    +    })
    +    .spread(function (hooksRunner, options) {
    --- End diff --
    
    > Why can't we just essentially wrap the entire method in return 
`Q().then(function() { ... };`?
    
    We can and basically this would be same. I think it's just a matter of 
taste..
    If you wish, i can update the PR in the manner you proposed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to