From 22f736ebf34cfb208a7a49a48248e4367e0effb2 Mon Sep 17 00:00:00 2001 From: guinau_v Date: Tue, 22 Oct 2019 14:20:29 +0200 Subject: [PATCH] Add callbacks to fs.unlink(). fixes #525. --- lib/create-ttl-grammar.js | 15 ++++++++++----- src/create-ttl-grammar.js | 16 ++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/create-ttl-grammar.js b/lib/create-ttl-grammar.js index d70517f..c3f7ecc 100644 --- a/lib/create-ttl-grammar.js +++ b/lib/create-ttl-grammar.js @@ -255,11 +255,16 @@ module.exports = class CreateTtlGrammar { // remove all language files in tagged template GrammarFiles array removeTtlLanguageFiles() { return this.getTtlGrammarFiles().then(ttlGrammarFiles => { - for (let ttlGrammarFilename of ttlGrammarFiles) { - let ttlGrammarFileAbsoulte = this.makeTtlGrammarFilenameAbsoulute(ttlGrammarFilename); - fs.unlink(ttlGrammarFileAbsoulte); - } + return Promise.all(ttlGrammarFiles.map((ttlGrammarFilename) => + new Promise ((resolve, reject) => { + let ttlGrammarFileAbsoulte = this.makeTtlGrammarFilenameAbsoulute(ttlGrammarFilename); + fs.unlink(ttlGrammarFileAbsoulte, (err) => { + if (err) return reject(err); + resolve(); + }); + }) + )) }); } }; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNyZWF0ZS10dGwtZ3JhbW1hci5qcyJdLCJuYW1lcyI6WyJjcnlwdG8iLCJyZXF1aXJlIiwiZnMiLCJwYXRoIiwiQ29tcG9zaXRlRGlzcG9zYWJsZSIsIm1vZHVsZSIsImV4cG9ydHMiLCJDcmVhdGVUdGxHcmFtbWFyIiwiY29uc3RydWN0b3IiLCJvYnNlcnZlQ29uZmlnIiwiZGlzcG9zYWJsZSIsImNvbmZpZ0NoYW5nZWRUaW1lciIsIlRUTF9HUkFNTUFSX05BTUUiLCJUVExfU0NPUEVOQU1FIiwiYWRkIiwiYXRvbSIsImNvbmZpZyIsIm9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ICAgICAgIGxldCByZWYsIHJlZjEsIHJlZjI7XHJcbiAgICAgICAgICBpZiAoKHJlZiA9IG9iai5maXJzdExpbmVSZWdleCkgIT0gbnVsbCkge1xyXG4gICAgICAgICAgICBpZiAoKHJlZjEgPSByZWYuc2Nhbm5lcikgIT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgIGlmICgocmVmMiA9IHJlZjEuX19wcm90b19fKSAhPSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHJlZjIuY29uc3RydWN0b3IgPT09IFwiZnVuY3Rpb25cIikge1xyXG4gICAgICAgICAgICAgICAgICAvLyBub3cgY2FsbCBuZXcgb2JqLmZpcnN0TGluZVJlZ2V4LnNjYW5uZXIuX19wcm90b19fLmNvbnN0cnVjdG9yKFtvbmlnU3RyaW5nXSk7XHJcbiAgICAgICAgICAgICAgICAgIC8vIHRvIHZhbGlkYXRlIHRoZSByZWdleFxyXG4gICAgICAgICAgICAgICAgICBuZXcgcmVmMi5jb25zdHJ1Y3RvcihbcmVnZXhdKTtcclxuICAgICAgICAgICAgICAgICAgaXNSZWdleFZhbGlkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgIH1cclxuICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZWxzZSByZXR1cm4gdHJ1ZTtcclxuICAgICAgfSk7XHJcbiAgICB9XHJcbiAgICByZXR1cm4gaXNSZWdleFZhbGlkO1xyXG4gIH1cclxuXHJcbiAgLy8gUmVtb3ZlIGdyYW1tYXJzIGJlZm9yZSB1cG9kYXRpbmdcclxuICByZW1vdmVHcmFtbWFycygpIHtcclxuICAgIGF0b20uZ3JhbW1hcnMucmVtb3ZlR3JhbW1hckZvclNjb3BlTmFtZSh0aGlzLlRUTF9TQ09QRU5BTUUpO1xyXG4gIH1cclxuXHJcbiAgLy8gcmVtb3ZlIGFsbCBsYW5ndWFnZSBmaWxlcyBpbiB0YWdnZWQgdGVtcGxhdGUgR3JhbW1hckZpbGVzIGFycmF5XHJcbiAgcmVtb3ZlVHRsTGFuZ3VhZ2VGaWxlcygpIHtcclxuICAgIHJldHVybiB0aGlzLmdldFR0bEdyYW1tYXJGaWxlcygpLnRoZW4oKHR0bEdyYW1tYXJGaWxlcykgPT4ge1xyXG4gICAgICBmb3IgKGxldCB0dGxHcmFtbWFyRmlsZW5hbWUgb2YgdHRsR3JhbW1hckZpbGVzKSB7XHJcbiAgICAgICAgbGV0IHR0bEdyYW1tYXJGaWxlQWJzb3VsdGUgPSB0aGlzLm1ha2VUdGxHcmFtbWFyRmlsZW5hbWVBYnNvdWx1dGUodHRsR3JhbW1hckZpbGVuYW1lKTtcclxuICAgICAgICBmcy51bmxpbmsodHRsR3JhbW1hckZpbGVBYnNvdWx0ZSk7XHJcbiAgICAgIH1cclxuICAgIH0pO1xyXG5cclxuICB9XHJcbn07XHJcbiJdfQ== diff --git a/src/create-ttl-grammar.js b/src/create-ttl-grammar.js index 7842908..404a275 100644 --- a/src/create-ttl-grammar.js +++ b/src/create-ttl-grammar.js @@ -265,12 +265,16 @@ class CreateTtlGrammar { // remove all language files in tagged template GrammarFiles array removeTtlLanguageFiles() { - return this.getTtlGrammarFiles().then((ttlGrammarFiles) => { - for (let ttlGrammarFilename of ttlGrammarFiles) { - let ttlGrammarFileAbsoulte = this.makeTtlGrammarFilenameAbsoulute(ttlGrammarFilename); - fs.unlink(ttlGrammarFileAbsoulte); - } + return this.getTtlGrammarFiles().then(ttlGrammarFiles => { + return Promise.all(ttlGrammarFiles.map((ttlGrammarFilename) => { + return new Promise ((resolve, reject) => { + let ttlGrammarFileAbsoulte = this.makeTtlGrammarFilenameAbsoulute(ttlGrammarFilename); + fs.unlink(ttlGrammarFileAbsoulte, (err) => { + if (err) return reject(err); + resolve(); + }); + }); + })) }); - } };