move all graphql functional to packages/graphql

This commit is contained in:
vchikalkin 2024-12-23 19:07:25 +03:00
parent 6ec85bd234
commit 5d8b2ffc6b
14 changed files with 55 additions and 42 deletions

View File

@ -10,12 +10,9 @@
"start": "node dist/src/index.js",
"dev": "dotenv -e ../../.env.local tsx watch src/index.ts",
"lint": "eslint",
"lint-staged": "lint-staged",
"test:unit": "vitest"
"lint-staged": "lint-staged"
},
"dependencies": {
"@apollo/client": "catalog:",
"jsonwebtoken": "catalog:",
"telegraf": "catalog:",
"zod": "catalog:"
},
@ -24,14 +21,11 @@
"@repo/graphql": "workspace:*",
"@repo/lint-staged-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/jsonwebtoken": "catalog:",
"@types/node": "catalog:",
"dotenv-cli": "catalog:",
"lint-staged": "catalog:",
"rimraf": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:",
"vite-tsconfig-paths": "catalog:",
"vitest": "catalog:"
"typescript": "catalog:"
}
}

View File

@ -3,9 +3,6 @@ import { z } from 'zod';
export const envSchema = z.object({
BOT_TOKEN: z.string(),
LOGIN_GRAPHQL: z.string(),
PASSWORD_GRAPHQL: z.string(),
URL_GRAPHQL: z.string(),
});
export const env = envSchema.parse(process.env);

View File

@ -1,5 +1,5 @@
import { createCustomer, getCustomer } from './api/query';
import { env as environment } from './config/env';
import { createCustomer, getCustomer } from '@repo/graphql/api/query';
import { Telegraf } from 'telegraf';
import { message } from 'telegraf/filters';

View File

@ -11,6 +11,6 @@
"@/*": ["./*"]
}
},
"include": ["."],
"include": [".", "../../packages/graphql/config", "../../packages/graphql/utils", "../../packages/graphql/apollo", "../../packages/graphql/api"],
"exclude": ["dist", "build", "node_modules"]
}

View File

@ -1,10 +1,10 @@
{
"name": "web",
"version": "0.1.0",
"version": "0.0.0",
"type": "module",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"dev": "dotenv -e ../../.env.local next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint",
@ -14,7 +14,6 @@
"test:e2e": "playwright test"
},
"dependencies": {
"@apollo/client": "catalog:",
"@repo/ui": "workspace:*",
"@telegram-apps/sdk-react": "catalog:",
"graphql": "catalog:",
@ -36,6 +35,7 @@
"@types/react-dom": "catalog:",
"@vitejs/plugin-react": "catalog:",
"autoprefixer": "catalog:",
"dotenv-cli": "catalog:",
"eruda": "catalog:",
"jsdom": "catalog:",
"lint-staged": "catalog:",

View File

@ -1,6 +1,6 @@
import { createApolloClient, getClientWithToken } from '../apollo/client';
import { env as environment } from '../config/env';
import * as GQL from '@repo/graphql/types';
import * as GQL from '../types';
export async function createCustomer(variables: GQL.CreateCustomerMutationVariables) {
const { mutate } = await getClientWithToken();

View File

@ -0,0 +1,10 @@
/* eslint-disable unicorn/prevent-abbreviations */
import { z } from 'zod';
export const envSchema = z.object({
LOGIN_GRAPHQL: z.string(),
PASSWORD_GRAPHQL: z.string(),
URL_GRAPHQL: z.string(),
});
export const env = envSchema.parse(process.env);

View File

@ -3,19 +3,25 @@
"version": "0.0.0",
"license": "MIT",
"type": "module",
"exports": {
"./types": "./types.ts"
},
"scripts": {
"graphql:codegen": "graphql-codegen --config graphql.config.cjs"
"graphql:codegen": "graphql-codegen --config graphql.config.cjs",
"test:unit": "vitest"
},
"dependencies": {
"@apollo/client": "catalog:",
"jsonwebtoken": "catalog:",
"zod": "catalog:"
},
"devDependencies": {
"graphql": "catalog:",
"@repo/typescript-config": "workspace:*",
"@types/jsonwebtoken": "catalog:",
"@graphql-codegen/cli": "catalog:",
"@graphql-codegen/typed-document-node": "catalog:",
"@graphql-codegen/typescript": "catalog:",
"@graphql-codegen/typescript-operations": "catalog:",
"@graphql-typed-document-node/core": "catalog:"
"@graphql-typed-document-node/core": "catalog:",
"vite-tsconfig-paths": "catalog:",
"vitest": "catalog:"
}
}

View File

@ -4,7 +4,9 @@
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
},
"moduleResolution": "bundler",
"module": "ES2022"
},
"include": ["."],
"exclude": ["dist", "build", "node_modules"]

