Skip to content

Commit c893bb5

Browse files
authored
Lib upgrade - Mar 25 (#14)
* upgrade root pkgs * upgrade eslint for express, react * upgrade express-server * upgrade nest to v11 * pnpm workspace * pnpm workspace * replace yarn with pnpm * wip * add missing pkgs * wip * update eslint-flat-config * revert pnpm to yarn * replace pnpm with yarn in docs and github actions * update node 20.10.0 to 22.14.0
1 parent 0a8bbf2 commit c893bb5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4561
-3127
lines changed

.github/workflows/github-actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
node-version: [20.10.0]
11+
node-version: [22.14.0]
1212
os: [ubuntu-latest]
1313

1414
steps:

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node-linker=hoisted

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ test/jest-e2e.json
1414
tsconfig.json
1515
tsconfig.build.json
1616
turbo.json
17-
yarn.lock
1817

1918
.eslintrc
2019
.eslintrc.*

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,28 @@ You can clone the full repo and keep only the packages you need in your monorepo
1616

1717
## Get Started
1818

19+
This package uses [yarn](https://yarnpkg.com/) as the workspace `packageManager`.
20+
21+
```
22+
npm install -g yarn
23+
```
24+
1925
Place the shared packages in the `packages` folder & the applications code in the `apps` folder.
2026
If you do not wish to use Turborepo, delete `turbo.json` and remove it from `devDependencies` of the package.json in the root directory.
2127

2228
Install `node_modules`
2329

2430
```
25-
yarn
31+
yarn install
2632
```
2733

2834
Add relavant scripts in the root package.json for the frontend and backend apps of your choice.
2935

36+
Run specific commands,
37+
```
38+
yarn <workspace> run <command>
39+
```
40+
3041
Build, run, lint or test all your apps in one command thanks to [Turborepo's Pipelines](https://turborepo.org/docs/core-concepts/pipelines)
3142

3243
## Support Me

apps/express-server/.eslintrc.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/express-server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Base Image
2-
FROM node:20-alpine3.18 AS phase1
2+
FROM node:22.14.0-alpine3.20 AS phase1
33

44
WORKDIR /app
55

apps/express-server/eslint.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import jsConfig from '@nish1896/eslint-flat-config/js';
2+
3+
export default [
4+
...jsConfig,
5+
];

apps/express-server/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
},
1313
"dependencies": {
1414
"cors": "^2.8.5",
15-
"dotenv": "^16.4.5",
16-
"express": "^4.21.0",
17-
"winston": "3.15.0"
15+
"dotenv": "^16.4.7",
16+
"express": "^4.21.2",
17+
"winston": "3.17.0"
1818
},
1919
"devDependencies": {
20-
"@nish1896/eslint-config": "^2.0.5",
20+
"@nish1896/eslint-flat-config": "^1.1.4",
2121
"@types/cors": "^2.8.17",
22-
"@types/node": "^22.7.4",
23-
"eslint": "^8.57.0",
24-
"nodemon": "^3.1.7",
22+
"@types/node": "^22.13.10",
23+
"eslint": "^9.22.0",
24+
"nodemon": "^3.1.9",
2525
"rimraf": "^6.0.1",
26-
"tsc-alias": "^1.8.10",
26+
"tsc-alias": "^1.8.11",
2727
"tsconfig-paths": "^4.2.0",
28-
"typescript": "^5.6.2"
28+
"typescript": "^5.8.2"
2929
}
3030
}

apps/express-server/src/routes/auth/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class AuthService {
1010
password
1111
})
1212
.end();
13-
} catch (err) {
14-
res.status(500).send('Internal Server Error');
13+
} catch (error) {
14+
res.status(500).send(`Internal Server Error: ${JSON.stringify(error)}`);
1515
}
1616
res.end();
1717
}

apps/express-server/tsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"compilerOptions": {
3+
"target": "ES2024",
4+
"module": "NodeNext",
5+
"moduleResolution": "NodeNext",
36
"baseUrl": "./",
47
"outDir": "dist",
58
"rootDir": "src",
69
"paths": {
710
"@/*": ["src/*"]
811
},
9-
"esModuleInterop": true,
10-
"moduleResolution": "node"
12+
"esModuleInterop": true
1113
},
1214
"include": ["src/**/*.ts"],
1315
"exclude": ["node_modules", "dist"],

