aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config/helpers.js
blob: 6268d2628fbfdf067e1e7a773e6f6c83f29a4216 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const path = require('path')

const ROOT = path.resolve(__dirname, '..')

console.log('root directory:', root() + '\n')

function hasProcessFlag (flag) {
  return process.argv.join('').indexOf(flag) > -1
}

function isWebpackDevServer () {
  return process.argv[1] && !!(/webpack-dev-server$/.exec(process.argv[1]))
}

function root (args) {
  args = Array.prototype.slice.call(arguments, 0)
  return path.join.apply(path, [ROOT].concat(args))
}

exports.hasProcessFlag = hasProcessFlag
exports.isWebpackDevServer = isWebpackDevServer
exports.root = root