16 lines
		
	
	
		
			467 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			467 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import * as fs from 'fs';
 | 
						|
import * as path from 'path';
 | 
						|
 | 
						|
const targetDir = path.join('.vitepress', 'dist', 'pdf');
 | 
						|
const sourceFile = path.join('pdf', 'book.pdf');
 | 
						|
const targetFile = path.join(targetDir, 'book.pdf');
 | 
						|
 | 
						|
// 创建目标文件夹(如果不存在)
 | 
						|
if (!fs.existsSync(targetDir)) {
 | 
						|
  fs.mkdirSync(targetDir, { recursive: true });
 | 
						|
}
 | 
						|
 | 
						|
// 复制文件
 | 
						|
fs.copyFileSync(sourceFile, targetFile);
 | 
						|
 | 
						|
console.log('PDF 已复制到 .vitepress/dist/pdf/book.pdf'); |