apps/nestjs-server/.eslintrc.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

apps/nestjs-server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Base Image
2-
FROM node:20-alpine3.18 as phase1
2+
FROM node:22.14.0-alpine3.20 as phase1
33

44
WORKDIR /app
55

apps/nestjs-server/eslint.config.mjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// @ts-check
2+
import eslint from '@eslint/js';
3+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4+
import globals from 'globals';
5+
import tseslint from 'typescript-eslint';
6+
import jsConfig from '@nish1896/eslint-flat-config/js';
7+
8+
export default tseslint.config(
9+
{
10+
ignores: ['eslint.config.mjs'],
11+
},
12+
eslint.configs.recommended,
13+
...tseslint.configs.recommendedTypeChecked,
14+
...jsConfig,
15+
eslintPluginPrettierRecommended,
16+
{
17+
languageOptions: {
18+
globals: {
19+
...globals.node,
20+
...globals.jest,
21+
},
22+
ecmaVersion: 5,
23+
sourceType: 'module',
24+
parserOptions: {
25+
projectService: true,
26+
tsconfigRootDir: import.meta.dirname,
27+
},
28+
},
29+
},
30+
{
31+
rules: {
32+
'@typescript-eslint/no-explicit-any': 'off',
33+
'@typescript-eslint/no-floating-promises': 'warn',
34+
'@typescript-eslint/no-unsafe-argument': 'warn'
35+
},
36+
},
37+
);

