mirror of
https://github.com/HolographicHat/Yae.git
synced 2026-03-16 00:53:17 +08:00
auto package script
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -4,8 +4,8 @@ config.json
|
||||
out.*
|
||||
node_modules
|
||||
.idea
|
||||
app*.7z
|
||||
app*.exe
|
||||
YaeAchievement-*.7z
|
||||
YaeAchievement-*.exe
|
||||
export*.json
|
||||
secret.js
|
||||
package-lock.json
|
||||
|
||||
13
package.json
13
package.json
@@ -3,18 +3,17 @@
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"pkg": "pkg -t node16-win-x64 -C Brotli app.js --build -o app.exe",
|
||||
"pkg-for-windows7": "pkg -t node14-win-x64 -C Brotli app.js --build -o app-win7.exe"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"ini": "^2.0.0",
|
||||
"axios": "^0.26.1",
|
||||
"udp-proxy": "^1.2.0",
|
||||
"protobufjs": "^6.11.2"
|
||||
"ini": "^2.0.0",
|
||||
"protobufjs": "^6.11.2",
|
||||
"udp-proxy": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"pkg": "file:C:/Users/holog/Desktop/pkg-main"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
const fs = require("fs")
|
||||
const pkg = require("pkg")
|
||||
const { log } = require("../utils")
|
||||
const { version } = require("../version")
|
||||
const { execSync } = require("child_process")
|
||||
|
||||
// noinspection DuplicatedCode
|
||||
const log = (msg, ...params) => {
|
||||
const time = new Date()
|
||||
const timeStr = time.getHours().toString().padStart(2, "0") + ":" + time.getMinutes().toString().padStart(2, "0") + ":" + time.getSeconds().toString().padStart(2, "0")
|
||||
console.log(`${timeStr} ${msg}`, ...params)
|
||||
}
|
||||
|
||||
const name = `YaeAchievement-${ version.isDev ? "DevBuild" : "Release" }-${((t = new Date()) => {
|
||||
const p = i => i.toString().padStart(2, "0")
|
||||
return `${p(t.getMonth()+1)}${p(t.getDate())}${p(t.getHours())}${p(t.getMinutes())}`
|
||||
@@ -40,24 +34,24 @@ const cleanUp = () => {
|
||||
fs.rm("./tmp.script", () => {})
|
||||
}
|
||||
|
||||
const prepare = () => {
|
||||
|
||||
const c = {
|
||||
finalName: `${name}-Win7`,
|
||||
nodeVersion: "14.19.1",
|
||||
sevenZipPath: "C:/Program Files/7-Zip/7z.exe"
|
||||
};
|
||||
|
||||
(async () => {
|
||||
console.log(c)
|
||||
log("Generate and compile version info")
|
||||
generateAndCompileVersionInfo()
|
||||
log("Modify executable file resources")
|
||||
const node = ["14.19.1", "16.14.2"]
|
||||
node.forEach(v => {
|
||||
const path = `C:/Users/holog/.pkg-cache/v3.3/built-v${v}-win-x64`
|
||||
generateScript(path)
|
||||
execSync(`rh.exe -script tmp.script`)
|
||||
})
|
||||
const path = `C:/Users/holog/.pkg-cache/v3.3/built-v${c.nodeVersion}-win-x64`
|
||||
generateScript(path)
|
||||
execSync(`rh.exe -script tmp.script`)
|
||||
cleanUp()
|
||||
log("Build and compress package")
|
||||
await pkg.exec(`../app.js -t node${c.nodeVersion.split(".")[0]}-win-x64 -C Brotli --build -o ${c.finalName}.exe`.split(" "))
|
||||
execSync(`${c.sevenZipPath} a ${c.finalName}.7z ${c.finalName}.exe -mx=9 -myx=9 -mmt=4 -sdel -stl`)
|
||||
log("Done")
|
||||
}
|
||||
|
||||
prepare()
|
||||
return
|
||||
|
||||
/*await Promise.all([
|
||||
pkg.exec(`app.js -t node16-win-x64 -C Brotli --build -o ${name}.exe`.split(" ")),
|
||||
pkg.exec(`app.js -t node14-win-x64 -C Brotli --build -o ${name}-Win7.exe`.split(" "))
|
||||
])*/
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user