代码拉取完成,页面将自动刷新
"use strict";
const path = require("path");
const fs = require("fs");
class ReName {
constructor() {
this.basePath = path.normalize(__dirname + "/..");
this.dirs = path.join(this.basePath, "/out/");
}
/**
* 格式化参数
*/
formatArgvs() {
let argv = {};
for (let i = 0; i < process.argv.length; i++) {
const tmpArgv = process.argv[i];
if (tmpArgv.indexOf("--") !== -1) {
let key = tmpArgv.substring(2);
let val = process.argv[i + 1];
argv[key] = val;
}
}
return argv;
}
rename(args) {
let that = this;
const pkgPath = path.join(that.basePath, "/package.json");
let pkg = JSON.parse(fs.readFileSync(pkgPath));
let version = pkg.version;
let productName = pkg.build.productName;
let fileName = `${productName}-${version}`;
let extList = [".exe", ".dmg", ".tar.xz", ".deb"];
extList.forEach((e) => {
let file = path.join(that.dirs, `${fileName}${e}`);
let nFile = path.join(
that.dirs,
`${productName}_${args["tag"]}-${version}${e}`,
);
if (fs.existsSync(file)) {
console.log("exist ", file);
console.log("rename ", nFile);
fs.renameSync(file, nFile);
}
});
}
}
const r = new ReName();
let argvs = r.formatArgvs();
console.log("[electron] [rename] argvs:", argvs);
r.rename(argvs);
module.exports = ReName;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。