apps/nestjs-server/package.json

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"private": true,
66
"scripts": {
77
"dev": "nest start --watch",
8+
"prebuild": "rimraf dist",
89
"build": "nest build",
910
"start": "NODE_ENV=production node dist/main",
1011
"start:debug": "nest start --debug --watch",
@@ -17,30 +18,41 @@
1718
"test:e2e": "jest --config ./test/jest-e2e.json"
1819
},
1920
"dependencies": {
20-
"@nestjs/common": "^10.4.4",
21-
"@nestjs/core": "^10.4.4",
22-
"@nestjs/platform-express": "^10.4.4",
23-
"@nestjs/platform-fastify": "^10.4.4",
21+
"@nestjs/common": "^11.0.11",
22+
"@nestjs/core": "^11.0.11",
23+
"@nestjs/platform-express": "^11.0.11",
24+
"@nestjs/platform-fastify": "^11.0.11",
2425
"reflect-metadata": "^0.2.2",
25-
"rxjs": "^7.8.1"
26+
"rxjs": "^7.8.2"
2627
},
2728
"devDependencies": {
28-
"@nestjs/cli": "^10.4.5",
29-
"@nestjs/schematics": "^10.1.4",
30-
"@nestjs/testing": "^10.4.4",
31-
"@nish1896/eslint-config": "^2.0.5",
32-
"@types/jest": "^29.5.13",
33-
"@types/node": "^22.7.4",
29+
"@eslint/eslintrc": "^3.3.0",
30+
"@eslint/js": "^9.22.0",
31+
"@nestjs/cli": "^11.0.5",
32+
"@nestjs/schematics": "^11.0.2",
33+
"@nestjs/testing": "^11.0.11",
34+
"@nish1896/eslint-flat-config": "^1.1.4",
35+
"@swc/cli": "^0.6.0",
36+
"@swc/core": "^1.10.8",
37+
"@types/express": "^5.0.0",
38+
"@types/jest": "^29.5.14",
39+
"@types/node": "^22.13.10",
3440
"@types/supertest": "^6.0.2",
35-
"eslint": "^8.57.0",
41+
"eslint": "^9.22.0",
42+
"eslint-config-prettier": "^10.1.1",
43+
"eslint-plugin-prettier": "^5.2.3",
44+
"globals": "^16.0.0",
3645
"jest": "^29.7.0",
46+
"prettier": "^3.4.2",
47+
"rimraf": "^6.0.1",
3748
"source-map-support": "^0.5.21",
3849
"supertest": "^7.0.0",
39-
"ts-jest": "^29.2.5",
40-
"ts-loader": "^9.5.1",
50+
"ts-jest": "^29.2.6",
51+
"ts-loader": "^9.5.2",
4152
"ts-node": "^10.9.2",
4253
"tsconfig-paths": "^4.2.0",
43-
"typescript": "^5.6.2"
54+
"typescript": "^5.8.2",
55+
"typescript-eslint": "^8.26.1"
4456
},
4557
"jest": {
4658
"moduleFileExtensions": [

apps/nestjs-server/src/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { HomeModule } from './routes';
44
@Module({
55
imports: [HomeModule],
66
controllers: [],
7-
providers: []
7+
providers: [],
88
})
99
export class AppModule {}

apps/nestjs-server/src/main.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NestFactory } from '@nestjs/core';
22
import {
33
FastifyAdapter,
4-
NestFastifyApplication
4+
NestFastifyApplication,
55
} from '@nestjs/platform-fastify';
66
import { AppModule } from './app.module';
77

@@ -15,20 +15,23 @@ async function bootstrap() {
1515
// const app = await NestFactory.create(AppModule);
1616

1717
/**
18-
* Unfortunately NestJs prod build with fastify, works on local
18+
* Unfortunately NestJs prod build with fastify, works on local
1919
* machine, but it does not port map on docker...
20-
*
21-
* Soln link -
20+
*
21+
* Soln link -
2222
* https://stackoverflow.com/questions/66086427/docker-container-with-nodejs-appnestjs-is-not-accessible-from-both-other-conta
23-
*/
23+
*/
2424
const app = await NestFactory.create<NestFastifyApplication>(
2525
AppModule,
2626
new FastifyAdapter({
2727
ignoreTrailingSlash: true,
28-
caseSensitive: false
28+
caseSensitive: false,
2929
})
3030
);
3131
await app.listen(4000, '0.0.0.0');
3232
}
3333

34-
bootstrap();
34+
bootstrap().catch(error => {
35+
console.error('Error during app startup: ', error);
36+
process.exit(1);
37+
});

apps/nestjs-server/src/routes/home/controller.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('HomeController', () => {
88
beforeEach(async () => {
99
const app: TestingModule = await Test.createTestingModule({
1010
controllers: [HomeController],
11-
providers: [HomeService]
11+
providers: [HomeService],
1212
}).compile();
1313

1414
homeController = app.get<HomeController>(HomeController);

apps/nestjs-server/src/routes/home/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { HomeService } from './service';
44

55
@Module({
66
controllers: [HomeController],
7-
providers: [HomeService]
7+
providers: [HomeService],
88
})
99
export class HomeModule {}
Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
import { Test, TestingModule } from '@nestjs/testing';
21
import { INestApplication } from '@nestjs/common';
2+
import { Test } from '@nestjs/testing';
33
import * as request from 'supertest';
4+
import { App } from 'supertest/types';
45
import { AppModule } from './../src/app.module';
56

67
describe('AppController (e2e)', () => {
7-
let app: INestApplication;
8+
let app: INestApplication<App>;
89

9-
beforeEach(async () => {
10-
const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule] }).compile();
10+
beforeAll(async () => {
11+
const moduleFixture = await Test.createTestingModule({
12+
imports: [AppModule],
13+
}).compile();
1114

1215
app = moduleFixture.createNestApplication();
1316
await app.init();
1417
});
1518

16-
it('/ (GET)', () =>
17-
request(app.getHttpServer()).get('/')
19+
afterAll(async () => {
20+
await app.close();
21+
});
22+
23+
it('/ (GET)', () => {
24+
return request(app.getHttpServer())
25+
.get('/')
1826
.expect(200)
19-
.expect('Hello World!'));
27+
.expect('Hello World!');
28+
});
2029
});

apps/next-client/.eslintrc.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

apps/next-client/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20-alpine3.18 AS base
1+
FROM node:22.14.0-alpine3.20 AS base
22

33
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine
44
# to understand why libc6-compat might be needed.
@@ -11,7 +11,7 @@ WORKDIR /app
1111
RUN mkdir -p apps/next-client
1212

1313
COPY --chown=node:node package.json .
14-
COPY --chown=node:node yarn.lock .
14+
COPY --chown=node:node yarn-lock.yaml .
1515
COPY --chown=node:node ./apps/next-client/package.json ./apps/next-client
1616

1717
# Install dependencies

0 commit comments

Comments
 (0)