permissions-plugin.ts 506 B

123456789101112131415161718192021222324
  1. import chmodr from 'chmodr'
  2. import * as path from 'path'
  3. interface PluginOptions {
  4. resourcePath: string
  5. }
  6. class PermissionsPlugin {
  7. options: PluginOptions
  8. constructor(options: PluginOptions) {
  9. this.options = options
  10. }
  11. apply(compiler: any) {
  12. compiler.hooks.afterEmit.tap('PermissionsPlugin', () => {
  13. chmodr(path.join(this.options.resourcePath), 0o755, err => {
  14. // this fails on the first call to suppress the error
  15. })
  16. })
  17. }
  18. }
  19. export default PermissionsPlugin