Created
January 28, 2019 04:38
-
-
Save hirota-ryo/ebb429c57db25f99a3bd584621fa81b5 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# アクセストークンが必要な場合はコメントを外す | |
#if [ $# -ne 1 ]; then | |
# set +x | |
# printf "\e[31m%s\n\e[m" "ERROE:" | |
# echo "任意のエラーメッセージ" | |
# exit 1 | |
#fi | |
set -v | |
# schema.jsonを配置しているディレクトリに移動 | |
cd | |
# サーバからschema.jsonを取得 | |
apollo schema:download --endpoint=エンドポイント | |
# アクセストークン有りVer | |
#apollo schema:download --endpoint=エンドポイント --header="Authorization: OAuth $1" | |
set +v | |
ret=$? | |
if [ $ret -ne 0 ]; then | |
printf "\e[31m%s\n\e[m" "ERROE:" | |
echo "schema.jsonの取得に失敗しました。" | |
exit 1 | |
fi | |
set -v | |
# API.swiftを更新 | |
# API.swiftの出力先は任意のディレクトリを指定 | |
apollo codegen:generate --queries="$(find . -name '*.graphql')" --schema=schema.json ./API.swift | |
# update_apollo.shが配置されているディレクトリに戻る | |
cd - | |
set +v | |
echo "Success update" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment