@lewebsimple/nuxt-graphql 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -1
- package/dist/module.json +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -23,6 +23,25 @@ Install the module to your Nuxt application with one command:
|
|
|
23
23
|
npx nuxi module add @lewebsimple/nuxt-graphql
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
Optionnally adjust options in your Nuxt config. The defaults shown below:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
// nuxt.config.ts
|
|
30
|
+
export default defineNuxtConfig({
|
|
31
|
+
modules: ["@lewebsimple/nuxt-graphql"],
|
|
32
|
+
graphql: {
|
|
33
|
+
// GraphQL HTTP endpoint served by Yoga
|
|
34
|
+
endpoint: "/api/graphql",
|
|
35
|
+
// Codegen controls document scanning and outputs
|
|
36
|
+
codegen: {
|
|
37
|
+
enabled: true,
|
|
38
|
+
pattern: "**/*.gql", // scan .gql files across layers
|
|
39
|
+
schemaOutput: "server/graphql/schema.graphql", // saved SDL
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
26
45
|
Define your GraphQL schema in `server/graphql/schema.ts`:
|
|
27
46
|
|
|
28
47
|
```ts
|
|
@@ -43,7 +62,7 @@ export const schema = createSchema<GraphQLContext>({
|
|
|
43
62
|
});
|
|
44
63
|
```
|
|
45
64
|
|
|
46
|
-
|
|
65
|
+
Optionnally define your GraphQL context in `server/graphql/context.ts`:
|
|
47
66
|
|
|
48
67
|
```ts
|
|
49
68
|
import type { H3Event } from "h3";
|
|
@@ -59,6 +78,7 @@ export type GraphQLContext = Awaited<ReturnType<typeof createContext>>;
|
|
|
59
78
|
|
|
60
79
|
That's it! You can now use Nuxt GraphQL in your Nuxt app ✨
|
|
61
80
|
|
|
81
|
+
Yoga GraphiQL is available at `http://localhost:3000/api/graphql` by default.
|
|
62
82
|
|
|
63
83
|
## Contribution
|
|
64
84
|
|
package/dist/module.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lewebsimple/nuxt-graphql",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Opinionated Nuxt module for using GraphQL",
|
|
5
5
|
"repository": "lewebsimple/nuxt-graphql",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dev": "npm run dev:prepare && nuxi dev playground",
|
|
28
28
|
"dev:build": "nuxi build playground",
|
|
29
29
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
30
|
-
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish
|
|
30
|
+
"release": "npm run lint && npm run test && npm run prepack && changelogen --release --push && npm publish",
|
|
31
31
|
"lint": "eslint .",
|
|
32
32
|
"test": "vitest run",
|
|
33
33
|
"test:watch": "vitest watch",
|
|
@@ -64,5 +64,10 @@
|
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
|
+
},
|
|
68
|
+
"changlog": {
|
|
69
|
+
"types": {
|
|
70
|
+
"chore": false
|
|
71
|
+
}
|
|
67
72
|
}
|
|
68
73
|
}
|