Client: fix prod build process
[oweals/peertube.git] / client / config / helpers.js
1 const path = require('path')
2
3 const ROOT = path.resolve(__dirname, '..')
4
5 console.log('root directory:', root() + '\n')
6
7 function hasProcessFlag (flag) {
8   return process.argv.join('').indexOf(flag) > -1
9 }
10
11 function isWebpackDevServer () {
12   return process.argv[1] && !!(/webpack-dev-server$/.exec(process.argv[1]))
13 }
14
15 function root (args) {
16   args = Array.prototype.slice.call(arguments, 0)
17   return path.join.apply(path, [ROOT].concat(args))
18 }
19
20 exports.hasProcessFlag = hasProcessFlag
21 exports.isWebpackDevServer = isWebpackDevServer
22 exports.root = root