UNPKG

declapract

Version:

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

53 lines 2.48 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 }); const core_1 = require("@oclif/core"); const apply_1 = require("../../logic/commands/apply"); // eslint-disable-next-line import/no-default-export class Apply extends core_1.Command { run() { return __awaiter(this, void 0, void 0, function* () { const { flags } = yield this.parse(Apply); const config = flags.config; // generate the code const configPath = config.slice(0, 1) === '/' ? config : `${process.cwd()}/${config}`; // if starts with /, consider it as an absolute path yield (0, apply_1.apply)({ usePracticesConfigPath: configPath, filter: flags.practice || flags.file ? { practiceNames: flags.practice ? [flags.practice] : undefined, filePaths: flags.file ? [flags.file] : undefined, } : undefined, }); }); } } Apply.description = "apply fixes to all files which have failed to adhere to any of the project's declared practices and have an automatic fix available."; Apply.flags = { help: core_1.Flags.help({ char: 'h' }), config: core_1.Flags.string({ char: 'c', description: 'path to the declapract usage config yml', required: true, default: 'declapract.use.yml', }), practice: core_1.Flags.string({ char: 'p', description: 'the name of a specific practice you want to scope checking for', }), file: core_1.Flags.string({ char: 'f', description: 'the file path of a specific file you want to scope checking for', }), }; exports.default = Apply; //# sourceMappingURL=apply.js.map