2016-06-03 16:08:03 -04:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2016-09-06 16:40:57 -04:00
|
|
|
function isWebpackDevServer () {
|
|
|
|
return process.argv[1] && !!(/webpack-dev-server$/.exec(process.argv[1]))
|
|
|
|
}
|
|
|
|
|
2016-06-03 16:08:03 -04:00
|
|
|
function root (args) {
|
|
|
|
args = Array.prototype.slice.call(arguments, 0)
|
|
|
|
return path.join.apply(path, [ROOT].concat(args))
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.hasProcessFlag = hasProcessFlag
|
2016-09-06 16:40:57 -04:00
|
|
|
exports.isWebpackDevServer = isWebpackDevServer
|
2016-06-03 16:08:03 -04:00
|
|
|
exports.root = root
|