UNPKG

appxloop

Version:

AppXLoop The Future of Continuous App Deployment & Management

41 lines (34 loc) 1.25 kB
#!/usr/bin/env node const os = require("os"); const { execSync } = require("child_process"); const path = require("path"); // Access command-line arguments const args = process.argv.slice(2); // Ignore first two arguments (node and script name) console.log("Arguments:", args); // Define the path based on the operating system const platform = os.platform(); let binaryPath = ""; if (platform === "win32") { binaryPath = path.join(__dirname,'appxloop','Publish','win', 'Appxloop.Distribute.exe'); } else if (platform === "linux") { binaryPath = path.join(__dirname,'appxloop', 'Publish','linux', 'Appxloop.Distribute'); } else if (platform === "darwin") { binaryPath = path.join(__dirname,'appxloop', 'Publish','macos', 'Appxloop.Distribute'); } else { console.error("Unsupported OS"); process.exit(1); } // Ensure that the correct file exists const fs = require("fs"); if (!fs.existsSync(binaryPath)) { console.error("Executable not found:", binaryPath); process.exit(1); } // Pass the arguments to the executable try { // Example: pass the arguments to the .NET executable execSync(`${binaryPath} ${args.join(" ")}`, { stdio: "inherit" }); } catch (err) { console.error("Execution failed:", err); process.exit(1); }