permissions-plugin.ts 506 Bytes
Newer Older
Bruce MacDonald's avatar
Bruce MacDonald committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import chmodr from 'chmodr'
import * as path from 'path'

interface PluginOptions {
  resourcePath: string
}

class PermissionsPlugin {
  options: PluginOptions

  constructor(options: PluginOptions) {
    this.options = options
  }

  apply(compiler: any) {
    compiler.hooks.afterEmit.tap('PermissionsPlugin', () => {
      chmodr(path.join(this.options.resourcePath), 0o755, err => {
        // this fails on the first call to suppress the error
      })
    })
  }
}

export default PermissionsPlugin