semantic-release-discord-bot
Version:
A discord bot for semantic-release library notifying release statuses
19 lines (18 loc) • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.verifyConditions = void 0;
var constants_1 = require("./common/constants");
var SemanticReleaseError = require("@semantic-release/error");
function verifyConditions(config, _a) {
var logger = _a.logger, env = _a.env;
var botToken = process.env[constants_1.DISCORD_WEBHOOK];
if (!botToken) {
logger.log(constants_1.DISCORD_WEBHOOK + " has not been defined.");
throw new SemanticReleaseError('No Discrod Webhook defined.', 'ENODISCORDWEBHOOK', "A Discord Webhook must be set in the `" + constants_1.DISCORD_WEBHOOK + "` environment variable on your CI environment.\n\n\nPlease make sure you created a token and to sat it in the `" + constants_1.DISCORD_WEBHOOK + "` environment variable on your CI environment.");
}
if (!env.npm_package_name && !config.packageName && !env[constants_1.TG_BOT_PACKAGE_NAME]) {
logger.log('npm package name, config packageName and SEMANTIC_RELEASE_PACKAGE name are undefined');
throw new SemanticReleaseError('No name for the package defined.', 'ENOPACKAGENAME', "A name for the package must be created. Define packageName in the plugin config or '" + constants_1.TG_BOT_PACKAGE_NAME + "' in the environment");
}
}
exports.verifyConditions = verifyConditions;