UNPKG

@featurevisor/core

Version:

Core package of Featurevisor for Node.js usage

48 lines 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findDuplicateSegmentsPlugin = void 0; exports.findDuplicateSegmentsInProject = findDuplicateSegmentsInProject; const findDuplicateSegments_1 = require("./findDuplicateSegments"); async function findDuplicateSegmentsInProject(deps, options = {}) { const duplicates = await (0, findDuplicateSegments_1.findDuplicateSegments)(deps, options); console.log(""); if (duplicates.length === 0) { console.log("No duplicate segments found"); return; } console.log(`Found ${duplicates.length} duplicate(s):\n`); duplicates.forEach((entry) => { if (options.authors) { console.log(` - Segments: ${entry.segments.join(", ")}`); console.log(` Authors: ${entry.authors && entry.authors.join(", ")}`); console.log(""); } else { console.log(` - ${entry.segments.join(", ")}`); } }); } exports.findDuplicateSegmentsPlugin = { command: "find-duplicate-segments", handler: async ({ rootDirectoryPath, projectConfig, datasource, parsed }) => { await findDuplicateSegmentsInProject({ rootDirectoryPath, projectConfig, datasource, options: parsed, }, { authors: parsed.authors, }); }, examples: [ { command: "find-duplicate-segments", description: "Find duplicate segments in the project", }, { command: "find-duplicate-segments --authors", description: "Find duplicate segments in the project and list authors", }, ], }; //# sourceMappingURL=index.js.map