Copy-webpack-plugin: [Feature] keeping original whole or partial stats

Created on 19 Apr 2016  路  10Comments  路  Source: webpack-contrib/copy-webpack-plugin

We have cordova hooks in our source folder (see the cordova hooks guide for more info: https://cordova.apache.org/docs/en/dev/guide/appdev/hooks/) that need to be copied into our destination folder and need to preserve the executable bit on their file mode (i.e. ls -l should print -rwxr-xr-x for these files).

Currently this doesn't happen, but it seems like it should be easy to do by passing a options object as a 3rd parameter to the to the fs.writeFileAsync() call in the writeFilePromises with the stat.mode from the fs.statAsync() call.

Community help wanted 5 (nice to have) Minor Feature

Most helpful comment

To work around the issue, I've implemented this plugin https://github.com/GeKorm/webpack-permissions-plugin

It executes during the 'done' phase in the webpack lifecycle.

All 10 comments

I'm trying to implement this on my fork, but it doesn't seem to be working.

I'm happy to make the PR but I need a bit of guidance.

The difficulty is in how we copy the files. By default, we add the files by adding them to compilation.assets and letting webpack take care of writing the files. The only time we write files with fs.writeFileAsync() is when a devServer is used (due to limitations of the server).

It's possible that this feature could piggyback on the additions needed for #15. That feature also requires fs.writeFileAsync for every file.

@evilebottnawi This issue is a bug on linux and macOS, ie 2 out of 3 major operating systems. It would be nice if you recognized @michael-ciniawsky 's tags and this issue's importance. Node can't spawn()/exec()/etc a copied file while this bug exists.

@davepuchyr it is require to do PR in webpack-sources, by default webpack can not works with permissions

Thanks for enlightening me and for the plugin.

Maybe something in the direction of https://github.com/webpack-contrib/copy-webpack-plugin/pull/119 would be sufficient enough/in the meantime

To work around the issue, I've implemented this plugin https://github.com/GeKorm/webpack-permissions-plugin

It executes during the 'done' phase in the webpack lifecycle.

Please make this happen. Great plugin but a pain in the ass to set the permissions afterwards ...

To work around the issue, I've implemented this plugin https://github.com/GeKorm/webpack-permissions-plugin

It executes during the 'done' phase in the webpack lifecycle.

@socialcode-rob1 How did you get the two to work in tandem? I've tried the webpack-permissions-plugin but it always seems to fire before the copy-webpack-plugin. I'm trying to get the webpack-permissions-plugin to fire after the copy-webpack-plugin has run such that the permissions are updated on the target files.

Should this not be the default behavior of any copy functionality?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jdeniau picture jdeniau  路  5Comments

dmarcautan picture dmarcautan  路  5Comments

padinko picture padinko  路  3Comments

ietabhi picture ietabhi  路  5Comments

Jocs picture Jocs  路  4Comments