permissions-webpack-plugin
v0.1.2
Published
A Webpack plugin to set file permissions on output assets
Maintainers
Readme
permissions-webpack-plugin
A Webpack plugin that allows you to set file permissions on output assets after the build process completes.
Installation
npm install permissions-webpack-plugin --save-devUsage
Basic Usage
const { SetFilePermissionsPlugin } = require('permissions-webpack-plugin');
module.exports = {
plugins: [
new SetFilePermissionsPlugin({
rules: [
{
permissions: 0o755, // rwxr-xr-x
patterns: ['main.js', 'cli.js']
}
]
})
]
};Advanced Usage
const { SetFilePermissionsPlugin } = require('permissions-webpack-plugin');
module.exports = {
plugins: [
new SetFilePermissionsPlugin({
rules: [
{
permissions: 0o755, // Make executable
patterns: [
/^bin\/.+$/, // All files in bin/ directory
'cli.js', // Specific file
/\.sh$/ // All shell scripts
]
},
{
permissions: 0o644, // Read-write for owner, read-only for others
patterns: [
/\.json$/, // All JSON files
/\.txt$/ // All text files
]
}
]
})
]
};Limitations
- Only works with file systems that support the
chmodoperation, otherwise changes are skipped - Permissions are applied after the build completes (during the
afterEmithook)
Development
This project is built using Nx.
License
MIT
