代码拉取完成,页面将自动刷新
同步操作将从 bobdan/postwoman 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const axios = require("axios")
const fs = require("fs")
const { spawnSync } = require("child_process")
const runCommand = (command, args) =>
spawnSync(command, args)
.stdout.toString()
.replace(/\n/g, "")
const FAIL_ON_ERROR = false
const PW_BUILD_DATA_DIR = "./.postwoman"
const IS_DEV_MODE = process.argv.includes("--dev")
try {
;(async () => {
// Create the build data directory if it does not exist.
if (!fs.existsSync(PW_BUILD_DATA_DIR)) {
fs.mkdirSync(PW_BUILD_DATA_DIR)
}
let version = {}
// Get the current version name as the tag from Git.
version.name =
process.env.TRAVIS_TAG || runCommand("git", ["tag --sort=committerdate | tail -1"])
// FALLBACK: If version.name was unset, let's grab it from GitHub.
if (!version.name) {
version.name = (
await axios
.get("https://api.github.com/repos/liyasthomas/postwoman/releases")
// If we can't get it from GitHub, we'll resort to getting it from package.json
.catch(ex => ({
data: [
{
tag_name: require("./package.json").version,
},
],
}))
).data[0]["tag_name"]
}
// Get the current version hash as the short hash from Git.
version.hash = runCommand("git", ["rev-parse", "--short", "HEAD"])
// Get the 'variant' name as the branch, if it's not master.
version.variant =
process.env.TRAVIS_BRANCH ||
runCommand("git", ["branch"])
.split("* ")[1]
.split(" ")[0] + (IS_DEV_MODE ? " - DEV MODE" : "")
if (["", "master"].includes(version.variant)) {
delete version.variant
}
// Write version data into a file
fs.writeFileSync(`${PW_BUILD_DATA_DIR}/version.json`, JSON.stringify(version))
})()
} catch (ex) {
console.error(ex)
process.exit(FAIL_ON_ERROR ? 1 : 0)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。