UNPKG

buildsize-cli

Version:
31 lines 1.92 kB
"use strict"; var shell = require('shelljs'); var emojiMsg = require('node-emoji'); var colors = require('colors-cli/safe'); var buildTypeArg = process === null || process === void 0 ? void 0 : process.argv[3]; var buildType = "node dist/src/index.js --config __mocks__/".concat(buildTypeArg); shell.exec(buildType, { silent: true }, function (code, stdout) { if (buildTypeArg === 'valid') { var validMsgCount = stdout.split('success').length; var warnMsgCount_1 = stdout.split('warning').length; // ensure we are successful and warning the needed console.warn("".concat(stdout, "\n\n - code: ").concat(code, "\n - validMsgCount: ").concat(validMsgCount, "\n - warnMsgCount: ").concat(warnMsgCount_1, ", ")); if (code !== 0 || validMsgCount !== 6 || warnMsgCount_1 !== 2) { console.log("".concat(emojiMsg.get('x'), " - ").concat(colors.red('Invalid exit code or size message returned'), "\n\n")); return shell.exit(1); } // console.log(`${emojiMsg.get('thumbsup')} - ${colors.green('Valid exit code and size message returned')}\n\n`); return console.log(stdout); } var invalidMsgCount = stdout.split('failure').length; var warnMsgCount = stdout.split('warning').length; // ensure we are failing and warning the needed console.warn("code: ".concat(code, "\n - invalidMsgCount: ").concat(invalidMsgCount, "\n - warnMsgCount: ").concat(warnMsgCount, ", ")); if (code !== 1 || invalidMsgCount !== 6 || warnMsgCount !== 2) { console.log("".concat(emojiMsg.get('x'), " - ").concat(colors.red('Invalid exit code or size message returned'), "\n\n")); return shell.exit(1); } // console.log(`${emojiMsg.get('thumbsup')} - ${colors.green('Valid exit code and size message returned')}\n\n`); return console.log(stdout); }); //# sourceMappingURL=scripts.js.map