1111
This commit is contained in:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user