Skip to content

Commit

Permalink
Add graphql resolver generation, bumps (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertherber authored Mar 15, 2024
1 parent 5a39074 commit dc07e09
Show file tree
Hide file tree
Showing 62 changed files with 287 additions and 542 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-goats-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"zemble-plugin-auth-otp": patch
---

Testing out publishing
37 changes: 37 additions & 0 deletions .changeset/tough-scissors-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
"todo-app-with-auth-backend": patch
"create-zemble-plugin": patch
"zemble-plugin-auth-anonymous-expo": patch
"todoappwithauth": patch
"zemble-plugin-auth-anonymous": patch
"zemble-plugin-auth-api-token": patch
"zemble-plugin-email-sendgrid": patch
"zemble-plugin-logger-graphql": patch
"supplement-stack": patch
"@zemble/email-resend": patch
"@zemble/migrations": patch
"zemble-plugin-auth-expo": patch
"zemble-plugin-cms-users": patch
"zemble-plugin-urql-expo": patch
"zemble-plugin-auth-otp": patch
"zemble-plugin-supabase": patch
"@zemble/graphql": patch
"@zemble/mongodb": patch
"zemble-plugin-todo-ui": patch
"@zemble/ignite": patch
"@zemble/routes": patch
"@zemble/react": patch
"@zemble/utils": patch
"zemble-plugin-auth": patch
"zemble-plugin-bull": patch
"@zemble/core": patch
"@zemble/node": patch
"@zemble/pino": patch
"zemble-plugin-todo": patch
"minimal": patch
"zemble-plugin-cms": patch
"cms-ui": patch
"zemble-plugin-kv": patch
---

Add graphql resolver generation
2 changes: 1 addition & 1 deletion .env.github
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BUN_VERSION=1.0.26
BUN_VERSION=1.0.30
MONGOMS_PREFER_GLOBAL_PATH=true
2 changes: 1 addition & 1 deletion .github/workflows/autopublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
with:
bun-version: ${{ env.BUN_VERSION }}

- run: HUSKY=0 bun install --concurrent-scripts 1 --ignore-scripts
- run: HUSKY=0 bun install --ignore-scripts
env:
HUSKY: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eas-build-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
cache: ${{ inputs.package_manager }}

- name: Install dependencies (bun)
run: ${{ inputs.package_manager }} install --frozen-lockfile --concurrent-scripts 1
run: ${{ inputs.package_manager }} install --frozen-lockfile
if: ${{ inputs.package_manager == 'bun' }}
working-directory: ${{ inputs.working_directory }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eas-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
cache: ${{ inputs.package_manager }}

- name: Install dependencies (bun)
run: ${{ inputs.package_manager }} install --frozen-lockfile --concurrent-scripts 1
run: ${{ inputs.package_manager }} install --frozen-lockfile
if: ${{ inputs.package_manager == 'bun' }}
working-directory: ${{ inputs.working_directory }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-in-parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
cache: ${{ inputs.package_manager }}

- name: Install dependencies (bun)
run: ${{ inputs.package_manager }} install --frozen-lockfile --concurrent-scripts 1
run: ${{ inputs.package_manager }} install --frozen-lockfile
if: ${{ inputs.package_manager == 'bun' }}
working-directory: ${{ inputs.working_directory }}

Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
cache: ${{ inputs.package_manager }}

- name: Install dependencies (bun)
run: ${{ inputs.package_manager }} install --frozen-lockfile --concurrent-scripts 1
run: ${{ inputs.package_manager }} install --frozen-lockfile
if: ${{ inputs.package_manager == 'bun' }}
working-directory: ${{ inputs.working_directory }}

Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ on:
required: false
default: '7.0.4'
type: string

pull_request:

branches:
- main
push:
branches:
- "*" # matches every branch that doesn't contain a '/'
Expand Down Expand Up @@ -80,7 +85,7 @@ jobs:
key: ${{ runner.os }}-mongodb-${{ inputs.bun-version || env.BUN_VERSION }}-${{ env.MONGOMS_VERSION }}
path: ~/.cache/mongodb-binaries

- run: bun install --concurrent-scripts 1
- run: bun install

- name: Test
run: bun run test-recursive
Expand Down Expand Up @@ -117,7 +122,7 @@ jobs:
key: ${{ runner.os }}-mongodb-${{ inputs.bun-version || env.BUN_VERSION }}-${{ env.MONGOMS_VERSION }}
path: ~/.cache/mongodb-binaries

- run: bun install --concurrent-scripts 1
- run: bun install

- uses: supabase/setup-cli@v1

Expand Down Expand Up @@ -148,7 +153,7 @@ jobs:
with:
bun-version: ${{ inputs.bun-version || env.BUN_VERSION }}

- run: bun install --concurrent-scripts 1 --ignore-scripts
- run: bun install --ignore-scripts

- name: Typecheck
run: bun run typecheck
Expand All @@ -174,7 +179,7 @@ jobs:
with:
bun-version: ${{ inputs.bun-version || env.BUN_VERSION }}

- run: bun install --concurrent-scripts 1 --ignore-scripts
- run: bun install --ignore-scripts

- name: Lint
run: bun run lint
Expand All @@ -199,6 +204,6 @@ jobs:
with:
bun-version: ${{ inputs.bun-version || env.BUN_VERSION }}

- run: bun install --concurrent-scripts 1 --ignore-scripts
- run: bun install --ignore-scripts

- run: bun run graphql-codegen
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
**/*.generated.*
**/*.local.*
**/*.generated/**
tsconfig.json
tsconfig.json
**/tsconfig.json
10 changes: 5 additions & 5 deletions apps/cms-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@react-native-async-storage/async-storage": "^1.21.0",
"@react-native-community/netinfo": "^9.4.1",
"@react-navigation/native": "^6.1.9",
"@types/react": "^18.2.57",
"@types/react": "^18.2.66",
"@urql/core": "4",
"expo": "^49.0.21",
"expo-constants": "~14.4.2",
Expand All @@ -33,7 +33,7 @@
"jwt-decode": "^4.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.50.1",
"react-hook-form": "^7.51.0",
"react-native": "~0.72.4",
"react-native-gesture-handler": "^2.14.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
Expand All @@ -45,14 +45,14 @@
"react-native-vector-icons": "^10.0.3",
"react-native-web": "^0.19.8",
"recursive": "^0.0.2",
"typescript": "^5.3.3",
"typescript": "^5.4.2",
"urql": "4.0"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/core": "^7.24.0",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.2.2"
"@graphql-codegen/client-preset": "^4.2.4"
},
"private": true
}
12 changes: 10 additions & 2 deletions apps/minimal/codegen.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import defaultConfig from '@zemble/graphql/codegen'
import { createClientConfig, createServerConfig } from '@zemble/graphql/codegen'

import type { CodegenConfig } from '@graphql-codegen/cli'

const defaultServerConfig = createServerConfig({ resolverGeneration: true })
const defaultClientConfig = createClientConfig({})

const config: CodegenConfig = {
...defaultConfig,
...defaultServerConfig,
...defaultClientConfig,
generates: {
...defaultServerConfig.generates,
...defaultClientConfig.generates,
},
}

export default config
2 changes: 1 addition & 1 deletion apps/minimal/graphql/Mutation/randomNumber.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MutationResolvers } from '../schema.generated'

