90 lines
2.7 KiB
JavaScript
90 lines
2.7 KiB
JavaScript
|
|
// 로컬 node_modules 경로 추가
|
|||
|
|
const path = require('path');
|
|||
|
|
module.paths.unshift(path.join('C:/Users/aweso/.claude/skills/pptx-skill/scripts', 'node_modules'));
|
|||
|
|
|
|||
|
|
const PptxGenJS = require('pptxgenjs');
|
|||
|
|
const html2pptx = require('C:/Users/aweso/.claude/skills/pptx-skill/scripts/html2pptx.js');
|
|||
|
|
const fs = require('fs');
|
|||
|
|
|
|||
|
|
async function main() {
|
|||
|
|
const pres = new PptxGenJS();
|
|||
|
|
|
|||
|
|
// 16:9 비율 설정 (720pt × 405pt = 10" × 5.625")
|
|||
|
|
pres.defineLayout({ name: 'CUSTOM_16x9', width: 10, height: 5.625 });
|
|||
|
|
pres.layout = 'CUSTOM_16x9';
|
|||
|
|
|
|||
|
|
// 프레젠테이션 메타데이터
|
|||
|
|
pres.title = 'SAM_MES 견적관리 Storyboard';
|
|||
|
|
pres.subject = 'SAM MES 견적관리 스토리보드 D1.0';
|
|||
|
|
pres.author = 'CODE-BRIDGE X';
|
|||
|
|
pres.company = 'SAM';
|
|||
|
|
|
|||
|
|
const slidesDir = path.join(__dirname, 'slides');
|
|||
|
|
|
|||
|
|
// 견적관리 슬라이드 파일 목록 (순서대로)
|
|||
|
|
const slideFiles = [
|
|||
|
|
'estimate-01-list.html',
|
|||
|
|
'estimate-02-detail-top.html',
|
|||
|
|
'estimate-03-detail-mid.html',
|
|||
|
|
'estimate-04-detail-bottom.html',
|
|||
|
|
'estimate-05-field-desc.html',
|
|||
|
|
'estimate-06-approval-popup.html',
|
|||
|
|
'estimate-07-document-popup.html'
|
|||
|
|
];
|
|||
|
|
|
|||
|
|
let successCount = 0;
|
|||
|
|
let failCount = 0;
|
|||
|
|
const errors = [];
|
|||
|
|
|
|||
|
|
console.log('SAM_MES 견적관리 Storyboard PPTX 변환 시작...\n');
|
|||
|
|
|
|||
|
|
for (const slideFile of slideFiles) {
|
|||
|
|
const slidePath = path.join(slidesDir, slideFile);
|
|||
|
|
|
|||
|
|
if (!fs.existsSync(slidePath)) {
|
|||
|
|
console.log(`⚠️ ${slideFile}: 파일 없음`);
|
|||
|
|
failCount++;
|
|||
|
|
errors.push({ file: slideFile, error: '파일 없음' });
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
console.log(`🔄 ${slideFile} 변환 중...`);
|
|||
|
|
await html2pptx(slidePath, pres);
|
|||
|
|
console.log(`✅ ${slideFile} 완료`);
|
|||
|
|
successCount++;
|
|||
|
|
} catch (error) {
|
|||
|
|
console.log(`❌ ${slideFile}: ${error.message}`);
|
|||
|
|
failCount++;
|
|||
|
|
errors.push({ file: slideFile, error: error.message });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
console.log('\n========================================');
|
|||
|
|
console.log(`변환 결과: ${successCount}개 성공, ${failCount}개 실패`);
|
|||
|
|
|
|||
|
|
if (errors.length > 0) {
|
|||
|
|
console.log('\n실패한 슬라이드:');
|
|||
|
|
errors.forEach(({ file, error }) => {
|
|||
|
|
console.log(` - ${file}: ${error.substring(0, 100)}${error.length > 100 ? '...' : ''}`);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// PPTX 저장
|
|||
|
|
const outputDir = path.join(__dirname, 'pptx');
|
|||
|
|
if (!fs.existsSync(outputDir)) {
|
|||
|
|
fs.mkdirSync(outputDir, { recursive: true });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const outputPath = path.join(outputDir, 'SAM_MES_견적관리_Storyboard_v5.pptx');
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
await pres.writeFile({ fileName: outputPath });
|
|||
|
|
console.log(`\n📁 PPTX 저장 완료: ${outputPath}`);
|
|||
|
|
} catch (error) {
|
|||
|
|
console.error(`\n❌ PPTX 저장 실패: ${error.message}`);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
main().catch(console.error);
|