🐛 Fixed #883
This commit is contained in:
25
build.js
25
build.js
@@ -1,10 +1,7 @@
|
|||||||
const axios = require("axios")
|
const axios = require("axios")
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const { spawnSync } = require("child_process")
|
const { spawnSync } = require("child_process")
|
||||||
const runCommand = (command, args) =>
|
const runCommand = (command, args) => spawnSync(command, args).stdout.toString().replace(/\n/g, "")
|
||||||
spawnSync(command, args)
|
|
||||||
.stdout.toString()
|
|
||||||
.replace(/\n/g, "")
|
|
||||||
|
|
||||||
const FAIL_ON_ERROR = false
|
const FAIL_ON_ERROR = false
|
||||||
const PW_BUILD_DATA_DIR = "./.postwoman"
|
const PW_BUILD_DATA_DIR = "./.postwoman"
|
||||||
@@ -28,7 +25,7 @@ try {
|
|||||||
await axios
|
await axios
|
||||||
.get("https://api.github.com/repos/liyasthomas/postwoman/releases")
|
.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
|
// If we can't get it from GitHub, we'll resort to getting it from package.json
|
||||||
.catch(ex => ({
|
.catch((ex) => ({
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
tag_name: require("./package.json").version,
|
tag_name: require("./package.json").version,
|
||||||
@@ -39,16 +36,16 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the current version hash as the short hash from Git.
|
// Get the current version hash as the short hash from Git.
|
||||||
version.hash = runCommand("git", ["rev-parse", "--short", "HEAD"])
|
// version.hash = runCommand("git", ["rev-parse", "--short", "HEAD"])
|
||||||
// Get the 'variant' name as the branch, if it's not master.
|
// Get the 'variant' name as the branch, if it's not master.
|
||||||
version.variant =
|
// version.variant =
|
||||||
process.env.TRAVIS_BRANCH ||
|
// process.env.TRAVIS_BRANCH ||
|
||||||
runCommand("git", ["branch"])
|
// runCommand("git", ["branch"])
|
||||||
.split("* ")[1]
|
// .split("* ")[1]
|
||||||
.split(" ")[0] + (IS_DEV_MODE ? " - DEV MODE" : "")
|
// .split(" ")[0] + (IS_DEV_MODE ? " - DEV MODE" : "")
|
||||||
if (["", "master"].includes(version.variant)) {
|
// if (["", "master"].includes(version.variant)) {
|
||||||
delete version.variant
|
// delete version.variant
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Write version data into a file
|
// Write version data into a file
|
||||||
fs.writeFileSync(`${PW_BUILD_DATA_DIR}/version.json`, JSON.stringify(version))
|
fs.writeFileSync(`${PW_BUILD_DATA_DIR}/version.json`, JSON.stringify(version))
|
||||||
|
|||||||
12
package-lock.json
generated
12
package-lock.json
generated
@@ -5804,9 +5804,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"eventemitter3": {
|
"eventemitter3": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz",
|
||||||
"integrity": "sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg=="
|
"integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ=="
|
||||||
},
|
},
|
||||||
"events": {
|
"events": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
@@ -7636,9 +7636,9 @@
|
|||||||
"integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q="
|
"integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q="
|
||||||
},
|
},
|
||||||
"http-proxy": {
|
"http-proxy": {
|
||||||
"version": "1.18.0",
|
"version": "1.18.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
|
||||||
"integrity": "sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ==",
|
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"eventemitter3": "^4.0.0",
|
"eventemitter3": "^4.0.0",
|
||||||
"follow-redirects": "^1.0.0",
|
"follow-redirects": "^1.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user