const randomNumber: MutationResolvers['randomNumber'] = (_, __, { pubsub }) => {
export const randomNumber: NonNullable<MutationResolvers['randomNumber']> = (_, __, { pubsub }) => {
const randomNumber = Math.floor(Math.random() * 1000)

pubsub.publish('randomNumber', randomNumber)
Expand Down
4 changes: 1 addition & 3 deletions apps/minimal/graphql/Query/hello.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { QueryResolvers } from '../schema.generated'

const hello: QueryResolvers['hello'] = () => 'world!'

export default hello
export const hello: NonNullable<QueryResolvers['hello']> = async (_parent, _arg, _ctx) => 'world!'
2 changes: 1 addition & 1 deletion apps/minimal/graphql/Subscription/countdown.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SubscriptionResolvers } from '../schema.generated'

const countdown: SubscriptionResolvers['countdown'] = {
export const countdown: NonNullable<SubscriptionResolvers['countdown']> = {
// This will return the value on every 1 sec until it reaches 0
// eslint-disable-next-line object-shorthand
subscribe: async function* (_, { from }, { logger }) {
Expand Down
2 changes: 1 addition & 1 deletion apps/minimal/graphql/Subscription/randomNumber.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SubscriptionResolvers } from '../schema.generated'

const randomNumber: SubscriptionResolvers['randomNumber'] = {
export const randomNumber: NonNullable<SubscriptionResolvers['randomNumber']> = {
// subscribe to the randomNumber event
subscribe: (_, __, { pubsub, logger }) => {
logger.info('subscribing to randomNumber')
Expand Down
2 changes: 1 addition & 1 deletion apps/minimal/graphql/Subscription/tick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const initializeOnce = (pubsub: Zemble.PubSubType) => {
}, 1000)
}

const tick: SubscriptionResolvers['tick'] = {
export const tick: NonNullable<SubscriptionResolvers['tick']> = {
// subscribe to the tick event
subscribe: (_, __, { pubsub, logger }) => {
initializeOnce(pubsub)
Expand Down
2 changes: 1 addition & 1 deletion apps/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
},
"devDependencies": {
"@tsconfig/node20": "^20.1.2",
"typescript": "^5.3.3"
"typescript": "^5.4.2"
}
}
4 changes: 2 additions & 2 deletions apps/supplement-stack/codegen.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import mergeDeep from '@zemble/core/utils/mergeDeep'
import defaultConfig from '@zemble/graphql/codegen'
import defaultConfig, { defaultServerOutputPath } from '@zemble/graphql/codegen'

import type { CodegenConfig } from '@graphql-codegen/cli'

const config: CodegenConfig = {
generates: {
[`./graphql/schema.generated.ts`]: {
[defaultServerOutputPath]: {
config: {
mappers: {
Ingredient: '../models#EatableDbType',
Expand Down
13 changes: 7 additions & 6 deletions apps/supplement-stack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@
"license": "ISC",
"dependencies": {
"@envelop/generic-auth": "^7.0.0",
"@zemble/bun": "workspace:*",
"@zemble/core": "workspace:*",
"@zemble/graphql": "workspace:*",
"graphql-scalars": "^1.22.4",
"mongodb": "^6.3.0",
"papr": "^15.2.0",
"graphql": "^16.8.1",
"graphql-scalars": "^1.22.5",
"mongodb": "^6.5.0",
"papr": "^15.2.1",
"zemble-plugin-apple-app-site-association": "workspace:*",
"zemble-plugin-auth-otp": "workspace:*",
"zemble-plugin-bull": "workspace:*",
"zemble-plugin-todo": "workspace:*",
"@zemble/bun": "workspace:*"
"zemble-plugin-todo": "workspace:*"
},
"devDependencies": {
"typescript": "^5.3.3"
"typescript": "^5.4.2"
}
}
2 changes: 1 addition & 1 deletion apps/todo-app-with-auth-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"@zemble/bun": "workspace:*"
},
"devDependencies": {
"typescript": "^5.3.3"
"typescript": "^5.4.2"
}
}
6 changes: 3 additions & 3 deletions apps/todo-app-with-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"zemble-plugin-todo-ui": "workspace:*"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@types/react": "^18.2.57",
"typescript": "^5.3.3"
"@babel/core": "^7.24.0",
"@types/react": "^18.2.66",
"typescript": "^5.4.2"
},
"private": true
}
Binary file modified bun.lockb
Binary file not shown.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@
"devDependencies": {
"@graphql-eslint/eslint-plugin": "^3.20.1",
"@graphql-typed-document-node/core": "^3.2.0",
"@tsconfig/bun": "^1.0.3",
"@tsconfig/bun": "^1.0.4",
"@types/bun": "latest",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"check-dependency-version-consistency": "^4.1.0",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-kingstinct": "^5.1.2",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-comment-length": "^1.7.3",
"eslint-plugin-functional": "^6.0.0",
"eslint-plugin-functional": "^6.1.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsonc": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.1.0",
"eslint-plugin-react-native-a11y": "^3.3.0",
Expand All @@ -79,7 +79,7 @@
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"pino-pretty": "^10.3.1",
"turbo": "^1.12.4",
"turbo": "^1.12.5",
"typescript-json-schema": "^0.63.0"
},
"workspaces": [
Expand Down
8 changes: 4 additions & 4 deletions packages/anonymous-auth-expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"urql": "4.0"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/core": "^7.24.0",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.2.2",
"@types/react": "^18.2.57",
"typescript": "^5.3.3"
"@graphql-codegen/client-preset": "^4.2.4",
"@types/react": "^18.2.66",
"typescript": "^5.4.2"
},
"private": true
}
6 changes: 3 additions & 3 deletions packages/auth-api-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"@zemble/core": "workspace:*",
"@zemble/graphql": "workspace:*",
"graphql": "^16.8.1",
"graphql-scalars": "^1.22.4",
"hono": "^3.12.12",
"jose": "^5.2.2",
"graphql-scalars": "^1.22.5",
"hono": "^4.1.0",
"jose": "^5.2.3",
"zemble-plugin-auth": "workspace:*"
}
}
Loading

0 comments on commit dc07e09

Please sign in to comment.