-
Notifications
You must be signed in to change notification settings - Fork 1
/
scripts.yaml
43 lines (35 loc) · 1.35 KB
/
scripts.yaml
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
envFile:
- .env
env:
SPARQL_ENDPOINT: http://localhost:8080/orgs/${org}/repos/${repo}/branches/${branch}/
# these commands can be run using the `vr` cli tool: https://velociraptor.run
scripts:
install: deno cache --reload --lock=deno.lock src/*.ts
update: udd src/*.ts && deno cache --lock=deno.lock --lock-write src/*.ts
serve: deno run --allow-net --allow-read --allow-env src/server.ts
build-exec: deno compile --allow-net --allow-read --allow-env src/server.ts -o bin/server
build-docker: docker build -t openmbee/flexo-graphql --platform linux/amd64 .
push-docker: docker push openmbee/flexo-graphql
generate: |
# velociraptor appends the arg, so a function is used to usher it into a variable
:() {
SCHEMA="$1"
# assertion
if [ -z "$SCHEMA" ]; then echo "Usage: vr generate SCHEMA_FILE"; exit 1; fi
# output directory
mkdir -p build/
# generate the queries
deno run src/gen-client.ts < $SCHEMA > build/queries.graphql
# copy schema to build directory
cp $SCHEMA build/
# shell heredoc used for toml string
cat << EOF | sed 's/^ *//g' > build/pyproject.toml
[tool.ariadne-codegen]
schema_path = "schema.graphql"
queries_path = "queries.graphql"
EOF
# execute codegen from build directory
cd build/
ariadne-codegen
# close function scope and call it
};: