UNPKG

hasura-console

Version:

A package that automatically installs and wraps Hasura CLI binary in isolated manner

45 lines (44 loc) 2.24 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const chalk_1 = __importDefault(require("chalk")); const install_1 = require("./install"); const { name, bugs: { url: issueUrl }, } = require('../package.json'); const HASURA_CLI_INSTALL = !process.env.HASURA_CLI_INSTALL || process.env.HASURA_CLI_INSTALL === 'true'; if (HASURA_CLI_INSTALL) { ; (() => __awaiter(void 0, void 0, void 0, function* () { try { yield install_1.install({ verbose: true, }); } catch (err) { console.log(chalk_1.default ` {bold.bgRed.white hasura-console}@{red ${install_1.versionFromPackageJson}} {red Error!} Failed to install {bold Hasura CLI binary}. Try {bold.bgWhite.black npm uninstall ${name}} or {bold.bgWhite.black yarn remove ${name}} and then reinstall it. If the issue occurs repeatedly, check if your network can access {bold https://github.com} as the the {bold Hasura CLI binary} file is hosted on Github. You can report the issue on {bold ${issueUrl}} with error message. `); throw err; } }))(); } else { console.log(chalk_1.default ` {bold.bgGreen.black hasura-console}@{green ${install_1.versionFromPackageJson}} {blue process}.{magentaBright env}.{bold.cyan HASURA_CLI_INSTALL} is {bold ${`${HASURA_CLI_INSTALL}`}}, therefore {bold hasura-console} doesn't do anything. `); }