]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/webpack/helpers.js
Bumped to version v5.2.1
[github/Chocobozzz/PeerTube.git] / client / webpack / helpers.js
... / ...
CommitLineData
1const path = require('path')
2
3// Helper functions
4const ROOT = path.resolve(__dirname, '..')
5const EVENT = process.env.npm_lifecycle_event || ''
6
7function hasProcessFlag (flag) {
8 return process.argv.join('').indexOf(flag) > -1
9}
10
11function hasNpmFlag (flag) {
12 return EVENT.includes(flag)
13}
14
15function isWebpackDevServer () {
16 return process.argv[1] && !!(/webpack-dev-server$/.exec(process.argv[1]))
17}
18
19function root (args) {
20 args = Array.prototype.slice.call(arguments, 0)
21 return path.join.apply(path, [ROOT].concat(args))
22}
23
24exports.hasProcessFlag = hasProcessFlag
25exports.hasNpmFlag = hasNpmFlag
26exports.isWebpackDevServer = isWebpackDevServer
27exports.root = root