summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--desktop/packages/mullvad-vpn/tasks/utils.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/desktop/packages/mullvad-vpn/tasks/utils.js b/desktop/packages/mullvad-vpn/tasks/utils.js
index 04fefafd00..0b40022d53 100644
--- a/desktop/packages/mullvad-vpn/tasks/utils.js
+++ b/desktop/packages/mullvad-vpn/tasks/utils.js
@@ -39,6 +39,22 @@ async function removeRecursively(path) {
});
}
+async function runNpmScript(scriptName) {
+ const command = `npm run ${scriptName}`;
+
+ try {
+ await runCommand(command);
+ } catch (errors) {
+ if (Array.isArray(errors)) {
+ // Remove first error as it will always
+ // bubble up and be printed to the console.
+ errors.slice(1).forEach((error) => {
+ console.error(new Error(error));
+ });
+ }
+ }
+}
+
async function runCommand(command) {
return new Promise((resolve, reject) => {
childProcess.exec(command, (error, stdout, stderr) => {
@@ -59,4 +75,5 @@ exports.copyRecursively = copyRecursively;
exports.getCopyExtensionFilter = getCopyExtensionFilter;
exports.removeRecursively = removeRecursively;
exports.runCommand = runCommand;
+exports.runNpmScript = runNpmScript;
exports.setNodeEnvironment = setNodeEnvironment;