Skip to content

Commit cc3c18d

Browse files
jhheidermxcl
authored andcommitted
platform > platforms
1 parent 9c0f571 commit cc3c18d

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

deno.jsonc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
},
1010
"fmt": {
1111
"files": {
12-
"exclude": [
13-
"./"
14-
]
12+
"exclude": ["./"]
1513
}
1614
},
1715
"tea": {
1816
"dependencies": {
1917
"deno.land": "^1.30"
2018
}
2119
},
22-
"importMap": "https://raw.githubusercontent.com/teaxyz/cli/v0.29/import-map.json"
20+
"importMap": "https://raw.githubusercontent.com/teaxyz/cli/v0.30/import-map.json"
2321
}

lib/usePantry.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// deno-lint-ignore-file no-cond-assign
22
import { Package, PackageRequirement, Installation } from "types"
3-
import { host, flatmap, undent, validate_plain_obj, validate_str, validate_arr, pkg, TeaError, panic } from "utils"
3+
import { host, flatmap, undent, validate_plain_obj, validate_str, validate_arr, pkg, TeaError } from "utils"
44
import { isNumber, isPlainObject, isString, isArray, isPrimitive, PlainObject, isBoolean } from "is_what"
55
import { validatePackageRequirement } from "utils/hacks.ts"
66
import { useCellar, usePrefix, usePantry as usePantryBase } from "hooks"
@@ -76,15 +76,15 @@ const getYAML = (pkg: Package | PackageRequirement) => {
7676
}
7777

7878
const getPlatforms = async (pkg: Package | PackageRequirement) => {
79-
let { platform } = await entry(pkg).yml()
80-
if (!platform) return ["linux/x86-64", "linux/aarch64", "darwin/x86-64", "darwin/aarch64"]
81-
if (isString(platform)) platform = [platform]
82-
if (!isArray(platform)) throw new Error(`invalid platform node: ${platform}`)
79+
let { platforms } = await entry(pkg).yml()
80+
if (!platforms) return ["linux/x86-64", "linux/aarch64", "darwin/x86-64", "darwin/aarch64"]
81+
if (isString(platforms)) platforms = [platforms]
82+
if (!isArray(platforms)) throw new Error(`invalid platform node: ${platforms}`)
8383
const rv = []
84-
for (const p of platform) {
85-
if (p.match(/^(linux|darwin)\/(aarch64|x86-64)$/)) rv.push(p)
86-
else if (p.match(/^(linux|darwin)$/)) rv.push(`${p}/x86-64`, `${p}/aarch64`)
87-
else throw new Error(`invalid platform: ${p}`)
84+
for (const platform of platforms) {
85+
if (platform.match(/^(linux|darwin)\/(aarch64|x86-64)$/)) rv.push(platform)
86+
else if (platform.match(/^(linux|darwin)$/)) rv.push(`${platform}/x86-64`, `${platform}/aarch64`)
87+
else throw new Error(`invalid platform: ${platform}`)
8888
}
8989
return rv
9090
}
@@ -289,7 +289,7 @@ function escapeRegExp(string: string) {
289289
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // $& means the whole matched string
290290
}
291291

292-
async function handleComplexVersions(versions: PlainObject): Promise<SemVer[]> {
292+
function handleComplexVersions(versions: PlainObject): Promise<SemVer[]> {
293293
if (versions.github) return handleGitHubVersions(versions)
294294
if (versions.url) return handleURLVersions(versions)
295295

0 commit comments

Comments
 (0)