-
-
Save othiym23/c080e9f5d606c55c4d8b to your computer and use it in GitHub Desktop.
Promises run linearly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
visitAll : function (prefix, target, visitor) { | |
/* Installs and visits must happen sequentially so node_modules doesn't | |
* get stomped mid-run. | |
*/ | |
function installAndVisit(versions, index, result) { | |
if (!versions[index]) return result; | |
return installer.visitVersion(prefix, target, versions[index], visitor) | |
.then(installAndVisit.bind(null, versions, index - 1)); | |
} | |
function installAll(versions) { | |
console.log("Installing %s versions of %s.", versions.length, target); | |
recreate(prefix, 'build-errors'); | |
return installAndVisit(versions, versions.length - 1); | |
} | |
return installer.versions(target).then(installAll); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment