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