代码拉取完成,页面将自动刷新
同步操作将从 doodooke/多多客(doodooke)微信小程序SaaS平台 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const axios = require("axios");
const download = require("download");
const ProgressBar = require("progress");
const glob = require("glob");
const semver = require("semver");
async function downloadZip(url, dest, tag) {
const response = await axios({
method: "get",
url: url,
responseType: "stream"
});
const bar = new ProgressBar(
`[doodoo-upgrade] Updating ${tag} [:bar] :rate/bps :percent :etas`,
{
complete: "=",
incomplete: " ",
width: 40,
total: parseInt(response.data.headers["content-length"], 10)
}
);
await download(url, dest, {
extract: true,
filter: file => {
if (/__MACOSX/.test(file.path)) {
return false;
}
return true;
}
}).on("response", res => {
bar.total = res.headers["content-length"];
res.on("data", data => bar.tick(data.length));
});
}
module.exports = async () => {
// 检测升级系统
// TODO
// 检测商业版
const js7Files = glob.sync("**/*.js7", { ignore: ["**/node_modules/**"] });
if (!js7Files.length) {
process.emit("startServer");
return;
}
// 检测升级node
const requestNodeInfo = await axios.get(
"http://upgrade.doodooke.com/node/node.json"
);
const nodeInfo = requestNodeInfo.data;
const nodeLatestVersion = nodeInfo.latest;
if (
!process.env.DOODOO_CORE_VERSION ||
semver.gt(nodeLatestVersion, process.env.DOODOO_CORE_VERSION)
) {
let os;
if (process.platform === "darwin") {
os = "mac";
}
if (process.platform === "linux") {
os = "linux";
}
if (process.platform === "win32") {
os = "win";
}
if (!os) {
throw new Error("如需支持其他操作系统,请联系客服。");
}
console.log("[doodoo-upgrade] 温馨提示:开始升级node,升级完成请重启");
await downloadZip(
`http://upgrade.doodooke.com/node/${nodeLatestVersion}/${os}.zip`,
"./bin",
"Node"
);
process.exit();
}
process.emit("startServer");
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。