UNPKG

dependency-guardian

Version:

A powerful dependency management and analysis tool for Node.js projects

35 lines (33 loc) 860 B
class HealthScore { constructor(packageName) { this.packageName = packageName; this.scores = { security: 0, maintenance: 0, popularity: 0, performance: 0 }; this.metrics = { lastUpdate: null, issueResponseTime: null, downloadTrend: null, bundleSize: null, vulnerabilities: [], dependencies: [] }; } calculateOverallScore() { const weights = config.get('scoring.weights'); return Object.entries(this.scores) .reduce((total, [key, score]) => total + score * weights[key], 0); } async analyze() { await Promise.all([ this.analyzeSecurityScore(), this.analyzeMaintenanceScore(), this.analyzePopularityScore(), this.analyzePerformanceScore() ]); return this.calculateOverallScore(); } }