This commit is contained in:
949036910@qq.com
2026-05-30 18:44:16 +08:00
parent e10a66ccf2
commit 9c6650373f
162 changed files with 624 additions and 26788 deletions

View File

@@ -32,6 +32,7 @@ async function notifyReleaseVersion(version) {
}
const tauriDir = path.join(__dirname, "..");
const npmReleaseDir = path.join(tauriDir, "..", "..", "npmrelease");
const conf = JSON.parse(
fs.readFileSync(path.join(tauriDir, "tauri.conf.json"), "utf8"),
);
@@ -70,6 +71,25 @@ const stagedExe =
process.platform === "win32" ? `${productName}.exe` : productName;
fs.copyFileSync(exePath, path.join(stageDir, stagedExe));
function writeVersionSidecar(dir, baseName, ver) {
const file = path.join(dir, `${baseName}.version`);
fs.writeFileSync(file, `${ver}\n`, "utf8");
return file;
}
writeVersionSidecar(stageDir, productName, version);
// 复制主程序到 npmrelease供 npm publish 打包
if (process.platform === "win32") {
fs.mkdirSync(npmReleaseDir, { recursive: true });
const npmReleaseExe = path.join(npmReleaseDir, stagedExe);
fs.copyFileSync(exePath, npmReleaseExe);
writeVersionSidecar(npmReleaseDir, productName, version);
console.log(`已复制主程序到 npmrelease: ${npmReleaseExe}`);
} else {
console.warn("非 Windows 平台,跳过复制到 npmrelease");
}
const updaterPath = path.join(releaseDir, "updater.exe");
if (process.platform === "win32" && fs.existsSync(updaterPath)) {
fs.copyFileSync(updaterPath, path.join(stageDir, "updater.exe"));