summary refs log tree commit diff
path: root/bundle/scripts/utils.js
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-15 11:13:21 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-15 11:13:21 +0200
commit1a94fb1208bf0e4c669cad16aff5f57dc0bf7a3c (patch)
tree1035116ddbaacc5fcc5ae250a6592eb88f78f75c /bundle/scripts/utils.js
parentDo the funny thing (make user->invite cascade delet) (diff)
parentchange dev panel path, we missed this one... (diff)
downloadserver-1a94fb1208bf0e4c669cad16aff5f57dc0bf7a3c.tar.xz
Merge branch 'dev/restructure' into staging
Diffstat (limited to 'bundle/scripts/utils.js')
-rw-r--r--bundle/scripts/utils.js53
1 files changed, 0 insertions, 53 deletions
diff --git a/bundle/scripts/utils.js b/bundle/scripts/utils.js
deleted file mode 100644

index bf960532..00000000 --- a/bundle/scripts/utils.js +++ /dev/null
@@ -1,53 +0,0 @@ -const path = require("path"); -const fs = require("fs"); -const { env } = require("process"); -const { execSync } = require("child_process"); -const { argv, stdout, exit } = require("process"); - -const parts = ["api", "util", "cdn", "gateway", "bundle"]; - -function copyRecursiveSync(src, dest) { - //if (verbose) console.log(`cpsync: ${src} -> ${dest}`); - let exists = fs.existsSync(src); - if (!exists) { - console.log(src + " doesn't exist, not copying!"); - return; - } - let stats = exists && fs.statSync(src); - let isDirectory = exists && stats.isDirectory(); - if (isDirectory) { - fs.mkdirSync(dest, { recursive: true }); - fs.readdirSync(src).forEach(function (childItemName) { - copyRecursiveSync( - path.join(src, childItemName), - path.join(dest, childItemName) - ); - }); - } else { - fs.copyFileSync(src, dest); - } -} - -function execIn(cmd, workdir) { - try { - return execSync(cmd, { - cwd: workdir, - shell: true, - env: process.env, - encoding: "utf-8", - }); - } catch (error) { - return error.stdout; - } -} - -function getLines(output) { - return output.split("\n").length; -} - -module.exports = { - //consts - parts, - //functions - copyRecursiveSync, execIn, getLines -};