1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- const packageJson = require("./package.json");
- if (packageJson.dependencies.iview !== "^3.5.2") {
- 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.stagingAli.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
- );
- fs.writeFileSync(
- ".env.production-temp.local",
- "VUE_APP_GIT_REPO_VERSION=" + buildDate + " - " + revision
- );
- console.log();
|