UNPKG

@adso-ts/badges

Version:
25 lines (24 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var yargs_1 = require("yargs"); var fs_1 = require("fs"); var lodash_1 = require("lodash"); var helpers_1 = require("./helpers"); var source = lodash_1.get(yargs_1.argv, 'read', 'badges.json'); var destination = lodash_1.get(yargs_1.argv, 'save', 'coverage'); if (!fs_1.existsSync(destination)) { fs_1.mkdirSync(destination); } function customBadges(customBadgesPath, badgesPath) { helpers_1.readJson(customBadgesPath, 'badges') .then(function (badges) { return lodash_1.map(badges, function (items) { lodash_1.map(items, function (badge, key) { var value = badge.value, label = badge.label, color = badge.color; var customBadge = helpers_1.generateBadge(value, color, lodash_1.upperFirst(label), true); fs_1.writeFile(badgesPath + "/" + key + ".svg", customBadge, helpers_1.logger); }); }); }); } customBadges(source, destination);