forked from Open-MBEE/flexo-graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.yaml
39 lines (32 loc) · 1.13 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
# 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
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
};:
envFile:
- .env
env:
SPARQL_ENDPOINT: http://localhost:8080/orgs/${org}/repos/${repo}/branches/${branch}/