43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const buildIconsDir = 'dist/build/h5/static/icons';
|
|
|
|
console.log('=== 构建目录中的图标文件 ===');
|
|
fs.readdir(buildIconsDir, (err, files) => {
|
|
if (err) {
|
|
console.log('读取目录失败:', err);
|
|
return;
|
|
}
|
|
|
|
const targetIcons = ['paper.png', 'metal.png', 'plastic.png', 'fabric.png', 'glass.png'];
|
|
files.filter(f => targetIcons.includes(f)).forEach(f => {
|
|
const stats = fs.statSync(path.join(buildIconsDir, f));
|
|
console.log(`${f}: ${stats.size} bytes`);
|
|
});
|
|
|
|
console.log('\n=== 源目录中的图标文件 ===');
|
|
const sourceIconsDir = 'image';
|
|
targetIcons.forEach(f => {
|
|
const srcPath = path.join(sourceIconsDir, f);
|
|
if (fs.existsSync(srcPath)) {
|
|
const stats = fs.statSync(srcPath);
|
|
console.log(`${f}: ${stats.size} bytes`);
|
|
} else {
|
|
console.log(`${f}: 不存在`);
|
|
}
|
|
});
|
|
|
|
console.log('\n=== 对比大小 ===');
|
|
targetIcons.forEach(f => {
|
|
const srcPath = path.join(sourceIconsDir, f);
|
|
const buildPath = path.join(buildIconsDir, f);
|
|
|
|
if (fs.existsSync(srcPath) && fs.existsSync(buildPath)) {
|
|
const srcSize = fs.statSync(srcPath).size;
|
|
const buildSize = fs.statSync(buildPath).size;
|
|
const match = srcSize === buildSize ? '✓' : '✗';
|
|
console.log(`${f}: 源文件${srcSize}bytes vs 构建${buildSize}bytes ${match}`);
|
|
}
|
|
});
|
|
}); |