@rudderhq/cli 0.2.1-canary.4 → 0.2.1-canary.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6544,9 +6544,25 @@ function runChecked(command, args, options = {}) {
6544
6544
  const output = [result.stdout, result.stderr].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
6545
6545
  throw new Error(`${command} ${args.join(" ")} failed${output ? `: ${output}` : ""}`);
6546
6546
  }
6547
+ function formatCommandFailure(command, args, stdout, stderr) {
6548
+ const output = [stdout, stderr].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
6549
+ return `${command} ${args.join(" ")} failed${output ? `: ${output}` : ""}`;
6550
+ }
6547
6551
  function powershellQuote(value) {
6548
6552
  return `'${value.replaceAll("'", "''")}'`;
6549
6553
  }
6554
+ function buildWindowsZipExtractCommand(zipPath, outputDir) {
6555
+ return { command: "tar.exe", args: ["-xf", zipPath, "-C", outputDir] };
6556
+ }
6557
+ function buildWindowsRobocopyMirrorCommand(sourcePath, destinationPath) {
6558
+ return {
6559
+ command: "robocopy.exe",
6560
+ args: [sourcePath, destinationPath, "/MIR", "/R:2", "/W:1", "/NFL", "/NDL", "/NJH", "/NJS", "/NP"]
6561
+ };
6562
+ }
6563
+ function isSuccessfulRobocopyExitCode(status) {
6564
+ return typeof status === "number" && status >= 0 && status <= 7;
6565
+ }
6550
6566
  async function extractZip(zipPath, outputDir, target) {
6551
6567
  await rm(outputDir, { recursive: true, force: true });
6552
6568
  await mkdir2(outputDir, { recursive: true });
@@ -6555,13 +6571,8 @@ async function extractZip(zipPath, outputDir, target) {
6555
6571
  return;
6556
6572
  }
6557
6573
  if (target.platform === "windows") {
6558
- runChecked("powershell.exe", [
6559
- "-NoProfile",
6560
- "-ExecutionPolicy",
6561
- "Bypass",
6562
- "-Command",
6563
- `Expand-Archive -LiteralPath ${powershellQuote(zipPath)} -DestinationPath ${powershellQuote(outputDir)} -Force`
6564
- ]);
6574
+ const command = buildWindowsZipExtractCommand(zipPath, outputDir);
6575
+ runChecked(command.command, command.args);
6565
6576
  return;
6566
6577
  }
6567
6578
  throw new Error(`Zip assets are not supported for ${target.platform}.`);
@@ -6707,6 +6718,16 @@ async function installPortableDesktop(installerPath, paths, target) {
6707
6718
  }
6708
6719
  }
6709
6720
  async function copyPortableAppBundle(sourcePath, destinationPath) {
6721
+ if (process.platform === "win32") {
6722
+ await mkdir2(destinationPath, { recursive: true });
6723
+ const command = buildWindowsRobocopyMirrorCommand(sourcePath, destinationPath);
6724
+ const result = spawnSync3(command.command, command.args, {
6725
+ encoding: "utf8",
6726
+ stdio: ["ignore", "pipe", "pipe"]
6727
+ });
6728
+ if (isSuccessfulRobocopyExitCode(result.status)) return;
6729
+ throw new Error(formatCommandFailure(command.command, command.args, result.stdout, result.stderr));
6730
+ }
6710
6731
  await cp(sourcePath, destinationPath, { recursive: true, verbatimSymlinks: true });
6711
6732
  }
6712
6733
  async function removeMacQuarantine(paths, target) {