Skip to content

Commit 11ebb0c

Browse files
authored
Update code for all dependency major version upgrades (#28)
1 parent 593d9de commit 11ebb0c

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ After building and deploying the function, you need to [enable custom schema che
3535
1. Run a schema check using the [Rover CLI](https://www.apollographql.com/docs/rover/) to test the integration.
3636
- You should see check results in GraphOS Studio on the **Checks** page. You can also verify logs in the Netlify console.
3737

38-
3938
## Example Github PR implementation
4039

4140
This example implementation also deploys a [Netlify function](https://www.netlify.com/platform/core/functions/) that can be used to set up a webhook integration with GraphOS [schema checks](https://www.apollographql.com/docs/graphos/delivery/schema-checks).

src/eslint.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as graphql from '@graphql-eslint/eslint-plugin';
55
import type { Config, Context } from '@netlify/functions';
66
import { ESLint, Linter } from 'eslint';
77

8-
const linter = new Linter({ cwd: '.' });
8+
const linter = new Linter({ cwd: process.cwd() });
99

1010
function getSourceLocationCoordiante(
1111
code: string,
@@ -24,7 +24,7 @@ function getSourceLocationCoordiante(
2424

2525
const apolloClient = new ApolloClient({
2626
uri:
27-
Netlify.env.get('APOLLO_STUDIO_URL') ??
27+
process.env.APOLLO_STUDIO_URL ??
2828
'https://api.apollographql.com/api/graphql',
2929
cache: new InMemoryCache(),
3030
});
@@ -97,8 +97,8 @@ interface Payload {
9797
}
9898

9999
export default async function customLint(req: Request, context: Context) {
100-
const hmacSecret = Netlify.env.get('APOLLO_HMAC_TOKEN') || '';
101-
const apiKey = Netlify.env.get('APOLLO_API_KEY') || '';
100+
const hmacSecret = process.env.APOLLO_HMAC_TOKEN || '';
101+
const apiKey = process.env.APOLLO_API_KEY || '';
102102

103103
const payload = (await req.text()) || '{}';
104104
console.log(`Payload: ${payload}`);
@@ -163,7 +163,7 @@ export default async function customLint(req: Request, context: Context) {
163163
plugins: {
164164
'@graphql-eslint': graphql as unknown as ESLint.Plugin,
165165
},
166-
rules: graphql.flatConfigs['schema-recommended']
166+
rules: graphql.configs['flat/schema-recommended']
167167
.rules as unknown as Linter.RulesRecord,
168168
languageOptions: {
169169
parser: graphql,

src/github.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Context } from '@netlify/functions';
44

55
const graphOSClient = new ApolloClient({
66
uri:
7-
Netlify.env.get('APOLLO_STUDIO_URL') ??
7+
process.env.APOLLO_STUDIO_URL ??
88
'https://api.apollographql.com/api/graphql',
99
cache: new InMemoryCache(),
1010
});
@@ -64,8 +64,8 @@ const pullRequestQuery = gql`
6464
`;
6565

6666
export default async function pullRequestCheck(req: Request, context: Context) {
67-
const hmacSecret = Netlify.env.get('APOLLO_HMAC_TOKEN') || '';
68-
const apiKey = Netlify.env.get('APOLLO_API_KEY') || '';
67+
const hmacSecret = process.env.APOLLO_HMAC_TOKEN || '';
68+
const apiKey = process.env.APOLLO_API_KEY || '';
6969

7070
const payload = (await req.text()) || '{}';
7171
console.log(`Payload: ${payload}`);
@@ -81,13 +81,13 @@ export default async function pullRequestCheck(req: Request, context: Context) {
8181
const prResult = await githubClient.query({
8282
query: pullRequestQuery,
8383
variables: {
84-
owner: Netlify.env.get('GITHUB_OWNER'),
85-
name: Netlify.env.get('GITHUB_REPO'),
84+
owner: process.env.GITHUB_OWNER,
85+
name: process.env.GITHUB_REPO,
8686
branch: event.checkStep.gitContext.branch,
8787
},
8888
context: {
8989
headers: {
90-
Authorization: `Bearer ${Netlify.env.get('GITHUB_TOKEN')}`,
90+
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
9191
},
9292
},
9393
});

0 commit comments

Comments
 (0)