@thecodingwhale/cv-processor
Version:
CV Processor to extract structured data from PDF resumes using TypeScript
47 lines (46 loc) • 1.86 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const renderCharts_1 = require("../utils/renderCharts");
async function main() {
const args = process.argv.slice(2);
if (args.length < 1) {
console.error('Usage: render-charts.ts <report-path> [--html]');
process.exit(1);
}
const reportPath = args[0];
const generateHtml = args.includes('--html');
if (!fs_1.default.existsSync(reportPath)) {
console.error(`Report file not found: ${reportPath}`);
process.exit(1);
}
// Create output directory for charts
const baseDir = path_1.default.dirname(reportPath);
const outputDir = path_1.default.join(baseDir, 'charts');
console.log(`Rendering charts from ${reportPath}...`);
if (generateHtml) {
// Generate HTML report with embedded chart images
const htmlPath = await (0, renderCharts_1.createHtmlReport)(reportPath, outputDir);
console.log(`HTML report with embedded charts created at: ${htmlPath}`);
}
else {
// Just render the chart images
const chartPaths = await (0, renderCharts_1.renderChartsFromReport)(reportPath, outputDir);
if (chartPaths.length > 0) {
console.log(`Successfully rendered ${chartPaths.length} charts to ${outputDir}:`);
chartPaths.forEach((chartPath) => console.log(`- ${chartPath}`));
}
else {
console.log('No charts were found or rendered.');
}
}
}
main().catch((error) => {
console.error('Error rendering charts:', error);
process.exit(1);
});