UNPKG

sui-direct

Version:

Decentralized version control system on SUI blockchain

37 lines (36 loc) 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = require("path"); const https_1 = require("https"); const fs_1 = require("fs"); const colors_1 = require("./utils/colors"); const os_1 = require("./utils/os"); const binDir = (0, path_1.join)(__dirname, "..", "bin"); let dest = (0, path_1.join)(binDir, "vcs.bin"); (0, os_1.Windows)(() => { dest = (0, path_1.join)(binDir, "vcs.exe"); }); const file = (0, fs_1.createWriteStream)(dest); const installation = (res) => { var _a, _b; if (["4", "5", undefined].includes((_b = (_a = res.statusCode) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b[0])) { console.log(colors_1.colorize.errorIcon("Could not download direct-vcs. Please check your internet connection or try again later.")); process.exit(1); } res.pipe(file); file.on("finish", () => { file.close(); (0, fs_1.chmodSync)(dest, 0o755); console.log(colors_1.colorize.successIcon("direct-vcs installed successfully!")); }); }; // Install version control (0, os_1.Windows)(() => { (0, https_1.get)("https://github.com/sui-direct/vcs/releases/download/v0.1.0/direct.exe", installation); }); (0, os_1.Linux)(() => { (0, https_1.get)("https://github.com/sui-direct/vcs/releases/download/v0.1.0/direct.bin", installation); }); (0, os_1.MacOS)(() => { (0, https_1.get)("https://github.com/sui-direct/vcs/releases/download/v0.1.0/direct.bin", installation); });