From bea01bff72593ab7bee53271db1f778b967cc0f0 Mon Sep 17 00:00:00 2001 From: Daniel Bisgrove Date: Mon, 24 Jun 2024 15:29:52 -0400 Subject: [PATCH 1/2] Previews are now just not main or staging. and due to the changes on stage, we need to generate the GQL from production --- amplify.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/amplify.yml b/amplify.yml index 9a65ba857..19fe670cd 100644 --- a/amplify.yml +++ b/amplify.yml @@ -6,14 +6,12 @@ frontend: - nvm install 18.13 - nvm use 18.13 - | - if [[ "${AWS_BRANCH_ARN#*/branches/}" == *"pr-"* ]]; then - PREVIEW_URL="https://${AWS_BRANCH_ARN#*/branches/}.${AWS_APP_ID}.amplifyapp.com"; - NEXTAUTH_URL=$PREVIEW_URL; - echo "PREVIEW_URL=$PREVIEW_URL" >> .env; - elif [[ "${AWS_BRANCH}" != "main" && "${AWS_BRANCH}" != "staging" ]]; then + if [[ "${AWS_BRANCH}" != "main" && "${AWS_BRANCH}" != "staging" ]]; then PREVIEW_URL="https://${AWS_BRANCH}.${AWS_APP_ID}.amplifyapp.com"; NEXTAUTH_URL=$PREVIEW_URL; echo "PREVIEW_URL=$PREVIEW_URL" >> .env; + export API_URL=https://api.mpdx.org/graphql + export REST_API_URL=https://api.mpdx.org/api/v2/ fi - echo "NEXTAUTH_URL=$NEXTAUTH_URL" >> .env - echo "NODE_ENV=$NODE_ENV" >> .env @@ -23,6 +21,11 @@ frontend: - yarn - yarn disable-telemetry - yarn gql + - | + if [[ "${AWS_BRANCH}" != "main" && "${AWS_BRANCH}" != "staging" ]]; then + export API_URL=https://api.stage.mpdx.org/graphql + export REST_API_URL=https://api.stage.mpdx.org/api/v2/ + fi build: commands: - yarn build:amplify From 8de6e05d78383d67040fe3488c0d4405cdde9daf Mon Sep 17 00:00:00 2001 From: Daniel Bisgrove Date: Mon, 24 Jun 2024 15:30:28 -0400 Subject: [PATCH 2/2] Call the production GraphQL server when creating generated GraphQL on local machine --- codegen.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/codegen.yml b/codegen.yml index d3dc9bd9e..8ab198666 100644 --- a/codegen.yml +++ b/codegen.yml @@ -1,7 +1,7 @@ generates: ./src/graphql/types.generated.ts: schema: - - ${API_URL:https://api.stage.mpdx.org/graphql} + - ${API_URL:https://api.mpdx.org/graphql} - ./pages/api/Schema/**/*.graphql plugins: - typescript @@ -11,7 +11,7 @@ generates: ISO8601DateTime: string ./: schema: - - ${API_URL:https://api.stage.mpdx.org/graphql} + - ${API_URL:https://api.mpdx.org/graphql} - ./pages/api/Schema/**/*.graphql documents: '**/*.graphql' preset: near-operation-file @@ -24,19 +24,19 @@ generates: preResolveTypes: false ./src/graphql/schema.graphql: schema: - - ${API_URL:https://api.stage.mpdx.org/graphql} + - ${API_URL:https://api.mpdx.org/graphql} - ./pages/api/Schema/**/*.graphql plugins: - schema-ast ./src/graphql/possibleTypes.generated.ts: schema: - - ${API_URL:https://api.stage.mpdx.org/graphql} + - ${API_URL:https://api.mpdx.org/graphql} - ./pages/api/Schema/**/*.graphql plugins: - fragment-matcher ./pages/api/graphql-rest.page.generated.ts: schema: - - ${API_URL:https://api.stage.mpdx.org/graphql} + - ${API_URL:https://api.mpdx.org/graphql} - ./pages/api/Schema/**/*.graphql plugins: - typescript @@ -48,7 +48,7 @@ generates: ISO8601Date: string ISO8601DateTime: string ./src/graphql/rootFields.generated.ts: - schema: ${API_URL:https://api.stage.mpdx.org/graphql} + schema: ${API_URL:https://api.mpdx.org/graphql} plugins: - ./extractRootFields.js hooks: