How to use the shipjs-lib.exec function in shipjs-lib

To help you get started, we’ve selected a few shipjs-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / shipjs / packages / shipjs / src / util / wrapExecWithDir.js View on Github external
return (command, opts = {}) => {
    exec(command, {
      dir,
      ...opts,
    });
  };
}
github algolia / shipjs / packages / shipjs / src / util / run.js View on Github external
command,
  dir,
  dryRun = false,
  printCommand = true,
  silent = false,
}) => {
  if (!dir) {
    throw new Error('`dir` is missing');
  }
  if (printCommand) {
    print(`$ ${command}`);
  }
  if (dryRun) {
    return;
  }
  const { code } = exec(command, { dir, silent });
  if (code !== 0) {
    if (printCommand) {
      print(error('The following command failed:'));
      print(`  > ${command}`);
    } else {
      print(error('Command failed'));
    }
    exitProcess(1);
  }
};