Skip to content

Commit 83b992c

Browse files
committed
initial commit
1 parent 3f5ddbd commit 83b992c

16 files changed

+7878
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_size = 2
5+
indent_style = space
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
node_modules

.eslintrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": [
3+
"@nuxtjs/eslint-config-typescript"
4+
],
5+
"rules": {
6+
"@typescript-eslint/no-unused-vars": [
7+
"off"
8+
]
9+
}
10+
}

.gitignore

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Dependencies
2+
node_modules
3+
4+
# Logs
5+
*.log*
6+
7+
# Temp directories
8+
.temp
9+
.tmp
10+
.cache
11+
12+
# Yarn
13+
**/.yarn/cache
14+
**/.yarn/*state*
15+
16+
# Generated dirs
17+
dist
18+
19+
# Nuxt
20+
.nuxt
21+
.output
22+
.vercel_build_output
23+
.build-*
24+
.env
25+
.netlify
26+
27+
# Env
28+
.env
29+
30+
# Testing
31+
reports
32+
coverage
33+
*.lcov
34+
.nyc_output
35+
36+
# VSCode
37+
.vscode/*
38+
!.vscode/settings.json
39+
!.vscode/tasks.json
40+
!.vscode/launch.json
41+
!.vscode/extensions.json
42+
!.vscode/*.code-snippets
43+
44+
# Intellij idea
45+
*.iml
46+
.idea
47+
48+
# OSX
49+
.DS_Store
50+
.AppleDouble
51+
.LSOverride
52+
.AppleDB
53+
.AppleDesktop
54+
Network Trash Folder
55+
Temporary Items
56+
.apdisk

.nuxtrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
imports.autoImport=false

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Nuxt Module
2+
3+
## Development
4+
5+
- Run `npm run dev:prepare` to generate type stubs.
6+
- Use `npm run dev` to start [playground](./playground) in development mode.

package.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "nuxt-codegen",
3+
"description": "GraphQL Code Generator module for Nuxt 3",
4+
"author": "Eugen Istoc",
5+
"version": "1.0.0",
6+
"license": "MIT",
7+
"type": "module",
8+
"exports": {
9+
".": {
10+
"import": "./dist/module.mjs",
11+
"require": "./dist/module.cjs"
12+
}
13+
},
14+
"main": "./dist/module.cjs",
15+
"types": "./dist/types.d.ts",
16+
"files": [
17+
"dist"
18+
],
19+
"scripts": {
20+
"prepack": "nuxt-module-build",
21+
"dev": "nuxi dev playground",
22+
"dev:build": "nuxi build playground",
23+
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
24+
},
25+
"dependencies": {
26+
"@nuxt/kit": "^3.0.0-rc.13"
27+
},
28+
"devDependencies": {
29+
"@graphql-codegen/cli": "2.13.4",
30+
"@nuxt/module-builder": "^0.2.0",
31+
"@nuxt/schema": "^3.0.0-rc.13",
32+
"@nuxtjs/eslint-config-typescript": "^11.0.0",
33+
"eslint": "^8.26.0",
34+
"nuxt": "^3.0.0-rc.13"
35+
}
36+
}

playground/app.vue

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<template>
2+
<div>
3+
Nuxt module playground
4+
</div>
5+
</template>
6+
7+
<script setup>
8+
</script>

playground/codegen.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { CodegenConfig } from '@graphql-codegen/cli'
2+
3+
const config: CodegenConfig = {
4+
overwrite: true,
5+
schema: process.env.GRAPHQL_URL,
6+
documents: 'graphql/**/*.graphql',
7+
generates: {
8+
'graphql/client.ts': {
9+
plugins: ['typescript', 'typescript-operations', 'typescript-vue-urql']
10+
},
11+
'graphql/schema-introspection.ts': {
12+
plugins: ['urql-introspection']
13+
}
14+
}
15+
}
16+
17+
export default config

playground/generated/.gitkeep

Whitespace-only changes.

playground/nuxt.config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineNuxtConfig } from 'nuxt/config'
2+
import NuxtCodegen from '..'
3+
4+
export default defineNuxtConfig({
5+
modules: [NuxtCodegen],
6+
nuxtCodegen: {}
7+
})

playground/package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"private": true,
3+
"name": "nuxt-codegen-playground",
4+
"scripts": {
5+
"codegen": "graphql-codegen --config codegen.ts"
6+
},
7+
"devDependencies": {
8+
"@graphql-codegen/client-preset": "1.1.3",
9+
"@graphql-codegen/typescript": "2.8.1",
10+
"@graphql-codegen/typescript-operations": "2.5.6",
11+
"@graphql-codegen/typescript-vue-urql": "2.3.6",
12+
"@graphql-codegen/urql-introspection": "2.2.1"
13+
},
14+
"dependencies": {
15+
"graphql": "16.6.0"
16+
}
17+
}

0 commit comments

Comments
 (0)