UNPKG

declapract

Version:

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

37 lines 1.77 kB
"use strict"; 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 = async ({ usePracticesConfigPath, filter, }) => { // read the usage config console.log('🔎 reading configs and declarations...'); // tslint:disable-line: no-console const config = await (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 = await (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 = await (0, filterPracticeEvaluationsFromPlans_1.filterPracticeEvaluationsFromPlans)({ plans, filter: { byPracticeNames: filter?.practiceNames ?? undefined, byFilePaths: filter?.filePaths ?? undefined, }, }); // display the plans await (0, displayPlans_1.displayPlans)({ plans: plansToDisplay }); }; exports.plan = plan; //# sourceMappingURL=plan.js.map