From 1308d16d8fcf7c4e669825087142bcc12fd2e666 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 5 Jan 2024 07:38:26 -0500 Subject: [PATCH 1/2] =?UTF-8?q?Don=E2=80=99t=20abort=20if=20a=20single=20e?= =?UTF-8?q?ntry=20cannot=20be=20parsed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/usePantry.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hooks/usePantry.ts b/src/hooks/usePantry.ts index 3317954..8b96da2 100644 --- a/src/hooks/usePantry.ts +++ b/src/hooks/usePantry.ts @@ -174,8 +174,10 @@ export default function usePantry() { rv.push(proj) continue } - const yaml = await proj.yaml() - if (yaml["display-name"]?.toLowerCase() == name) { + const yaml = await proj.yaml().swallow() + if (!yaml) { + console.warn("warn: parse failure:", pkg.project) + } else if (yaml["display-name"]?.toLowerCase() == name) { rv.push(proj) } else if ((await proj.provides()).map(x => x.toLowerCase()).includes(name)) { rv.push(proj) From e07ec692f01b823a779e41e64df8c9b15c46b620 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 5 Jan 2024 07:42:03 -0500 Subject: [PATCH 2/2] Move this to brewkit New deno requires `--allow-sys` for this but only brewkit needs this --- src/hooks/useMoustaches.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/hooks/useMoustaches.ts b/src/hooks/useMoustaches.ts index 261bb43..116cbf7 100644 --- a/src/hooks/useMoustaches.ts +++ b/src/hooks/useMoustaches.ts @@ -2,8 +2,6 @@ import { Package, Installation } from "../types.ts" import SemVer from "../utils/semver.ts" import useConfig from "./useConfig.ts" import useCellar from "./useCellar.ts" -import host from "../utils/host.ts" -import * as os from "node:os" function tokenizePackage(pkg: Package) { return [{ from: "prefix", to: useCellar().keg(pkg).string }] @@ -25,17 +23,6 @@ function tokenizeVersion(version: SemVer, prefix = 'version') { return rv } -//TODO replace `hw` with `host` -function tokenizeHost() { - const { arch, target, platform } = host() - return [ - { from: "hw.arch", to: arch }, - { from: "hw.target", to: target }, - { from: "hw.platform", to: platform }, - { from: "hw.concurrency", to: os.cpus().length.toString() } - ] -} - function apply(input: string, map: { from: string, to: string }[]) { return map.reduce((acc, {from, to}) => acc.replace(new RegExp(`(^\\$)?{{\\s*${from}\\s*}}`, "g"), to), @@ -48,7 +35,6 @@ export default function() { apply, tokenize: { version: tokenizeVersion, - host: tokenizeHost, pkg: tokenizePackage } } @@ -69,7 +55,6 @@ export default function() { ...tokenizePackage(pkg), ...pkgx(), ...base.tokenize.version(pkg.version), - ...base.tokenize.host(), ] return {