View File

@ -1,5 +1,5 @@
/* eslint-disable unicorn/consistent-function-scoping */
import { isTokenExpired } from './jwt';
import { isTokenExpired } from './jwt.js';
import * as jwt from 'jsonwebtoken';
import { afterEach, describe, expect, it, vi } from 'vitest';

40
pnpm-lock.yaml generated
View File

@ -173,12 +173,6 @@ importers:
apps/bot:
dependencies:
'@apollo/client':
specifier: 'catalog:'
version: 3.12.4(@types/react@19.0.1)(graphql-ws@5.16.0(graphql@16.9.0))(graphql@16.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
jsonwebtoken:
specifier: 'catalog:'
version: 9.0.2
telegraf:
specifier: 'catalog:'
version: 4.16.3
@ -198,9 +192,6 @@ importers:
'@repo/typescript-config':
specifier: workspace:*
version: link:../../packages/typescript-config
'@types/jsonwebtoken':
specifier: 'catalog:'
version: 9.0.7
'@types/node':
specifier: 'catalog:'
version: 20.17.8
@ -219,18 +210,9 @@ importers:
typescript:
specifier: 'catalog:'
version: 5.7.2
vite-tsconfig-paths:
specifier: 'catalog:'
version: 5.1.4(typescript@5.7.2)(vite@5.4.11(@types/node@20.17.8))
vitest:
specifier: 'catalog:'
version: 2.1.8(@types/node@20.17.8)(jsdom@25.0.1)
apps/web:
dependencies:
'@apollo/client':
specifier: 'catalog:'
version: 3.12.4(@types/react@19.0.1)(graphql-ws@5.16.0(graphql@16.9.0))(graphql@16.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@repo/ui':
specifier: workspace:*
version: link:../../packages/ui
@ -289,6 +271,9 @@ importers:
autoprefixer:
specifier: 'catalog:'
version: 10.4.20(postcss@8.4.49)
dotenv-cli:
specifier: 'catalog:'
version: 7.4.4
eruda:
specifier: 'catalog:'
version: 3.4.1
@ -330,6 +315,16 @@ importers:
version: 2.3.2(eslint@9.15.0(jiti@2.4.1))
packages/graphql:
dependencies:
'@apollo/client':
specifier: 'catalog:'
version: 3.12.4(@types/react@19.0.1)(graphql-ws@5.16.0(graphql@16.9.0))(graphql@16.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
jsonwebtoken:
specifier: 'catalog:'
version: 9.0.2
zod:
specifier: 'catalog:'
version: 3.24.1
devDependencies:
'@graphql-codegen/cli':
specifier: 'catalog:'
@ -349,9 +344,18 @@ importers:
'@repo/typescript-config':
specifier: workspace:*
version: link:../typescript-config
'@types/jsonwebtoken':
specifier: 'catalog:'
version: 9.0.7
graphql:
specifier: 'catalog:'
version: 16.9.0
vite-tsconfig-paths:
specifier: 'catalog:'
version: 5.1.4(typescript@5.7.2)(vite@5.4.11(@types/node@20.17.8))
vitest:
specifier: 'catalog:'
version: 2.1.8(@types/node@20.17.8)(jsdom@25.0.1)
packages/lint-staged-config: {}