Skip to content

Commit

Permalink
removed schema generator
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkeksz committed Jan 10, 2024
1 parent f10153c commit 48c4c5a
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 48 deletions.
5 changes: 0 additions & 5 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ JWT_REFRESH_SECRET_TOKEN=
# Default: 60d
JWT_REFRESH_TOKEN_EXPIRES_IN=60d

# Description: Autogenerate GraphQL schema on application start
# Type: boolean
# Default: false
GRAPHQL_AUTO_SCHEMA_BUILD=false

# Description: GraphQL max complexity
# Type: number
# Min: 1
Expand Down
1 change: 0 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ JWT_ACCESS_SECRET_TOKEN=VrdWi58a8taiugDqLyefgSC7UkTx32sV9B8JRsv7mf7xtqDGYvyGJQv9
JWT_ACCESS_TOKEN_EXPIRES_IN=10s
JWT_REFRESH_SECRET_TOKEN=fzeDYxqAwapb3GPWPn2hsPBKrDHDyQsKuGcLdikFhznnY6efbxpYSyWD6BxqTkSVpQTDH5XgD4q4qahUxDNaiFZsV4j2Vyy9HmPFNMBDJURxv5rvTTaw2zcTvQWtenz4
JWT_REFRESH_TOKEN_EXPIRES_IN=20s
GRAPHQL_AUTO_SCHEMA_BUILD=true
GRAPHQL_COMPLEXITY_LIMIT=20
POSTGRES_USERNAME=waisy
POSTGRES_PASSWORD=1234
Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ COPY --chown=node:node . .

USER node

RUN npm run graphql:generate-schema

RUN npm run build

RUN npm ci --omit=dev && npm cache clean --force
Expand All @@ -45,7 +43,6 @@ WORKDIR /usr/src/app
# Copy the bundled code from the build stage to the production image
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/dist ./dist
COPY --chown=node:node --from=build /usr/src/app/schema.gql ./schema.gql

USER node

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"license": "UNLICENSED",
"scripts": {
"build": "nest build",
"graphql:generate-schema": "ts-node src/schema-generator.script.ts",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
Expand Down
1 change: 0 additions & 1 deletion src/config/graphql/graphql.config.env-validation-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as Joi from 'joi'
import {ValidationSchema} from '../config.types'

export const graphqlEnvValidationSchema: ValidationSchema = {
GRAPHQL_AUTO_SCHEMA_BUILD: Joi.boolean().default(false),
GRAPHQL_COMPLEXITY_LIMIT: Joi.number().min(1).default(100),
APOLLO_PLAYGROUND: Joi.boolean().default(false),
}
6 changes: 0 additions & 6 deletions src/config/graphql/graphql.config.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ describe('GraphqlConfigService', () => {
expect(service).toBeDefined()
})

describe('get autoSchemaBuild', () => {
it('should return the correct value from config service', () => {
expect(service.autoSchemaBuild).toBe(true)
})
})

describe('get complexityLimit', () => {
it('should return the correct value from config service', () => {
expect(service.complexityLimit).toBe(10)
Expand Down
4 changes: 0 additions & 4 deletions src/config/graphql/graphql.config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import {ConfigService} from '@nestjs/config'
export class GraphqlConfigService {
constructor(private readonly configService: ConfigService) {}

public get autoSchemaBuild(): boolean {
return !!this.configService.get('GRAPHQL_AUTO_SCHEMA_BUILD')
}

public get complexityLimit(): number {
return this.configService.get('GRAPHQL_COMPLEXITY_LIMIT')!
}
Expand Down
3 changes: 1 addition & 2 deletions src/graphql/graphql.module.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const graphqlModuleOptions: GqlModuleAsyncOptions<
const plugins = configService.playground
? [ApolloServerPluginLandingPageLocalDefault()]
: undefined
const autoSchemaFile = configService.autoSchemaBuild && 'schema.gql'
return {
playground: false,
autoTransformHttpErrors: false,
Expand All @@ -26,7 +25,7 @@ export const graphqlModuleOptions: GqlModuleAsyncOptions<
formatError: errorsService.formatGraphQLError.bind(errorsService),
introspection: configService.playground,
plugins,
autoSchemaFile,
autoSchemaFile: 'schema.gql',
}
},
}
25 changes: 0 additions & 25 deletions src/schema-generator.script.ts

This file was deleted.

0 comments on commit 48c4c5a

Please sign in to comment.