-
-
Notifications
You must be signed in to change notification settings - Fork 283
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
feat: add support for copying file permissions (options.copyPermissions
)
#119
Conversation
I tried writing tests for this but ran into trouble getting the stats for the emitted files. (I can't seem to find them post-webpack to get the stats from. Code here.) |
I'm setting up a new stack for an internal project at work that relies on this plugin. I'd love to see this pulled because we're currently relying on a slightly unsightly workaround for files that need to be copied with permissions. |
Definitely needs this in case you want to use executable file inside your lambda 👍 |
src/writeFile.js
Outdated
|
||
perms |= stat.mode & fs.constants.S_IRWXU; | ||
perms |= stat.mode & fs.constants.S_IRWXG; | ||
perms |= stat.mode & fs.constants.S_IRWXO; |
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.
These constants (S_IRWXU
, S_IRWXG
, S_IRWXO
) doesn't exist in node < 6.3 😕
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.
Do they exist in the constants
module (i.e. require("constants")
in the earlier versions?
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.
Yep they do exist in constants.default.S_IRWXU
for example
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've tested with:
// src/writeFile.js
perms |= stat.mode & (fs.constants.S_IRWXU || constants.default.S_IRWXU);
and
// src/index.js
let mask
if (fs.constants !== undefined) {
mask = fs.constants.S_IRWXU | fs.constants.S_IRWXG | fs.constants.S_IRWXO;
} else {
mask = constants.default.S_IRWXU | constants.default.S_IRWXG | constants.default.S_IRWXO;
}
And it works fine on node 6.3
240e9c9
to
b06b140
Compare
Add 'copyPermissions: true' to the entry for the files to enable.
b06b140
to
7e04f9c
Compare
Just to be safe.
options.copyPermissions
)
@deryni Please rebase to latest master before we can triage this further :) |
Closing due to inactivity, feel free to reopen :) |
@michael-ciniawsky can't you retrieve its commits and do the rebase on your own? |
@j0k3r Feel free to open a PR with these changes. This still needs review, e.g does it really need to be an option or could it be a default instead etc ? :) |
Add support for copying permissions for copied files.
Use a
copyPermissions: true
key in a copy pattern to turn it on.Should resolve #35.