mirror of
https://github.com/ivabus/pantry
synced 2024-09-20 00:30:48 +03:00
use libtea
This commit is contained in:
parent
9bcc0a5216
commit
6fd326ed46
15
.github/deno.jsonc
vendored
15
.github/deno.jsonc
vendored
|
@ -3,21 +3,12 @@
|
||||||
"allowJs": false,
|
"allowJs": false,
|
||||||
"strict": true
|
"strict": true
|
||||||
},
|
},
|
||||||
"tasks": {
|
|
||||||
"typecheck": "deno check --unstable scripts/*.ts"
|
|
||||||
// ^^ doesn't work yet due to lack of glob support
|
|
||||||
},
|
|
||||||
"fmt": {
|
|
||||||
"files": {
|
|
||||||
"exclude": [
|
|
||||||
"./"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tea": {
|
"tea": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"deno.land": "^1.30"
|
"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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
11
.github/scripts/index-packages.ts
vendored
11
.github/scripts/index-packages.ts
vendored
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env -S tea -E
|
#!/usr/bin/env -S tea -E
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
args:
|
args:
|
||||||
- deno
|
- deno
|
||||||
|
@ -11,13 +12,13 @@ dependencies:
|
||||||
deno.land: =1.34.2
|
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 { SQSClient, SendMessageCommand } from "npm:@aws-sdk/client-sqs@^3"
|
||||||
import { SNSClient, PublishCommand } from "npm:@aws-sdk/client-sns@^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 sqsClient = new SQSClient({ region })
|
||||||
const snsClient = new SNSClient({ region })
|
const snsClient = new SNSClient({ region })
|
||||||
|
|
||||||
|
@ -26,7 +27,7 @@ const pantry = usePantry()
|
||||||
const pkgs = await ARGV.toArray(ARGV.pkgs())
|
const pkgs = await ARGV.toArray(ARGV.pkgs())
|
||||||
for(const pkg of pkgs) {
|
for(const pkg of pkgs) {
|
||||||
try {
|
try {
|
||||||
const yml = await pantry.getYAML(pkg).parse()
|
const yml = await pantry.project(pkg).yaml()
|
||||||
|
|
||||||
const project = pkg.project
|
const project = pkg.project
|
||||||
|
|
||||||
|
|
7
.github/scripts/utils/args.ts
vendored
7
.github/scripts/utils/args.ts
vendored
|
@ -1,6 +1,5 @@
|
||||||
import { Installation, Package, PackageRequirement } from "types"
|
import { Installation, Package, PackageRequirement, hooks, utils } from "tea"
|
||||||
import { useCellar } from "hooks"
|
const { useCellar } = hooks
|
||||||
import { parse } from "utils/pkg.ts"
|
|
||||||
|
|
||||||
/// processes Deno.args unless STDIN is not a TTY and has input
|
/// processes Deno.args unless STDIN is not a TTY and has input
|
||||||
export async function *args(): AsyncGenerator<string> {
|
export async function *args(): AsyncGenerator<string> {
|
||||||
|
@ -39,7 +38,7 @@ export async function *pkgs(): AsyncGenerator<Package | PackageRequirement> {
|
||||||
for await (const arg of args()) {
|
for await (const arg of args()) {
|
||||||
const match = arg.match(/projects\/(.*)\/package.yml/)
|
const match = arg.match(/projects\/(.*)\/package.yml/)
|
||||||
const project = match ? match[1] : arg
|
const project = match ? match[1] : arg
|
||||||
yield parse(project)
|
yield utils.pkg.parse(project)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue