aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/webpack/helpers.js
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-12 11:38:02 +0100
committerChocobozzz <me@florianbigard.com>2017-12-12 11:42:48 +0100
commit7bfd1b1edb7ea4ea6516b6a74c4e9af938d0bdc6 (patch)
tree722781d5d89fe438e7491da7e9d09dedd8c82a74 /client/webpack/helpers.js
parent63c4db6d71b98523753c51747e308682d9a2e8a0 (diff)
downloadPeerTube-7bfd1b1edb7ea4ea6516b6a74c4e9af938d0bdc6.tar.gz
PeerTube-7bfd1b1edb7ea4ea6516b6a74c4e9af938d0bdc6.tar.zst
PeerTube-7bfd1b1edb7ea4ea6516b6a74c4e9af938d0bdc6.zip
Upgrade scripts and embed webpack config
Diffstat (limited to 'client/webpack/helpers.js')
-rw-r--r--client/webpack/helpers.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/client/webpack/helpers.js b/client/webpack/helpers.js
new file mode 100644
index 000000000..ca5923472
--- /dev/null
+++ b/client/webpack/helpers.js
@@ -0,0 +1,27 @@
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