1
0
Fork 0
peertube/client/webpack/helpers.js

28 lines
674 B
JavaScript
Raw Permalink Normal View History

const path = require('path')
2017-01-13 11:16:00 +00:00
// Helper functions
const ROOT = path.resolve(__dirname, '..')
2017-01-13 11:16:00 +00:00
const EVENT = process.env.npm_lifecycle_event || ''
function hasProcessFlag (flag) {
return process.argv.join('').indexOf(flag) > -1
}
2017-01-13 11:16:00 +00:00
function hasNpmFlag (flag) {
return EVENT.includes(flag)
}
2016-09-06 20:40:57 +00:00
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
2017-01-13 11:16:00 +00:00
exports.hasNpmFlag = hasNpmFlag
2016-09-06 20:40:57 +00:00
exports.isWebpackDevServer = isWebpackDevServer
exports.root = root