prebuild.js 843 B

1234567891011121314151617181920212223242526272829303132
  1. // const packageJson = require("./package.json");
  2. // if (packageJson.dependencies.iview !== "^3.4.1") {
  3. // console.log("iview 的版本不要轻易升级,一定要充分测试。");
  4. // process.exit(1);
  5. // }
  6. console.log("> prebuild");
  7. console.log("> prebuild create .env.production.local");
  8. const buildDate = require("moment")().format("YYYY-MM-DD HH:mm:SS");
  9. console.log(" 构建日期为 " + buildDate);
  10. const revision = require("child_process")
  11. .execSync("git rev-parse HEAD")
  12. .toString()
  13. .trim()
  14. .slice(0, 7);
  15. const fs = require("fs");
  16. console.log(" 当前的git版本为 " + revision);
  17. fs.writeFileSync(
  18. ".env.production.local",
  19. "VUE_APP_GIT_REPO_VERSION=" + buildDate + " - " + revision
  20. );
  21. fs.writeFileSync(
  22. ".env.staging.local",
  23. "VUE_APP_GIT_REPO_VERSION=" + buildDate + " - " + revision
  24. );
  25. console.log();