use libtea

This commit is contained in:
Max Howell 2023-06-19 10:05:52 -04:00
parent 9bcc0a5216
commit 6fd326ed46
3 changed files with 12 additions and 21 deletions

15
.github/deno.jsonc vendored
View file

@ -3,21 +3,12 @@
"allowJs": false,
"strict": true
},
"tasks": {
"typecheck": "deno check --unstable scripts/*.ts"
// ^^ doesn't work yet due to lack of glob support
},
"fmt": {
"files": {
"exclude": [
"./"
]
}
},
"tea": {
"dependencies": {
"deno.land": "^1.30"
}
},
"importMap": "https://raw.githubusercontent.com/teaxyz/cli/v0.23/import-map.json"
"imports": {
"tea": "https://deno.land/x/libtea@v0.6.2/mod.ts"
}
}

View file

@ -1,4 +1,5 @@
#!/usr/bin/env -S tea -E
/*---
args:
- deno
@ -11,13 +12,13 @@ dependencies:
deno.land: =1.34.2
---*/
import { usePantry } from "hooks"
import * as ARGV from "./utils/args.ts"
import { SQSClient, SendMessageCommand } from "npm:@aws-sdk/client-sqs@^3"
import { SNSClient, PublishCommand } from "npm:@aws-sdk/client-sns@^3"
import { panic } from "utils"
import * as ARGV from "./utils/args.ts"
import { hooks, utils } from "tea"
const { usePantry } = hooks
const region = Deno.env.get("AWS_REGION") ?? panic("No region specified")
const region = Deno.env.get("AWS_REGION") ?? utils.panic("No region specified")
const sqsClient = new SQSClient({ region })
const snsClient = new SNSClient({ region })
@ -26,7 +27,7 @@ const pantry = usePantry()
const pkgs = await ARGV.toArray(ARGV.pkgs())
for(const pkg of pkgs) {
try {
const yml = await pantry.getYAML(pkg).parse()
const yml = await pantry.project(pkg).yaml()
const project = pkg.project

View file

@ -1,6 +1,5 @@
import { Installation, Package, PackageRequirement } from "types"
import { useCellar } from "hooks"
import { parse } from "utils/pkg.ts"
import { Installation, Package, PackageRequirement, hooks, utils } from "tea"
const { useCellar } = hooks
/// processes Deno.args unless STDIN is not a TTY and has input
export async function *args(): AsyncGenerator<string> {
@ -39,7 +38,7 @@ export async function *pkgs(): AsyncGenerator<Package | PackageRequirement> {
for await (const arg of args()) {
const match = arg.match(/projects\/(.*)\/package.yml/)
const project = match ? match[1] : arg
yield parse(project)
yield utils.pkg.parse(project)
}
}