UNPKG

@zohodesk/client_build_tool

Version:

A CLI tool to build web applications and client libraries

46 lines (34 loc) 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.httpsOptionsWithUserFriendlyError = httpsOptionsWithUserFriendlyError; var _logger = require("../../logger"); var _requireLocalOrGlobal = require("../utils/requireLocalOrGlobal"); const defaultCertNpm = '@zohodesk-private/client_dev_cert'; function httpsOptionsWithUserFriendlyError(options) { const { httpsCerts } = options.server; if (typeof httpsCerts === 'string' && httpsCerts) { const certificate = (0, _requireLocalOrGlobal.requireAllPossible)(httpsCerts); if (certificate.local) { (0, _logger.verboseLogger)(`Local '${httpsCerts}' package taken as HTTPS certificate`); return certificate.local.httpsOptions; } if (certificate.global) { (0, _logger.messageLogger)(`Global '${httpsCerts}' package taken as HTTPS certificate`); return certificate.global.httpsOptions; } (0, _logger.errorLogger)(` You have given 'server.httpsCerts' as "${httpsCerts}". But it seems that file path have some problem;`); process.exit(0); } const globalCertificate = (0, _requireLocalOrGlobal.requireGlobal)(defaultCertNpm); if (globalCertificate) { (0, _logger.messageLogger)(`Global '${defaultCertNpm}' package taken as HTTPS certificate`); return globalCertificate.httpsOptions; } return null; }