2022-04-26 15:14:19 +00:00
|
|
|
# https://taskfile.dev
|
|
|
|
|
|
|
|
version: "3"
|
|
|
|
|
|
|
|
tasks:
|
2022-04-26 20:24:37 +00:00
|
|
|
schemas:
|
|
|
|
sources: [ 'schemas-yaml/*' ]
|
|
|
|
generates: [ 'schemas-json/*' ]
|
|
|
|
cmds:
|
|
|
|
- fd -e yml -p ./schemas-yaml -x task schema SCHEMA='{}'
|
2022-04-26 15:14:19 +00:00
|
|
|
|
|
|
|
schema:
|
|
|
|
vars:
|
2022-04-26 20:24:37 +00:00
|
|
|
TRANSFORM:
|
|
|
|
sh: |
|
|
|
|
echo {{.SCHEMA}} | \
|
|
|
|
perl -lnE's/yml$/pl/; s/^/.\//; say if -f $_'
|
2022-04-26 15:14:19 +00:00
|
|
|
DEST:
|
|
|
|
sh: echo {{.SCHEMA}} | perl -pe's/ya?ml/json/g'
|
2022-04-26 16:43:37 +00:00
|
|
|
cmds:
|
2022-04-26 20:24:37 +00:00
|
|
|
- transerialize {{.SCHEMA}} {{.TRANSFORM}} {{.DEST}}
|
2022-04-26 16:43:37 +00:00
|
|
|
|
|
|
|
validate:
|
2022-04-26 21:43:26 +00:00
|
|
|
deps: [ schemas ]
|
2022-04-26 16:43:37 +00:00
|
|
|
silent: true
|
|
|
|
cmds:
|
|
|
|
- |
|
|
|
|
ajv validate \
|
|
|
|
--all-errors \
|
|
|
|
--errors=json \
|
|
|
|
--verbose \
|
2022-04-26 21:43:26 +00:00
|
|
|
--data \
|
2022-04-26 18:08:43 +00:00
|
|
|
-c ajv-keywords \
|
2022-04-26 20:24:37 +00:00
|
|
|
-r schemas-json/classes.json \
|
|
|
|
-s schemas-json/character.json \
|
2022-04-26 16:43:37 +00:00
|
|
|
-d {{.CLI_ARGS}}
|
2022-04-26 18:37:16 +00:00
|
|
|
test:
|
|
|
|
deps: [ schemas ]
|
|
|
|
cmds:
|
|
|
|
- vitest run
|