Resume data is loaded from resume/<slug>.yml via RESUME_NAME (default dobkin), with per-slug profile photos and webpack alias wiring. Export and preview honor the slug; package scripts add convenience dev/export targets. Add ai-bw layout and preview asset, cherepaha profile, and experience legend metadata on green and purple. When birth year is omitted, cool and material-dark themes show "Based in" instead of "Born" so birth.location can mean current location. README documents the new workflow and fixes export wording. Made-with: Cursor
61 lines
1.8 KiB
JavaScript
61 lines
1.8 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* Export one resume YAML (resume/<slug>.yml) through one Vue template to pdf/<template>-<slug>.pdf
|
||
*
|
||
* Usage:
|
||
* node scripts/export-cli.js <resume-slug> [template]
|
||
* npm run export:bw -- cherepaha
|
||
* npm run export:bw -- dobkin green
|
||
*
|
||
* Default template: ai-bw
|
||
*
|
||
* Optional: PDF_SCALE=0.95 (0.1–2) slightly shrinks the PDF if you still need to squeeze to 2 pages.
|
||
*/
|
||
|
||
const { spawnSync } = require('child_process');
|
||
const fs = require('fs');
|
||
const path = require('path');
|
||
|
||
const repoRoot = path.join(__dirname, '..');
|
||
|
||
const slug = (process.argv[2] || '').trim().toLowerCase();
|
||
const template = (process.argv[3] || 'ai-bw').trim().replace(/\.vue$/i, '').toLowerCase();
|
||
|
||
if (!slug) {
|
||
console.error('Usage: node scripts/export-cli.js <resume-slug> [template]');
|
||
console.error('');
|
||
console.error('Examples:');
|
||
console.error(' npm run export:bw -- cherepaha');
|
||
console.error(' npm run export:bw -- dobkin');
|
||
console.error(' node scripts/export-cli.js cherepaha green');
|
||
console.error('');
|
||
console.error('Resume data: resume/<slug>.yml Output: pdf/<template>-<slug>.pdf');
|
||
process.exit(1);
|
||
}
|
||
|
||
const yml = path.join(repoRoot, 'resume', slug + '.yml');
|
||
if (!fs.existsSync(yml)) {
|
||
console.error('Missing resume data file: ' + yml);
|
||
process.exit(1);
|
||
}
|
||
|
||
const vuePath = path.join(repoRoot, 'src', 'resumes', template + '.vue');
|
||
if (!fs.existsSync(vuePath)) {
|
||
console.error('Unknown template (no file): ' + vuePath);
|
||
process.exit(1);
|
||
}
|
||
|
||
const r = spawnSync(
|
||
'npx',
|
||
['concurrently', 'npm run dev', `node scripts/export.js ${template}`, '--success', 'first', '--kill-others', '--raw'],
|
||
{
|
||
cwd: repoRoot,
|
||
env: Object.assign({}, process.env, { RESUME_NAME: slug }),
|
||
stdio: 'inherit'
|
||
}
|
||
);
|
||
|
||
const code = typeof r.status === 'number' ? r.status : 1;
|
||
process.exit(code);
|