|
@@ -6,6 +6,19 @@ const currentDirectory = process.cwd();
|
|
|
console.log(`----------------------------`)
|
|
|
console.log(`正在处理编译打包前的准备...`)
|
|
|
|
|
|
+//修改版本更新信息
|
|
|
+console.log(`更新版本更新信息...`)
|
|
|
+const versionPath = path.join(currentDirectory, '/public/version.json');
|
|
|
+const versionContent = fs.readFileSync(versionPath, 'utf8');
|
|
|
+//修改配置文件
|
|
|
+const versionJson = JSON.parse(versionContent);
|
|
|
+versionJson.value = dateFormat(new Date()); //版本号
|
|
|
+
|
|
|
+//更新版本更新信息
|
|
|
+fs.writeFileSync(versionPath, JSON.stringify(versionJson, null, 2));
|
|
|
+
|
|
|
+console.log(`----------------------------`)
|
|
|
+
|
|
|
//删除上次打包相关的文件
|
|
|
console.log(`正在删除上次打包相关的文件...`)
|
|
|
const distZipPath = path.join(currentDirectory, '/zip/hac.zip');
|
|
@@ -13,11 +26,15 @@ if(fs.existsSync(distZipPath)) {
|
|
|
fs.unlinkSync(distZipPath);
|
|
|
}
|
|
|
|
|
|
+console.log(`----------------------------`)
|
|
|
+
|
|
|
// 获取配置文件
|
|
|
console.log(`获取当前的配置文件...`)
|
|
|
const indexJsonPath = path.join(currentDirectory, 'src/config/index.json');
|
|
|
const indexJsonContent = fs.readFileSync(indexJsonPath, 'utf8');
|
|
|
|
|
|
+console.log(`----------------------------`)
|
|
|
+
|
|
|
// 检测上次打包异常中断的缓存文件是否存在
|
|
|
console.log(`检测上次打包异常中断的缓存文件是否存在...`)
|
|
|
const cacheFilePath = path.join(currentDirectory, 'scripts/cache.json');
|
|
@@ -28,6 +45,8 @@ if(!fs.existsSync(cacheFilePath)) {
|
|
|
fs.writeFileSync(cacheJsonPath, indexJsonContent, 'utf8');
|
|
|
}
|
|
|
|
|
|
+console.log(`----------------------------`)
|
|
|
+
|
|
|
//修改配置文件
|
|
|
const indexJson = JSON.parse(indexJsonContent);
|
|
|
indexJson.version = dateFormat(new Date()); //版本号
|