- Notifications
You must be signed in to change notification settings - Fork 27
chore(tooling): generation script for all language and clients APIC-221 #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
24e312e ba35760 959ac8b a8066d5 493594a 93b1434 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/bin/bash | ||
| | ||
| # Break on non-zero code | ||
| set -e | ||
| | ||
| LANGUAGE=$1 | ||
| CLIENT=$2 | ||
| | ||
| LANGUAGES=(javascript) | ||
| CLIENTS=(search recommend personalization) | ||
| | ||
| DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" | ||
| # Move to the root (easier to locate other scripts) | ||
| cd ${DIR}/.. | ||
| | ||
| generate_client() { | ||
| local lang=$1 | ||
| local client=$2 | ||
| echo "Generating code for ${lang}-${client}" | ||
| yarn openapi-generator-cli generate --generator-key "${lang}-${client}" | ||
| ||
| | ||
| # run the post generation script if it exists (linting and additional files) | ||
| ||
| local postgen="./scripts/post-gen/${lang}.sh" | ||
| if [[ -f "$postgen" ]]; then | ||
| $postgen $client | ||
| fi | ||
| } | ||
| | ||
| if [[ $LANGUAGE == "all" ]]; then | ||
| LANGUAGE=("${LANGUAGES[@]}") | ||
| elif [[ " ${LANGUAGES[*]} " =~ " ${LANGUAGE} " ]]; then | ||
| LANGUAGE=($LANGUAGE) | ||
| else | ||
| echo "Unknown language ${LANGUAGE}" | ||
| exit 1 | ||
| fi | ||
| | ||
| if [[ $CLIENT == "all" ]]; then | ||
| CLIENT=("${CLIENTS[@]}") | ||
| elif [[ " ${CLIENTS[*]} " =~ " ${CLIENT} " ]]; then | ||
| CLIENT=($CLIENT) | ||
| else | ||
| echo "Unknown client ${CLIENT}" | ||
| exit 1 | ||
| fi | ||
| | ||
| for lang in "${LANGUAGE[@]}"; do | ||
| for client in "${CLIENT[@]}"; do | ||
| generate_client $lang $client | ||
| done | ||
| done | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| client=$1 | ||
| | ||
| export CLIENT=$(cat openapitools.json | yarn json "generator-cli.generators.javascript-${client}.output" | sed 's/#{cwd}\///g') | ||
| mkdir -p $CLIENT/utils | ||
| cp -R clients/algoliasearch-client-javascript/utils/ $CLIENT/utils | ||
| | ||
| yarn lint:client:fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier is a formatter hence the
formatinstead oflintbut I don't have a strong opinion