-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make command to generate types from typed metadata in languages other…
… than Typescript PR-URL: hasura/graphql-engine-mono#8238 GitOrigin-RevId: 9a4730e0d311916c0d837586485382c58033c914
- Loading branch information
1 parent
a119260
commit 69c8e8b
Showing
4 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
go/ | ||
haskell/ | ||
rust/ | ||
kotlin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null 2>&1 && pwd )" # ... https://stackoverflow.com/a/246128/176841 | ||
|
||
LANG="$1" | ||
FILE="$2" | ||
# We are generating types from already generated Typescript types. | ||
# `index.js`` is the file that contains the Typescript types | ||
INDEX_JS="${PROJECT_ROOT}/typescript/src/index.ts" | ||
|
||
# Dir where generated types will be published. | ||
DIR="${PROJECT_ROOT}/${LANG}" | ||
|
||
if [ ! -d "${DIR}" ]; then | ||
mkdir "${DIR}" | ||
fi | ||
|
||
# npm package used to generate types. | ||
# Use `quicktype --help` to see a list of supported languages. | ||
# Use `npm i -g quicktype` to install. | ||
quicktype --lang "${LANG}" \ | ||
--out "${DIR}/${FILE}" \ | ||
--src-lang typescript \ | ||
--src "${INDEX_JS}" # add --quiet to silence output |
File renamed without changes.