Skip to content

Commit 9ca0def

Browse files
n1ru4lardatan
andauthored
feat: tree-shake ability of all modules (#1472)
* export handling * more fixxxesss * Gooo * fix: test * extend extend extend * Fix CF example * Fix types * Some fixes * do not use exports map :) * fix: skip lb check * skip lib checks * adjust import * chore: update typescript output dir Co-authored-by: Arda TANRIKULU <[email protected]>
1 parent a28d6a3 commit 9ca0def

File tree

123 files changed

+629
-525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+629
-525
lines changed

bob.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

e2e/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"moduleResolution": "node",
77
"declaration": true,
88
"sourceMap": true,
9-
"resolveJsonModule": true
9+
"resolveJsonModule": true,
10+
"skipLibCheck": true
1011
},
1112
"include": ["./**/*.ts"]
1213
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Apollo Federation Example
2+
3+
Run Apollo Federation Subgraphs and Gateways using GraphQL Yoga.
4+
5+
Start Gateway and Services:
6+
7+
```bash
8+
yarn start
9+
```
10+
11+
Then visit `http://localhost:4000`

examples/apollo-federation/gateway/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ async function main() {
77
// Initialize the gateway
88
const gateway = new ApolloGateway({
99
serviceList: [
10-
{ name: 'accounts', url: 'http://localhost:4001' },
10+
{ name: 'accounts', url: 'http://localhost:4001/graphql' },
1111
// ...additional subgraphs...
1212
],
1313
})

examples/apollo-federation/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "apollo-federation-with-yoga",
2+
"name": "example-apollo-federation",
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {

examples/apollo-federation/service/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const yoga = createYoga({
3131
})
3232

3333
const server = createServer(yoga)
34+
3435
server.listen(4001, () => {
3536
console.log(`🚀 Server ready at http://localhost:4001`)
3637
})

examples/aws-lambda/lambda/graphql.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
import type { Handler } from '@aws-cdk/aws-lambda'
2-
import { createYoga } from 'graphql-yoga'
2+
import { createYoga, createSchema } from 'graphql-yoga'
33
import { configure } from '@vendia/serverless-express'
44

5-
const app = createYoga()
5+
const app = createYoga({
6+
graphqlEndpoint: '/graphql',
7+
landingPage: false,
8+
schema: createSchema({
9+
typeDefs: /* GraphQL */ `
10+
type Query {
11+
greetings: String
12+
}
13+
`,
14+
resolvers: {
15+
Query: {
16+
greetings: () =>
17+
'This is the `greetings` field of the root `Query` type',
18+
},
19+
},
20+
}),
21+
})
622

723
export const handler: Handler = configure({
824
app,

examples/aws-lambda/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "aws-lambda",
2+
"name": "example-aws-lambda",
33
"private": true,
44
"version": "0.0.0",
55
"bin": {

examples/azure-function/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "azure-function",
2+
"name": "example-azure-function",
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {

examples/azure-function/src/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AzureFunction, Context, HttpRequest } from '@azure/functions'
2-
import { createYoga } from 'graphql-yoga'
2+
import { createYoga, createSchema } from 'graphql-yoga'
33
import { Request } from '@whatwg-node/fetch'
44

55
const httpTrigger: AzureFunction = async function (
@@ -14,6 +14,19 @@ const httpTrigger: AzureFunction = async function (
1414
warn: context.log.warn,
1515
},
1616
graphqlEndpoint: '/api/yoga',
17+
schema: createSchema({
18+
typeDefs: /* GraphQL */ `
19+
type Query {
20+
greetings: String
21+
}
22+
`,
23+
resolvers: {
24+
Query: {
25+
greetings: () =>
26+
'This is the `greetings` field of the root `Query` type',
27+
},
28+
},
29+
}),
1730
})
1831
context.log('HTTP trigger function processed a request.')
1932

0 commit comments

Comments
 (0)