mirror of
https://github.com/HolographicHat/Yae.git
synced 2025-12-12 09:28:16 +08:00
auto package script
This commit is contained in:
2
package/app.manifest
Normal file
2
package/app.manifest
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="requireAdministrator" uiAccess="false"/></requestedPrivileges></security></trustInfo><application xmlns="urn:schemas-microsoft-com:asm.v3"><windowsSettings><dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware><longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware></windowsSettings></application><compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"><application><supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/><supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/><supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/><supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/></application></compatibility></assembly>
|
||||
BIN
package/icon.ico
Normal file
BIN
package/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 353 KiB |
63
package/package.js
Normal file
63
package/package.js
Normal file
@@ -0,0 +1,63 @@
|
||||
const fs = require("fs")
|
||||
const pkg = require("pkg")
|
||||
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())}`
|
||||
})()}`
|
||||
|
||||
const generateAndCompileVersionInfo = () => {
|
||||
const vci = version.name.split(".")
|
||||
let content = fs.readFileSync("./version.rc", "utf-8")
|
||||
content = content.replaceAll("${BID}" , vci[2] === undefined ? "0" : vci[2])
|
||||
content = content.replaceAll("${YEAR}" , (new Date()).getFullYear())
|
||||
content = content.replaceAll("${MAJOR_VERSION}", vci[0])
|
||||
content = content.replaceAll("${MINOR_VERSION}", vci[1])
|
||||
content = content.replaceAll("${ORIGINAL_NAME}", `${name}.exe`)
|
||||
fs.writeFileSync("./tmp.rc", content, "utf-8")
|
||||
execSync(`rh.exe -open tmp.rc -save tmp.res -action compile -log NUL`)
|
||||
fs.rm("./tmp.rc", () => {})
|
||||
}
|
||||
|
||||
const generateScript = (path) => {
|
||||
let content = fs.readFileSync("./rh.script", "utf-8")
|
||||
content = content.replaceAll("${PATH}", path)
|
||||
fs.writeFileSync("./tmp.script", content, "utf-8")
|
||||
}
|
||||
|
||||
const cleanUp = () => {
|
||||
fs.rm("./rh.ini", () => {})
|
||||
fs.rm("./tmp.res", () => {})
|
||||
fs.rm("./tmp.script", () => {})
|
||||
}
|
||||
|
||||
const prepare = () => {
|
||||
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`)
|
||||
})
|
||||
cleanUp()
|
||||
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(" "))
|
||||
])*/
|
||||
BIN
package/rh.exe
Normal file
BIN
package/rh.exe
Normal file
Binary file not shown.
10
package/rh.script
Normal file
10
package/rh.script
Normal file
@@ -0,0 +1,10 @@
|
||||
[FILENAMES]
|
||||
Exe=${PATH}
|
||||
SaveAs=${PATH}
|
||||
Log=NUL
|
||||
[COMMANDS]
|
||||
-delete MANIFEST,,
|
||||
-delete ICONGROUP,,
|
||||
-addoverwrite icon.ico, ICONGROUP,1,0
|
||||
-addoverwrite tmp.res, VERSIONINFO,1,0
|
||||
-addoverwrite app.manifest MANIFEST,1,0
|
||||
23
package/version.rc
Normal file
23
package/version.rc
Normal file
@@ -0,0 +1,23 @@
|
||||
1 VERSIONINFO
|
||||
FILEVERSION ${MAJOR_VERSION},${MINOR_VERSION},${BID},0
|
||||
PRODUCTVERSION ${MAJOR_VERSION},${MINOR_VERSION},${BID},0
|
||||
FILEOS 0x4
|
||||
FILETYPE 0x1
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "000004B0"
|
||||
{
|
||||
VALUE "ProductName", "YaeAchievement"
|
||||
VALUE "ProductVersion", "${MAJOR_VERSION}.${MINOR_VERSION}.${BID}"
|
||||
VALUE "FileDescription", "YaeAchievement"
|
||||
VALUE "FileVersion", "${MAJOR_VERSION}.${MINOR_VERSION}.${BID}"
|
||||
VALUE "OriginalFilename", "${ORIGINAL_NAME}"
|
||||
VALUE "LegalCopyright", "Copyright (c) ${YEAR} HolographicHat"
|
||||
}
|
||||
}
|
||||
BLOCK "VarFileInfo"
|
||||
{
|
||||
VALUE "Translation", 0x0000 0x04B0
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
const version = {
|
||||
code: 6,
|
||||
name: "1.5"
|
||||
name: "1.5",
|
||||
isDev: true
|
||||
}
|
||||
|
||||
module.exports = { version }
|
||||
|
||||
Reference in New Issue
Block a user