feat(assets): pull specific branch for assets if specified

This commit is contained in:
Paul 2021-10-23 16:00:20 +01:00
parent 5e0c8e0444
commit d8f2cac171

View file

@ -4,6 +4,7 @@ const { exec: cexec } = require("child_process");
const { resolve } = require("path");
let target = process.env.REVOLT_SASS;
let branch = process.env.REVOLT_SASS_BRANCH;
let DEFAULT_DIRECTORY = "public/assets_default";
let OUT_DIRECTORY = "public/assets";
@ -29,7 +30,8 @@ function exec(command) {
} catch (err) {}
if (target) {
await exec(`git clone ${target} ${OUT_DIRECTORY}`);
let arg = branch ? `-b ${branch}` : "";
await exec(`git clone ${arg}${target} ${OUT_DIRECTORY}`);
await exec(`rm -rf ${resolve(OUT_DIRECTORY, ".git")}`);
} else {
await copy(DEFAULT_DIRECTORY, OUT_DIRECTORY);