From 191588684bb97e7e2a099839bd62f718be4d6b5d Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Sun, 26 Feb 2023 18:22:28 -0500 Subject: [PATCH 1/2] move variants added to Deno.build.os on v1.31.0 https://github.com/denoland/deno/pull/17340 fixes #405 --- src/utils/index.ts | 17 ++++++++++++++++- src/vendor/Path.ts | 5 +++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index c13779981..4b79a6b13 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -308,7 +308,22 @@ export function host(): HostReturnValue { } })() - const { os: platform, target } = Deno.build + const { target } = Deno.build + + const platform = (() => { + switch (Deno.build.os) { + case "darwin": + case "linux": + case "windows": + return Deno.build.os + case "freebsd": + case "netbsd": + case "aix": + case "solaris": + case "illumos": + throw new Error(`unsupported-os: ${Deno.build.os}`) + } + })() return { platform, diff --git a/src/vendor/Path.ts b/src/vendor/Path.ts index beefea778..1858d899c 100644 --- a/src/vendor/Path.ts +++ b/src/vendor/Path.ts @@ -30,6 +30,11 @@ export default class Path { switch (Deno.build.os) { case "linux": case "darwin": + case "freebsd": + case "netbsd": + case "aix": + case "solaris": + case "illumos": return Deno.env.get("HOME")! case "windows": return Deno.env.get("USERPROFILE")! From e008ee650e54f2bd8674310115e8354f33f62b2f Mon Sep 17 00:00:00 2001 From: Max Howell Date: Tue, 28 Feb 2023 07:39:35 -0500 Subject: [PATCH 2/2] =?UTF-8?q?Don=E2=80=99t=20break=20in=20future=20when?= =?UTF-8?q?=20deno=20add=20platforms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.ts | 11 +++++------ src/vendor/Path.ts | 10 ++-------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 4b79a6b13..3de5bca26 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -305,6 +305,8 @@ export function host(): HostReturnValue { case "aarch64": return "aarch64" case "x86_64": return "x86-64" // ^^ ∵ https://en.wikipedia.org/wiki/X86-64 and semver.org prohibits underscores + default: + throw new Error(`unsupported-arch: ${Deno.build.arch}`) } })() @@ -316,12 +318,9 @@ export function host(): HostReturnValue { case "linux": case "windows": return Deno.build.os - case "freebsd": - case "netbsd": - case "aix": - case "solaris": - case "illumos": - throw new Error(`unsupported-os: ${Deno.build.os}`) + default: + console.warn("assuming linux mode for:", Deno.build.os) + return 'linux' } })() diff --git a/src/vendor/Path.ts b/src/vendor/Path.ts index 1858d899c..7fa205cdf 100644 --- a/src/vendor/Path.ts +++ b/src/vendor/Path.ts @@ -28,16 +28,10 @@ export default class Path { static home(): Path { return new Path((() => { switch (Deno.build.os) { - case "linux": - case "darwin": - case "freebsd": - case "netbsd": - case "aix": - case "solaris": - case "illumos": - return Deno.env.get("HOME")! case "windows": return Deno.env.get("USERPROFILE")! + default: + return Deno.env.get("HOME")! } })()) }