mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-26 02:30:37 -06:00
28 lines
674 B
JavaScript
28 lines
674 B
JavaScript
const path = require('path')
|
|
|
|
// Helper functions
|
|
const ROOT = path.resolve(__dirname, '..')
|
|
const EVENT = process.env.npm_lifecycle_event || ''
|
|
|
|
function hasProcessFlag (flag) {
|
|
return process.argv.join('').indexOf(flag) > -1
|
|
}
|
|
|
|
function hasNpmFlag (flag) {
|
|
return EVENT.includes(flag)
|
|
}
|
|
|
|
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.hasNpmFlag = hasNpmFlag
|
|
exports.isWebpackDevServer = isWebpackDevServer
|
|
exports.root = root
|