-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPkl.yml
More file actions
62 lines (55 loc) · 1.68 KB
/
Copy pathPkl.yml
File metadata and controls
62 lines (55 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
version: '3'
vars:
PROXY: package://pkg.pkl-lang.org/pkl-pantry
NAME: org.json_schema.contrib
VERSION: 1.1.3
PKG: "{{.PROXY}}/{{.NAME}}@{{.VERSION}}#"
ROOT_DIR:
sh: git rev-parse --show-toplevel
tasks:
download:
desc: Install go dependencies
silent: true
vars:
DEPS:
[
"github.com/apple/pkl-go/cmd/pkl-gen-go@latest",
"github.com/sqlc-dev/sqlc/cmd/sqlc@latest",
"github.com/goreleaser/goreleaser/v2@latest",
"github.com/a-h/templ/cmd/templ@latest",
]
cmds:
- for: { var: DEPS }
cmd: gum spin --spinner dot --title "Installing go dependencies..." -- go install {{.ITEM}}
jsonpkl-*:
dir: '{{.ROOT_DIR}}'
vars:
FILE: '{{index .MATCH 0}}'
cmds:
- task: schemagen-{{.FILE}}
- task: gojson-{{.FILE}}
pkljson-*:
dir: '{{.ROOT_DIR}}'
vars:
INPUT: '{{index .MATCH 0}}'
cmds:
- pkl eval {{.PKG}}/generate.pkl -m . -p source=types/schemas/{{.INPUT}}
- mv *.pkl pkl/
gojson-*:
dir: '{{.ROOT_DIR}}'
vars:
INPUT: '{{index .MATCH 0}}'
GOOUT:
sh: echo {{.INPUT}} | sed 's/\.json//'
FLAGS: --schema-output=http://json-schema.org/draft-04/schema#=internal/models/{{.GOOUT}}.go --schema-package=http://json-schema.org/draft-04/schema#=github.com/prnk28/gh-pm
cmds:
- go-jsonschema {{.FLAGS}} -p models types/schemas/{{.INPUT}} > internal/models/{{.GOOUT}}.go
schemagen-*:
dir: '{{.ROOT_DIR}}'
vars:
INPUT: '{{index .MATCH 0}}'
OUTPUT:
sh: basename {{.INPUT}}
cmds:
- mkdir -p types/schemas
- json-schema-generator -f types/base/{{.INPUT}} -o types/schemas/{{.OUTPUT}}