Skip to content

Commit a3c57e8

Browse files
fix: revert pin Deno to specific version (#120)
1 parent 88a2a26 commit a3c57e8

File tree

1 file changed

+17
-26
lines changed

1 file changed

+17
-26
lines changed

src/download.ts

+17-26
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,26 @@ export async function getDenoDownloadUrl(
4040
const name = FILENAMES[key];
4141
const filename = name + ".zip";
4242

43+
const url = canary ? DENO_CANARY_INFO_URL : DENO_RELEASE_INFO_URL;
44+
const res = await fetch(url);
45+
if (!res.ok) {
46+
await res.body?.cancel();
47+
throw new Error(
48+
`${res.status}: Unable to retrieve ${
49+
canary ? "canary" : "release"
50+
} version information from ${url}.`,
51+
);
52+
}
53+
const version = (await res.text()).trim();
54+
4355
return {
44-
canary: false,
45-
url:
46-
`https://dl.deno.land/canary/c38dbe500b0a5815f4b07d4a6b696c5fdf622dc0/${filename}`,
56+
canary,
57+
url: canary
58+
? `https://dl.deno.land/canary/${decodeURI(version)}/${filename}`
59+
: `https://dl.deno.land/release/${decodeURI(version)}/${filename}`,
4760
filename,
48-
version: "c38dbe500b0a5815f4b07d4a6b696c5fdf622dc0",
61+
version: version,
4962
};
50-
51-
// TEMPORARIALLY FORCE USE OF VERSION c38dbe500b0a5815f4b07d4a6b696c5fdf622dc0
52-
// const url = canary ? DENO_CANARY_INFO_URL : DENO_RELEASE_INFO_URL;
53-
// const res = await fetch(url);
54-
// if (!res.ok) {
55-
// await res.body?.cancel();
56-
// throw new Error(
57-
// `${res.status}: Unable to retrieve ${
58-
// canary ? "canary" : "release"
59-
// } version information from ${url}.`,
60-
// );
61-
// }
62-
// const version = (await res.text()).trim();
63-
64-
// return {
65-
// canary,
66-
// url: canary
67-
// ? `https://dl.deno.land/canary/${decodeURI(version)}/${filename}`
68-
// : `https://dl.deno.land/release/${decodeURI(version)}/${filename}`,
69-
// filename,
70-
// version: version,
71-
// };
7263
}
7364

7465
export async function downloadDeno(

0 commit comments

Comments
 (0)