Skip to content

Commit

Permalink
fix: support stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
qcuong98 committed Feb 15, 2025
1 parent 0ad4e7f commit d2d3d09
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const os = require("os");

function normalizeVersionName(version) {
return version.replace(/^nightly-[0-9a-f]{40}$/, "nightly");
if (/^nightly-[0-9a-f]{40}$/.test(version)) {
return "nightly";
}
return version.replace(/-/g, "_");
}

function mapArch(arch) {
Expand All @@ -15,7 +18,16 @@ function mapArch(arch) {

function getDownloadObject(version) {
const platform = os.platform();
const filename = `foundry_${normalizeVersionName(version)}_${platform}_${mapArch(os.arch())}`;
let filename;

if (version.startsWith("foundry")) {
// If version starts with "foundry", don't add the prefix.
filename = `${normalizeVersionName(version)}_${platform}_${mapArch(os.arch())}`;
} else {
// Otherwise, add the "foundry_" prefix.
filename = `foundry_${normalizeVersionName(version)}_${platform}_${mapArch(os.arch())}`;
}

const extension = platform === "win32" ? "zip" : "tar.gz";
const url = `https://github.com/matter-labs/foundry-zksync/releases/download/${version}/${filename}.${extension}`;

Expand Down

0 comments on commit d2d3d09

Please sign in to comment.