question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Include files and directories while preserving its permissions.

See original GitHub issue

This is a Feature Proposal

Description

Including a static file or directory and preserving its original file permissions. This would be particularly useful for including binaries in the final package.

Currently the only way that I am aware of to do this, is to run a shell script that copies the files into the .webpack folder before the bundling process. But maybe this functionality can be included in this plugin.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:27 (20 by maintainers)

github_iconTop GitHub Comments

7reactions
fantapopcommented, Dec 31, 2017

As a work around for this issue I was able to use the on-build-webpack plugin to manually fix the files after the webpack build. In my case I’m just adding executable permissions to everything passing through that has .exe for an extension.

const WebpackOnBuildPlugin = require('on-build-webpack');

...

module.exports = {

...

    plugins: [
        new WebpackOnBuildPlugin(fixExecutablePermissions),
    ],

...

function fixExecutablePermissions(stats) {
    for (const filename in stats.compilation.assets) {
        if (filename.endsWith('.exe')) {
            const basePath = stats.compilation.outputOptions.path;
            const fullPath = `${basePath}/${filename}`;
            fs.chmodSync(fullPath, '755');
        }
    }
}
2reactions
boazdejongcommented, Sep 21, 2017

There is still a lot to do, but this is the forked plugin: webpack-plugin-copy The permissions copy seems to work, but I still need to write the tests.

Any pull requests are welcome. I’ll do my best to actively maintain the package.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Preserve File Permissions While Copying Files in Linux
Want to retain file permissions while copying files on Linux? Here's how to do it using cp and rsync.
Read more >
How do I copy a folder keeping owners and permissions intact?
It works, but Patience is Good here. The command will only set everything right when it finishes: While it's still copying a directory,...
Read more >
Permissions when you copy and move files - Windows Client
To preserve permissions when files and folders are copied or moved, use the Xcopy.exe utility with the /O or the /X switch. The...
Read more >
Copying a directory by retaining its permission - Super User
Press F for file and press D for directory. You can press D here. This will create a new directory and copy all...
Read more >
Preserve file permissions and ownership with cp command
In this tutorial, we show the cp command you can use on a Linux system to preserve file permissions and ownership when copying...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found