UNPKG

make-deno-edition

Version:

Automatically makes package.json projects (such as npm packages and node.js modules) compatible with Deno.

61 lines (60 loc) 2.77 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const get_cli_arg_1 = __importDefault(require("get-cli-arg")); const index_js_1 = require("./index.js"); const color = __importStar(require("./color.js")); async function bin() { const travis = Boolean(process.env.TRAVIS_BUILD_WEB_URL); const run = get_cli_arg_1.default('run') ?? !travis; const verbose = get_cli_arg_1.default('verbose'); const attempt = get_cli_arg_1.default('attempt'); try { const details = await index_js_1.make({ run }); if (details.success) { console.log(color.success('make-deno-edition: SUCCESS!')); console.log(`\nThe deno edition was ${color.success('created successfully')}, without any errors:`); index_js_1.inform(details, verbose ?? travis); } else if (attempt) { // ignore failure console.log(color.special('make-deno-edition: OK!')); console.log(`\nThe ${color.special('optional')} deno edition ${color.warn('could not be created')} for the following reasons:`); index_js_1.inform(details, verbose ?? travis); } else { console.log(color.error('make-deno-edition: FAILURE!')); console.log(`\nThe required deno edition ${color.error('could not be created')} for the following reasons:`); index_js_1.inform(details, verbose ?? true); process.exitCode = 1; } } catch (err) { console.log(color.error('make-deno-edition: UNEXEPCTED FAILURE!')); console.log(`\nUnable to make the deno edition, due to ${color.error('this unexpected error')}:`); console.log(color.inspect(err)); process.exitCode = 1; } } bin();