Commit 650cce55 by 潘建波

增加打包版本信息

1 parent 802e4887
{"commit":"802e4887430c6a9eeddbd3ccd4fdb70bae40e684","commitDate":"2020-7-6 14:15","buildDate":"2020-7-6 16:20","version":"2.1.7","info":"🐛ocx下载提示"}
\ No newline at end of file
新繁星
===
### 2.1.7
稳定版本更新
1.解决ocx提示下载问题
No preview for this file type
{"version":"2.0.2","Info":"��ɶ","Bug":"��ɶ","date":"2020-05-07T05:51:19.187Z"}
\ No newline at end of file
{"commit":"802e4887430c6a9eeddbd3ccd4fdb70bae40e684","commitDate":"2020-7-6 14:15","buildDate":"2020-7-6 16:23","version":"2.1.7","info":"🐛ocx下载提示"}
\ No newline at end of file
......@@ -48,6 +48,7 @@
>
</el-form-item>
</el-form>
<div class="syversion">版本:v2.0.3</div>
</div>
</div>
</div>
......@@ -410,4 +411,7 @@ p:nth-child(1) {
top: 20%;
}
}
.syversion {
color: #ccc;
}
</style>
const child_process = require("child_process");
// git 最后一次提交的 Head
const commit = child_process
.execSync("git show -s --format=%H")
.toString()
.trim();
// const commitUserName = child_process.execSync('git show -s --format=%cn').toString().trim()
// const commitUserMail = child_process.execSync('git show -s --format=%ce').toString().trim()
const commitDateObj = new Date(
child_process.execSync(`git show -s --format=%cd`).toString()
);
const commitDate = `${commitDateObj.getFullYear() +
"-" +
(commitDateObj.getMonth() + 1) +
"-" +
commitDateObj.getDate() +
" " +
commitDateObj.getHours() +
":" +
commitDateObj.getMinutes()}`;
// const buildUserName = child_process.execSync('git config user.name').toString().trim()
// const buildUserMail = child_process.execSync('git config user.email').toString().trim()
const info = child_process
.execSync("git show -s --format=%s")
.toString()
.trim();
const versionarr = child_process
.execSync("git tag -l")
.toString()
.trim()
.split("\n");
const version = versionarr[versionarr.length - 1];
const nowDate = new Date();
const buildDate = `${nowDate.getFullYear() +
"-" +
(nowDate.getMonth() + 1) +
"-" +
nowDate.getDate() +
" " +
nowDate.getHours() +
":" +
nowDate.getMinutes()}`;
module.exports = { commit, commitDate, buildDate, version, info };
// const fs = require("fs");
// const readlineSync = require("readline-sync");
// const readline = require("readline");
// // 获取当前版本信息
// const vinfopath = "./public/js/version.json";
// var vinfo = fs.readFileSync(vinfopath, "utf8");
// console.log(vinfo);
// // 新版本设置
// var versionnum = readlineSync.question("new Vsersion:");
// var reg = /\d.\d.\d/;
// if (versionnum != "" && reg.test(versionnum)) {
// var varr = versionnum.split(".");
// var oldv = JSON.parse(vinfo).version.split(".");
// if (varr[0] >= oldv[0] && varr[1] >= oldv[1] && varr[2] > oldv[2]) {
// console.log(versionnum);
// } else {
// throw "新版本号必须大于旧版本号!";
// }
// } else {
// throw "版本号错误";
// }
// var info = readlineSync.question("EditInfo:", "utf8", {
// encoding:"UTF-8",
// hideEchoBack: true // The typed text on screen is hidden by `*` (default).
// });
// var buginfo = readlineSync.question("BugInfo:", "utf8", {
// encoding:"utf-8",
// hideEchoBack: true // The typed text on screen is hidden by `*` (default).
// });
// console.log(buginfo)
// var verinfo = fs.openSync(vinfopath, "w+");
// var obj = {
// version: versionnum,
// Info: info,
// Bug: buginfo,
// date: new Date()
// };
// var options = { encoding: 'UTF-8', mode: 438 /*=0666*/, flag: 'w' };
// fs.writeFileSync(verinfo, JSON.stringify(obj), options);
const fs = require("fs");
const vinfopath = "./public/js/version.json";
const BuildInfo = require("./version.js");
console.log(BuildInfo);
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
......@@ -55,10 +17,16 @@ module.exports = {
}
},
chainWebpack: config => {
if (process.env.use_analyzer) { // 分析
if (process.env.use_analyzer) {
// 分析
config
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
.plugin("webpack-bundle-analyzer")
.use(require("webpack-bundle-analyzer").BundleAnalyzerPlugin);
}
if (process.env.NODE_ENV === "production") {
var verinfo = fs.openSync(vinfopath, "w+");
var options = { encoding: "UTF-8", mode: 438 /*=0666*/, flag: "w" };
fs.writeFileSync(verinfo, JSON.stringify(BuildInfo), options);
}
},
pluginOptions: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!