md-generator
Version:
NPM Package which bootstraps Development by creating all required .md files to meet community standards.
45 lines (44 loc) • 2.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var pad_1 = tslib_1.__importDefault(require("pad"));
var projectInfo_1 = tslib_1.__importDefault(require("../../../projectEnv/projectInfo"));
var index_1 = require("../../../common/index");
var actionsUtils_1 = require("../actionsUtils");
var check = function (file) {
Object.keys(file).forEach(function (key) {
if (!file[key].exists) {
return index_1.log(pad_1.default(index_1.red(' X '), 12), index_1.gray(pad_1.default("" + file[key].name, 27), 'Not found'));
}
return index_1.log(pad_1.default(index_1.green(' √ '), 12), index_1.dimWhite(pad_1.default("" + file[key].name, 28)), 'exists');
});
index_1.log('\n');
};
var checkHandler = function (values) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var spin, required, optional, all;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
spin = index_1.spinner('Checking for all Required / Optional .md files . . .');
required = values.required, optional = values.optional;
all = !optional && !required;
return [4, projectInfo_1.default().then(function (projectInfos) {
spin.succeed('Done');
var githubUsername = projectInfos.githubUsername, name = projectInfos.name;
if (required || all) {
index_1.log(index_1.whiteUnderline('Required Files :\n'));
check(actionsUtils_1.requiredFiles);
}
if (optional || all) {
index_1.log(index_1.whiteUnderline('Optional Files :\n'));
check(actionsUtils_1.optionalFiles);
}
index_1.checkCommunityStandardMet(githubUsername, name);
})];
case 1:
_a.sent();
return [2];
}
});
}); };
exports.default = checkHandler;