Skip to content

Commit

Permalink
Update permissions only for existent files or directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
romankoval committed Nov 12, 2018
1 parent 809b737 commit 61d4005
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions index.js
Expand Up @@ -19,16 +19,22 @@ PermissionsOutputPlugin.prototype.apply = function(compiler) {
.directory()
.findSync();
for (const di of dirs) {
fs.chmodSync(di, dir.dirMode || 644);
if (fs.existsSync(di)) {
fs.chmodSync(di, dir.dirMode || 644);
}
}
for (const fi of files) {
fs.chmodSync(fi, dir.fileMode || 755);
if (fs.existsSync(fi)) {
fs.chmodSync(fi, dir.fileMode || 755);
}
}
}
}
if (this.options.buildFiles) {
for (const file of this.options.buildFiles) {
fs.chmodSync(file.path || file, file.fileMode || 755);
if (fs.existsSync(file.path || file)) {
fs.chmodSync(file.path || file, file.fileMode || 755);
}
}
}
};
Expand Down

0 comments on commit 61d4005

Please sign in to comment.