From 881940092ac7156521e6db5f3d8e8b19860837a4 Mon Sep 17 00:00:00 2001 From: HiDeo Date: Mon, 26 Feb 2018 17:42:36 +0100 Subject: [PATCH 1/3] Switch to tap --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 879b7bd..c3352a2 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ function PermissionsOutputPlugin(options) { } PermissionsOutputPlugin.prototype.apply = function (compiler) { - compiler.plugin('done', () => { + compiler.hooks.done.tap('WebpackPermissionsPlugin', () => { if (this.options.buildFolders) { for (const dir of this.options.buildFolders) { const dirs = FileHound.create() From 175b023f3e825bccaddc08b3e3e85a7aa5b28046 Mon Sep 17 00:00:00 2001 From: George Kormaris Date: Mon, 26 Feb 2018 17:53:09 +0000 Subject: [PATCH 2/3] Backward compatible tap update --- index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c3352a2..5166cc6 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ function PermissionsOutputPlugin(options) { } PermissionsOutputPlugin.prototype.apply = function (compiler) { - compiler.hooks.done.tap('WebpackPermissionsPlugin', () => { + const changeFilePermissions = () => { if (this.options.buildFolders) { for (const dir of this.options.buildFolders) { const dirs = FileHound.create() @@ -31,7 +31,15 @@ PermissionsOutputPlugin.prototype.apply = function (compiler) { fs.chmodSync(file.path || file, file.fileMode || 755); } } - }); + } + + const webpackTap = compiler.hooks && compiler.hooks.done && compiler.hooks.done.tap; + + if (webpackTap) { + webpackTap('WebpackPermissionsPlugin', changeFilePermissions); + } else { + compiler.plugin('done', changeFilePermissions); + } }; module.exports = PermissionsOutputPlugin; From b978b181fb9f17a6095e7a748c538932785db114 Mon Sep 17 00:00:00 2001 From: HiDeo Date: Mon, 26 Feb 2018 19:19:05 +0100 Subject: [PATCH 3/3] Fix a binding issue with Webpack 4 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 5166cc6..d6a416b 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,7 @@ PermissionsOutputPlugin.prototype.apply = function (compiler) { } } - const webpackTap = compiler.hooks && compiler.hooks.done && compiler.hooks.done.tap; + const webpackTap = compiler.hooks && compiler.hooks.done && compiler.hooks.done.tap.bind(compiler.hooks.done); if (webpackTap) { webpackTap('WebpackPermissionsPlugin', changeFilePermissions);