const packageJson = require("./package.json"); if (packageJson.dependencies.iview !== "^3.5.4") { console.log("iview 的版本不要轻易升级,一定要充分测试。"); process.exit(1); } console.log("> prebuild"); console.log("> prebuild create .env.*.local"); const buildDate = require("moment")().format("YYYY-MM-DD HH:mm:ss"); console.log(" 构建日期为 " + buildDate); const revision = require("child_process") .execSync("git rev-parse HEAD") .toString() .trim() .slice(0, 7); const fs = require("fs"); console.log(" 当前的git版本为 " + revision); fs.writeFileSync( ".env.development.local", "\nVUE_APP_GIT_REPO_VERSION=开发环境-" + buildDate + " - " + revision ); fs.writeFileSync( ".env.test.local", "VUE_APP_GIT_REPO_VERSION=测试环境(阿里云)-" + buildDate + " - " + revision ); fs.writeFileSync( ".env.staging.local", "VUE_APP_GIT_REPO_VERSION=灰度环境-" + buildDate + " - " + revision ); fs.writeFileSync( ".env.production.local", "VUE_APP_GIT_REPO_VERSION=" + buildDate + " - " + revision ); console.log();