-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compileAllJsFilesInDir: Added promise #1552
Conversation
Conflicts: src/node/recursiveModuleCompile.js
return new Promise(function(resolve, reject) { | ||
glob(inputDir + '/**/*.js', {}, function (er, files) { | ||
if (er) | ||
throw new Error('While scanning ' + inputDir + ': ' + er); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should then be:
if (err) {
reject(new Error('While scanning ' + inputDir + ': ' + err));
return;
}
But we also need to terminate the glob
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think test should be added for this function. Especially for reject
.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/. If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits. Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name. |
var outputFilePath = inputFilePath.replace(inputDir, outputDir); | ||
var compiler = new NodeCompiler(options); | ||
compiler.compileSingleFile(inputFilePath, outputFilePath, function (err) { | ||
throw new Error('While reading ' + inputFilePath + ': ' + err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here?
@tuchk4 I manually checked that you signed the CLA for the other PR. Maybe your information did not include the GitHub user name? |
CLAs look good, thanks! |
@arv GH name already added. CLAs look good |
} | ||
|
||
var total = files.length, | ||
current = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var
for both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not 0? You can drop else
with it:
var total = files.length;
var current = 0;
current++;
if (current === total) {
resolve();
}
Can you add two tests that calls this function, one success and one failure? The test also serves as an example. |
If I should execute other scripts after traceur compilation I need to know when compilation is finished.
But seems in this PR one problem - on reject way.
errback at
.compileSingleFile
- only if there are problems in file reading. Parse errors are thrown in other scope.