component-dependency-collapser
Version:
📦 Component Dependency Collapser is a CLI tool that helps you analyze, visualize, and trace the dependency structure of your frontend components
29 lines (28 loc) • 1.28 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const analyzer_1 = require("./analyzer");
const chalk_1 = __importDefault(require("chalk"));
const path_1 = __importDefault(require("path"));
const program = new commander_1.Command();
program
.name('component-dependency-collapser')
.description('Collapse and analyze dependencies of frontend components')
.version('1.0.3');
program
.argument('<Dir>', 'directory')
.option('--tree', 'Show nested tree of dependencies')
.option('--external-only', 'Only show external packages')
.option('--find <package>', 'Find which components use a specific package')
.option('--trace <target>', 'Trace import chains to a target module/package')
.option('--size', 'Show size of components and their dependencies')
.action(async (Dir, options) => {
const absolutePath = path_1.default.resolve(process.cwd(), Dir);
console.log(chalk_1.default.blue(`Analyzing: ${absolutePath}`));
await (0, analyzer_1.analyzeComponent)(absolutePath, options);
});
program.parse();