Open anonymouscatcher opened 1 year ago
This is a really exciting challenge, and I wonder if the initial bottleneck would be the different codesigners...
yea then we can say goodbye to Electron.
I've toyed around a bit with this today here
https://github.com/simonhyll/electron-to-tauri/
And it was surprisingly easy to get it to download a Tauri .msi file. You just have to put a latest.yaml
file in the release with the proper values.
Where I'm struggling atm is that it downloads it and offers to update on exit, but when I click ok to install the update, nothing happens. So yea it doesn't work yet, but I can definitely see it downloading the latest version as long as the yaml file is there in the latest release
Some progress on this issue:
On Linux I've verified that AppImage updating works flawlessly if you just set the values in latest-linux.yml
correctly! And since .deb
packages should really be distributed through some form of PPA where you'd just upload the new version to, I'd say that switching from Electron to Tauri on Linux at least can be considered fully supported and as simple as editing the .yml
file 😄
On Windows I'm still struggling getting it to work, in no small part because I'm having issues finding a way to get proper debugging information for the installation process. It's verifying the file is downloaded and everything, it just doesn't want to work. HOWEVER: all the information required to download it manually is available, so in theory making the app update is as simple as writing a tiny Javascript function that downloads and executes the .msi
file. I would prefer not having to go that route but it's certainly looking like the best option currently since the updater is being such a b****.
I can't try switching from Electron to Tauri on Mac unfortunately because I do not own a Mac. :\
Here's a snippet I cooked up that's capable of downloading the .msi
and executing it. It's a very basic variant without things like checksum checking and it doesn't download to a temp path, but it works during testing at least.
autoUpdater.on("update-available", (info) => {
console.log(info);
const https = require("https");
const fs = require("fs");
const { spawn } = require("child_process");
const url =
"https://github.com/simonhyll/electron-to-tauri/releases/download/v0.11.0/electron-updater-example_0.11.0_x64_en-US.msi";
const filePath = "installer.msi";
const file = fs.createWriteStream(filePath);
const request = https
.get(url, function (response) {
if (response.statusCode === 302) {
// Follow the redirect
https.get(response.headers.location, function (newResponse) {
if (newResponse.statusCode !== 200) {
console.error(
"Error downloading file: HTTP",
newResponse.statusCode
);
file.close();
fs.unlinkSync(filePath);
return;
}
newResponse.pipe(file);
});
} else if (response.statusCode !== 200) {
console.error("Error downloading file: HTTP", response.statusCode);
file.close();
fs.unlinkSync(filePath);
return;
} else {
response.pipe(file);
}
file.on("finish", function () {
file.close();
console.log("Download completed.");
const install = spawn("msiexec", ["/i", `${filePath}`], {
detached: true,
});
install.unref();
app.exit(0);
});
})
.on("error", function (err) {
console.error("Error downloading file:", err);
fs.unlinkSync(filePath);
});
});
latest-*.yml
file from your Electron buildblockMapSize
if it's there, you don't need itsha512sum FILE
to get the value to put in the sha512 fieldTauri supported distribution methods and their status:
latest.yml
file so that the updater can take care of finding whether or not a new version is available.A tauri equivalent of electron-builder would be fantastic and definitely increase adoption.
We may not advertise it well enough, but Tauri had an electron-builder equivalent built-in from the start. To be fair, Tauri doesn't support as many bundle types yes but we're getting there. There's also a modified version of tauri's bundler called cargo-packager which also works for non-Tauri projects.
Describe the problem
I am interested in finding a solution for migrating a live application from Electron to Tauri, in order to provide a seamless experience for current users and eliminate the need for manual downloads. Is this something that can be easily achieved?
Describe the solution you'd like
I think Tauri should make the transition from Electron easier for the current applications which uses Electron with auto update.
Alternatives considered
No response
Additional context
This is the auto update package for most of the Electron applications https://www.electron.build/auto-update.html