Commit 407eb979 authored by lijingang's avatar lijingang

feat: 将build.js中的提示语句改为英文

parent bbc8dde2
...@@ -2,13 +2,13 @@ const fs = require('fs'); ...@@ -2,13 +2,13 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const { exec } = require('child_process'); const { exec } = require('child_process');
// 默认源路径和目标路径 // Default source and destination paths
const DEFAULT_DEST = "E:/CPAS6-101 UFCPAS6.0 致同智审IAS版_测试版"; const DEFAULT_DEST = "E:/CPAS6-101 UFCPAS6.0 致同智审IAS版_测试版";
const DEFAULT_SRC = "G:/cpas-framework/release/win-unpacked"; const DEFAULT_SRC = "G:/cpas-framework/release/win-unpacked";
// 默认要复制的子文件夹列表(空数组表示复制所有文件夹) // Default subfolders list to copy (empty array means copy all folders)
const DEFAULT_SUB_FOLDERS = []; const DEFAULT_SUB_FOLDERS = [];
// 解析命令行参数 // Parse command line arguments
function parseArgs() { function parseArgs() {
const args = process.argv.slice(2); const args = process.argv.slice(2);
const params = { const params = {
...@@ -24,7 +24,7 @@ function parseArgs() { ...@@ -24,7 +24,7 @@ function parseArgs() {
} else if (arg === '--src' && i + 1 < args.length) { } else if (arg === '--src' && i + 1 < args.length) {
params.src = args[++i]; params.src = args[++i];
} else if (arg === '--subFolders' && i + 1 < args.length) { } else if (arg === '--subFolders' && i + 1 < args.length) {
// 支持逗号分隔的子文件夹列表,例如:folder1,folder2,folder3 // Support comma-separated subfolders list, e.g.: folder1,folder2,folder3
params.subFolders = args[++i].split(',').map(f => f.trim()).filter(f => f); params.subFolders = args[++i].split(',').map(f => f.trim()).filter(f => f);
} }
} }
...@@ -59,7 +59,7 @@ function copyFiles(src, dest, subFolders = [], rootSrc = src) { ...@@ -59,7 +59,7 @@ function copyFiles(src, dest, subFolders = [], rootSrc = src) {
const srcPath = path.join(src, file); const srcPath = path.join(src, file);
const destPath = path.join(dest, file); const destPath = path.join(dest, file);
// 检查是否是根源目录的直接子目录 // Check if it's a direct child of the root source directory
const relativePath = path.relative(rootSrc, srcPath); const relativePath = path.relative(rootSrc, srcPath);
const isDirectChild = relativePath === file && !relativePath.includes(path.sep); const isDirectChild = relativePath === file && !relativePath.includes(path.sep);
...@@ -71,25 +71,25 @@ function copyFiles(src, dest, subFolders = [], rootSrc = src) { ...@@ -71,25 +71,25 @@ function copyFiles(src, dest, subFolders = [], rootSrc = src) {
} }
if (stats.isDirectory()) { if (stats.isDirectory()) {
// 如果是目录,检查是否需要过滤 // If it's a directory, check if filtering is needed
if (isDirectChild && subFolders.length > 0 && !subFolders.includes(file)) { if (isDirectChild && subFolders.length > 0 && !subFolders.includes(file)) {
// 跳过不在subFolders列表中的直接子目录 // Skip direct subdirectories not in subFolders list
console.log(`跳过目录: ${file} (不在subFolders列表中)`); console.log(`Skipping directory: ${file} (not in subFolders list)`);
resolve(); resolve();
return; return;
} }
// 创建目录并复制内部文件 // Create directory and copy internal files
fs.mkdir(destPath, { recursive: true }, (err) => { fs.mkdir(destPath, { recursive: true }, (err) => {
if (err) { if (err) {
reject(`Error creating directory: ${err}`); reject(`Error creating directory: ${err}`);
return; return;
} }
// 递归复制目录内容,传递相同的subFolders和rootSrc // Recursively copy directory contents, passing same subFolders and rootSrc
copyFiles(srcPath, destPath, subFolders, rootSrc).then(resolve).catch(reject); copyFiles(srcPath, destPath, subFolders, rootSrc).then(resolve).catch(reject);
}); });
} else { } else {
// 如果是文件,直接复制 // If it's a file, copy directly
fs.copyFile(srcPath, destPath, fs.constants.COPYFILE_FICLONE, (err) => { fs.copyFile(srcPath, destPath, fs.constants.COPYFILE_FICLONE, (err) => {
if (err) { if (err) {
reject(`Error copying file: ${err}`); reject(`Error copying file: ${err}`);
...@@ -102,7 +102,7 @@ function copyFiles(src, dest, subFolders = [], rootSrc = src) { ...@@ -102,7 +102,7 @@ function copyFiles(src, dest, subFolders = [], rootSrc = src) {
})); }));
}); });
// 等待所有文件操作完成 // Wait for all file operations to complete
Promise.all(promises) Promise.all(promises)
.then(resolve) .then(resolve)
.catch(reject); .catch(reject);
...@@ -113,40 +113,40 @@ function copyFiles(src, dest, subFolders = [], rootSrc = src) { ...@@ -113,40 +113,40 @@ function copyFiles(src, dest, subFolders = [], rootSrc = src) {
// Start process // Start process
async function main() { async function main() {
try { try {
// 解析命令行参数 // Parse command line arguments
const { src, dest, subFolders } = parseArgs(); const { src, dest, subFolders } = parseArgs();
console.log(`源路径: ${src}`); console.log(`Source path: ${src}`);
console.log(`目标路径: ${dest}`); console.log(`Destination path: ${dest}`);
if (subFolders.length > 0) { if (subFolders.length > 0) {
console.log(`要复制的子文件夹: ${subFolders.join(', ')}`); console.log(`Subfolders to copy: ${subFolders.join(', ')}`);
} else { } else {
console.log(`子文件夹过滤: 无 (复制所有文件夹)`); console.log(`Subfolder filtering: none (copy all folders)`);
} }
// 创建目标目录(如果不存在) // Create destination directory if it doesn't exist
if (!fs.existsSync(dest)) { if (!fs.existsSync(dest)) {
fs.mkdirSync(dest, { recursive: true }); fs.mkdirSync(dest, { recursive: true });
} }
// 从源路径复制文件到目标路径(递归) // Copy files from source to destination (recursive)
console.log("开始文件复制..."); console.log("Starting file copy...");
await copyFiles(src, dest, subFolders); await copyFiles(src, dest, subFolders);
console.log("文件复制完成."); console.log("File copy completed.");
// 运行 updateVersion.js 脚本 // Run the updateVersion.js script
console.log("运行 updateVersion.js..."); console.log("Running updateVersion.js...");
await execCommand(`node "${dest}/buildscript/updateVersion.js"`); await execCommand(`node "${dest}/buildscript/updateVersion.js"`);
console.log("updateVersion.js 完成."); console.log("updateVersion.js completed.");
// 运行 ISCC 编译安装程序 // Run ISCC to compile the installer
console.log("运行 ISCC.exe..."); console.log("Running ISCC.exe...");
await execCommand(`ISCC.exe "${dest}/CPAS6Setup_智审IAS作业平台.iss"`); await execCommand(`ISCC.exe "${dest}/CPAS6Setup_智审IAS作业平台.iss"`);
console.log("ISCC.exe 完成."); console.log("ISCC.exe completed.");
console.log("脚本执行成功完成."); console.log("Script execution completed successfully.");
} catch (error) { } catch (error) {
console.error("发生错误:", error); console.error("An error occurred:", error);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment