UNPKG

declapract

Version:

A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.

47 lines 2.68 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.plan = void 0; const displayPlans_1 = require("../usage/plan/display/displayPlans"); const filterPracticeEvaluationsFromPlans_1 = require("../usage/plan/filterPracticeEvaluationsFromPlans"); const getPlansForProject_1 = require("../usage/plan/getPlansForProject"); const readUsePracticesConfig_1 = require("../usage/readUsePracticesConfig"); const getScopedPractices_1 = require("./getScopedPractices"); const plan = (_a) => __awaiter(void 0, [_a], void 0, function* ({ usePracticesConfigPath, filter, }) { var _b, _c; // read the usage config console.log('🔎 reading configs and declarations...'); // tslint:disable-line: no-console const config = yield (0, readUsePracticesConfig_1.readUsePracticesConfig)({ configPath: usePracticesConfigPath, }); // grab the desired practices const practices = (0, getScopedPractices_1.getDesiredPractices)({ config, filter }); // get the plans console.log('🔬️ evaluating project...'); // tslint:disable-line: no-console const plans = yield (0, getPlansForProject_1.getPlansForProject)({ practices, projectRootDirectory: config.rootDir, projectVariables: config.variables, }); // filter the plans console.log('📖 displaying results...'); // tslint:disable-line: no-console const plansToDisplay = yield (0, filterPracticeEvaluationsFromPlans_1.filterPracticeEvaluationsFromPlans)({ plans, filter: { byPracticeNames: (_b = filter === null || filter === void 0 ? void 0 : filter.practiceNames) !== null && _b !== void 0 ? _b : undefined, byFilePaths: (_c = filter === null || filter === void 0 ? void 0 : filter.filePaths) !== null && _c !== void 0 ? _c : undefined, }, }); // display the plans yield (0, displayPlans_1.displayPlans)({ plans: plansToDisplay }); }); exports.plan = plan; //# sourceMappingURL=plan.js.map