Skip to content

Commit 8bb797e

Browse files
authored
Install prettier in repository (#15)
1 parent f7d2e70 commit 8bb797e

File tree

8 files changed

+43
-16
lines changed

8 files changed

+43
-16
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package.json
2+
dist/
3+
node_modules/

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"arrowParens": "always",
3+
"singleQuote": true,
4+
"trailingComma": "all"
5+
}

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This repository contains a sample validation service for GraphOS [custom schema
1010
This example implementation 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).
1111

1212
This example Netlify function does the following:
13+
1314
- Receives the [webhook payload](http://localhost:3000/graphos/delivery/custom-checks#webhook-format) from GraphOS.
1415
- Validates the HMAC value in the `x-apollo-signature` header.
1516
- Downloads the composed supergraph.
@@ -23,13 +24,13 @@ After building and deploying the function, you need to [enable custom schema che
2324
1. Set up a Netlify account, then install and authenticate with [Netlify CLI](https://docs.netlify.com/cli/get-started/).
2425
1. Install dependencies and build function code. `$ npm install ; npm run build`
2526
1. To deploy to Netlify, follow the CLI instructions for creating and configuring a new site. `$ netlify deploy`
26-
- When asked for the publish directory, use the default root directory. The `netlify.toml` file has a pointer to the `dist/` to upload the built function.
27+
- When asked for the publish directory, use the default root directory. The `netlify.toml` file has a pointer to the `dist/` to upload the built function.
2728
1. Pull up site you created in the [Netlify web console](https://app.netlify.com/).
2829
1. In the Netlify console, go to **Site configuration > Environment variables**. Add and upload values for the environment variables: `APOLLO_HMAC_TOKEN` and `APOLLO_API_KEY`.
29-
- The `APOLLO_HMAC_TOKEN` should be any string that will be used to calculate the `x-apollo-signature header`.
30-
- The `APOLLO_API_KEY` is a [GraphOS API key](https://www.apollographql.com/docs/graphos/api-keys/) with sufficient permissions to run schema checks for the graph you're integrating this application with.
30+
- The `APOLLO_HMAC_TOKEN` should be any string that will be used to calculate the `x-apollo-signature header`.
31+
- The `APOLLO_API_KEY` is a [GraphOS API key](https://www.apollographql.com/docs/graphos/api-keys/) with sufficient permissions to run schema checks for the graph you're integrating this application with.
3132
1. Deploy the function to production. `$ netlify deploy --prod`
3233
1. From your terminal, copy the **Website URL** plus the path `/custom-lint` and go to [GraphOS Studio](https://studio.apollographql.com/).
3334
1. In the graph you're integrating this with go to **Checks > Configuration** and enable custom checks, registering the function URL and entering your `APOLLO_HMAC_TOKEN` as the secret token.
3435
1. Run a schema check using the [Rover CLI](https://www.apollographql.com/docs/rover/) to test the integration.
35-
- You should see check results in GraphOS Studio on the **Checks** page. You can also verify logs in the Netlify console.
36+
- You should see check results in GraphOS Studio on the **Checks** page. You can also verify logs in the Netlify console.

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"scripts": {
77
"build": "tsc",
88
"start": "netlify dev",
9-
"prestart": "npm run build"
9+
"prestart": "npm run prettier:check ; npm run build",
10+
"prettier:write": "npx prettier . --write",
11+
"prettier:check": "npx prettier . --check"
1012
},
1113
"keywords": [],
1214
"author": "",
@@ -23,6 +25,7 @@
2325
"devDependencies": {
2426
"@types/eslint": "^9.6.0",
2527
"json-schema-to-ts": "^3.1.0",
28+
"prettier": "3.3.3",
2629
"typescript": "^5.5.4"
2730
}
2831
}

renovate.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": [
4-
"config:recommended"
5-
]
3+
"extends": ["config:recommended"]
64
}

src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ function getSourceLocationCoordiante(
1717
return {
1818
line,
1919
column,
20-
byteOffset: [...lines.slice(0, -1), lastLine.slice(0, column)].join('\n')
21-
.length - 1,
20+
byteOffset:
21+
[...lines.slice(0, -1), lastLine.slice(0, column)].join('\n').length - 1,
2222
};
2323
}
2424

@@ -198,12 +198,12 @@ export default async (req: Request, context: Context) => {
198198
start: startSourceLocationCoordiante,
199199
end:
200200
typeof violation.endLine === 'number' &&
201-
typeof violation.endColumn === 'number'
201+
typeof violation.endColumn === 'number'
202202
? getSourceLocationCoordiante(
203-
code,
204-
violation.endLine,
205-
violation.endColumn,
206-
)
203+
code,
204+
violation.endLine,
205+
violation.endColumn,
206+
)
207207
: startSourceLocationCoordiante,
208208
},
209209
],

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
},
1010
"include": ["src/**/*"],
1111
"exclude": ["node_modules"]
12-
}
12+
}

0 commit comments

Comments
 (0)