| 12345678910111213141516171819202122 | const path = require('path');const fs = require('fs');// 获取当前命令行上下文路径const currentDirectory = process.cwd();console.log(`----------------------------`)console.log(`项目编译打包完成,准备恢复配置文件...`)// 获取缓存文件console.log(`获取配置缓存文件...`)const cacheJsonPath = path.join(currentDirectory, 'scripts/cache.json');const cacheJsonContent = fs.readFileSync(cacheJsonPath, 'utf8');// 恢复配置文件console.log(`正在恢复为编译前的配置文件...`)const indexJsonPath = path.join(currentDirectory, 'src/config/index.json');fs.writeFileSync(indexJsonPath, cacheJsonContent, 'utf8');// 删除缓存文件console.log(`删除配置缓存文件...`)fs.unlinkSync(cacheJsonPath);
 |