Skip to content

Commit ea2cdab

Browse files
authored
Merge pull request #1 from coderdiaz/chore/upgrade
Upgrade template with new approach
2 parents 8ac83ae + 7725cc9 commit ea2cdab

File tree

7 files changed

+3922
-1751
lines changed

7 files changed

+3922
-1751
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
## Description
2626

27-
[Nest](https://github.com/nestjs/nest) framework TypeScript + GraphQL + Fastify repository.
27+
[Nest](https://github.com/nestjs/nest) framework TypeScript + GraphQL (Mercurius) + Fastify repository + SWC.
2828

2929
## Installation
3030

nest-cli.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"$schema": "https://json.schemastore.org/nest-cli",
33
"collection": "@nestjs/schematics",
4-
"sourceRoot": "src"
4+
"sourceRoot": "src",
5+
"compilerOptions": {
6+
"builder": "swc",
7+
"typeCheck": true
8+
}
59
}

package.json

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,42 @@
1919
"test:e2e": "jest --config ./test/jest-e2e.json"
2020
},
2121
"dependencies": {
22-
"@nestjs/apollo": "^10.0.12",
23-
"@nestjs/common": "^8.4.5",
24-
"@nestjs/config": "^2.0.1",
25-
"@nestjs/core": "^8.4.5",
26-
"@nestjs/graphql": "^10.0.12",
27-
"@nestjs/platform-fastify": "^8.4.5",
28-
"apollo-server-fastify": "^3.7.0",
29-
"graphql": "^16.5.0",
30-
"reflect-metadata": "^0.1.13",
31-
"rimraf": "^3.0.2",
32-
"rxjs": "^7.5.5"
22+
"@mercuriusjs/gateway": "^3.0.1",
23+
"@nestjs/common": "10.3.2",
24+
"@nestjs/config": "3.2.3",
25+
"@nestjs/core": "10.3.2",
26+
"@nestjs/graphql": "12.0.11",
27+
"@nestjs/mercurius": "12.0.11",
28+
"@nestjs/platform-fastify": "10.3.2",
29+
"graphql": "16.8.1",
30+
"mercurius": "14.1.0",
31+
"reflect-metadata": "0.2.1",
32+
"rimraf": "3.0.2",
33+
"rxjs": "7.8.1"
3334
},
3435
"devDependencies": {
35-
"@nestjs/cli": "^8.2.6",
36-
"@nestjs/schematics": "^8.0.11",
37-
"@nestjs/testing": "^8.4.5",
38-
"@types/jest": "^27.5.1",
39-
"@types/node": "^17.0.35",
40-
"@types/supertest": "^2.0.12",
41-
"@typescript-eslint/eslint-plugin": "^5.25.0",
42-
"@typescript-eslint/parser": "^5.25.0",
43-
"eslint": "^8.16.0",
44-
"eslint-config-prettier": "^8.5.0",
45-
"eslint-plugin-prettier": "^4.0.0",
46-
"jest": "^28.1.0",
47-
"prettier": "^2.6.2",
48-
"source-map-support": "^0.5.21",
49-
"supertest": "^6.2.3",
50-
"ts-jest": "^28.0.2",
51-
"ts-loader": "^9.3.0",
52-
"ts-node": "^10.7.0",
53-
"tsconfig-paths": "^4.0.0",
54-
"typescript": "^4.6.4"
36+
"@nestjs/cli": "10.3.2",
37+
"@nestjs/schematics": "10.1.1",
38+
"@nestjs/testing": "10.3.2",
39+
"@swc/cli": "0.4.0",
40+
"@swc/core": "1.7.1",
41+
"@types/jest": "27.5.1",
42+
"@types/node": "20.8.7",
43+
"@types/supertest": "2.0.16",
44+
"@typescript-eslint/eslint-plugin": "5.62.0",
45+
"@typescript-eslint/parser": "5.62.0",
46+
"eslint": "8.42.0",
47+
"eslint-config-prettier": "9.1.0",
48+
"eslint-plugin-import": "2.29.1",
49+
"jest": "29.7.0",
50+
"prettier": "3.2.5",
51+
"source-map-support": "0.5.21",
52+
"supertest": "6.3.3",
53+
"ts-jest": "29.1.2",
54+
"ts-loader": "9.5.1",
55+
"ts-node": "10.9.2",
56+
"tsconfig-paths": "4.0.0",
57+
"typescript": "5.3.3"
5558
},
5659
"jest": {
5760
"moduleFileExtensions": [

src/app.module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ import { join } from 'path';
22
import { Module } from '@nestjs/common';
33
import { ConfigModule, ConfigService } from '@nestjs/config';
44
import { GraphQLModule } from '@nestjs/graphql';
5-
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
5+
import { MercuriusDriver, MercuriusDriverConfig } from '@nestjs/mercurius';
66
import config from './config';
77

88
import { AppController } from './app.controller';
99
import { SampleModule } from './sample/sample.module';
10+
1011
@Module({
1112
controllers: [AppController],
1213
imports: [
1314
ConfigModule.forRoot({ isGlobal: true, load: [config] }),
14-
GraphQLModule.forRootAsync<ApolloDriverConfig>({
15-
driver: ApolloDriver,
15+
GraphQLModule.forRootAsync<MercuriusDriverConfig>({
16+
driver: MercuriusDriver,
1617
imports: [ConfigModule],
1718
useFactory: async (configService: ConfigService) => ({
1819
autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
19-
debug: configService.get('graphql').debug,
20-
playground: configService.get('graphql').playground,
20+
graphiql: Boolean(configService.get('graphql').graphiql),
2121
}),
2222
inject: [ConfigService],
2323
}),

src/config.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
export type Config = {
22
port?: number;
33
graphql?: {
4-
debug?: boolean;
5-
playground?: boolean;
4+
graphiql?: boolean;
65
};
76
}
87

98
// Define environment variables
109
export default () => ({
1110
port: process.env.PORT || 3000,
1211
graphql: {
13-
debug: process.env.GRAPHQL_DEBUG || false,
14-
playground: process.env.GRAPHQL_PLAYGROUND || false,
12+
graphiql: process.env.GRAPHQL_PLAYGROUND || false,
1513
},
1614
} as Config);

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
"emitDecoratorMetadata": true,
77
"experimentalDecorators": true,
88
"allowSyntheticDefaultImports": true,
9-
"target": "es2017",
9+
"target": "ES2021",
1010
"sourceMap": true,
1111
"outDir": "./dist",
1212
"baseUrl": "./",
1313
"incremental": true,
1414
"skipLibCheck": true
15-
}
15+
},
16+
"include": ["src/**/*"]
1617
}

0 commit comments

Comments
 (0)