Skip to content

Commit ca7bc9c

Browse files
authored
add support for usePantry().available() (#87)
* add support for `usePantry().available()` * deps bump
1 parent e948a70 commit ca7bc9c

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

bin/pkg-build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ fi
1313
d="$(cd "$(dirname "$0")"/.. && pwd)"
1414
PATH="$d/libexec:$PATH"
1515

16+
if ! available.ts "$@"; then
17+
echo "warning: not supported on current platform" >&2
18+
if test -n "$GITHUB_ACTIONS"; then
19+
echo "unavailable=true" >> "$GITHUB_ENV"
20+
fi
21+
exit 0
22+
fi
23+
1624
if test -z "$1"; then
1725
if test -z "$TEA_PANTRY_PATH"; then
1826
echo "error: TEA_PANTRY_PATH is not set" >&2

bin/pkg-test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ set -e
55
d="$(cd "$(dirname "$0")"/.. && pwd)"
66
PATH="$d/libexec:$PATH"
77

8+
if ! available.ts "$@"; then
9+
echo "warning: not supported on current platform" >&2
10+
if test -n "$GITHUB_ACTIONS"; then
11+
echo "unavailable=true" >> "$GITHUB_ENV"
12+
fi
13+
exit 0
14+
fi
15+
816
if test -z "$1"; then
917
if test -z "$TEA_PANTRY_PATH"; then
1018
echo "error: TEA_PANTRY_PATH is not set" >&2

deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
"deno.land": "^1.30"
2020
}
2121
},
22-
"importMap": "https://raw.githubusercontent.com/teaxyz/cli/v0.27/import-map.json"
22+
"importMap": "https://raw.githubusercontent.com/teaxyz/cli/v0.29/import-map.json"
2323
}

lib/init().ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function createConfig(): Config {
2828
debug: verbosity >= Verbosity.debug,
2929
silent: verbosity <= Verbosity.quiet,
3030
env,
31+
json: false
3132
}
3233
}
3334

libexec/available.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env -S deno run --allow-env --allow-read
2+
3+
import { parseFlags } from "cliffy/flags/mod.ts"
4+
import { usePantry } from "hooks"
5+
import { parse } from "utils/pkg.ts"
6+
7+
import tea_init from "../lib/init().ts"
8+
tea_init()
9+
10+
const { unknown: pkgnames } = parseFlags(Deno.args)
11+
12+
const pantry = usePantry()
13+
14+
for(const pkg of pkgnames.map(parse)) {
15+
if (!await pantry.available(pkg)) {
16+
Deno.exit(1)
17+
}
18+
}

0 commit comments

Comments
 (0)