chore(release): 增加控制不输出压缩包的参数

This commit is contained in:
2025-12-29 10:12:12 +08:00
parent 5eed46c27e
commit 1574f6b2d9

View File

@@ -304,7 +304,8 @@ function main() {
try {
// 解析命令行参数
const args = process.argv.slice(2);
const keepDist = args.includes('--keep-dist') || args.includes('-k') || true;
const keepDist = args.includes('--keep-dist') || args.includes('-k');
const noZip = args.includes('--no-zip') || args.includes('-n');
// 清理dist目录如果存在且不保留
if (fs.existsSync(distDir)) {
@@ -328,9 +329,13 @@ function main() {
const zipFileName = `POCT检测分析平台-定制化-${currentDate}-mp-weixin.zip`;
const zipPath = path.join(distDir, zipFileName);
// 创建zip压缩包
// 创建zip压缩包(如果未指定--no-zip参数
if (!noZip) {
console.log('Creating zip archive...');
createZipArchive(distDir, zipPath);
} else {
console.log('Skipping zip archive creation (--no-zip specified)');
}
// 清理dist目录如果不保留
if (!keepDist) {
@@ -370,8 +375,7 @@ function main() {
console.log('\n=== JS Files with Console Statements After Compression ===');
console.log(`Found ${filesWithConsoleAfterCompression.length} file(s) still containing console statements after compression:`);
filesWithConsoleAfterCompression.forEach((file, index) => {
console.log(`\n${index + 1}. Source: ${file.sourcePath}`);
console.log(` Target: ${file.targetPath}`);
console.log(`${index + 1}. ${file.targetPath}`);
});
console.log('\n=================================================');
} else {
@@ -391,5 +395,6 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
console.log('Usage: node release.js [options]');
console.log('Options:');
console.log(' --keep-dist, -k Keep existing dist directory contents');
console.log(' --no-zip, -n Skip zip archive creation');
console.log(' --help, -h Show this help message');
}