Skip to content

Commit

Permalink
[#484]: upgrade typescript (#485)
Browse files Browse the repository at this point in the history
* [#484]: upgrade typescript

* [#484]: fix ligretto-gameplay-backend

* [#484]: fix blog types

* [#484]: fix node version in dockerfiles
  • Loading branch information
Themezv authored Mar 23, 2024
1 parent 1a3b3dc commit 559ed55
Show file tree
Hide file tree
Showing 29 changed files with 2,000 additions and 1,820 deletions.
4 changes: 2 additions & 2 deletions .docker/Blog_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.14-bullseye-slim AS dependencies
FROM node:20.11-bullseye-slim AS dependencies

WORKDIR /memebattle

Expand All @@ -17,7 +17,7 @@ WORKDIR /memebattle/apps/blog

RUN node ../../node_modules/.bin/next build

FROM node:18.14-bullseye-slim AS runtime
FROM node:20.11-bullseye-slim AS runtime
ENV NODE_ENV=production

RUN mkdir -p /memebattle
Expand Down
4 changes: 2 additions & 2 deletions .docker/GameHub-client_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.14-bullseye-slim AS dependencies
FROM node:20.11-bullseye-slim AS dependencies

WORKDIR /memebattle

Expand All @@ -18,7 +18,7 @@ WORKDIR /memebattle

RUN node node_modules/.bin/next build apps/gamehub-client

FROM node:18.14-bullseye-slim AS runtime
FROM node:20.11-bullseye-slim AS runtime
ENV NODE_ENV=production

RUN mkdir -p /memebattle
Expand Down
4 changes: 2 additions & 2 deletions .docker/Ligretto-core-backend_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.14-bullseye-slim AS dependencies
FROM node:20.11-bullseye-slim AS dependencies

WORKDIR /memebattle

Expand All @@ -22,7 +22,7 @@ ENV NODE_ENV=production

RUN yarn workspaces focus --production @memebattle/ligretto-core-backend

FROM node:18.14-bullseye-slim AS runtime
FROM node:20.11-bullseye-slim AS runtime
ENV NODE_ENV=production

RUN mkdir -p /memebattle
Expand Down
4 changes: 2 additions & 2 deletions .docker/Ligretto-gameplay-backend_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.14-bullseye-slim AS dependencies
FROM node:20.11-bullseye-slim AS dependencies

WORKDIR /memebattle

Expand All @@ -23,7 +23,7 @@ FROM dependencies AS prod-dependencies

RUN yarn workspaces focus --production @memebattle/ligretto-gameplay-backend

FROM node:18.14-bullseye-slim AS runtime
FROM node:20.11-bullseye-slim AS runtime
ENV NODE_ENV=production

RUN mkdir -p /memebattle
Expand Down
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ build
dist
storybook-static
.yarn
.eslintrc.js
*.config.js
*.config.ts
.next
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = {
parserOptions: {
project: ['./apps/*/tsconfig.json', './packages/*/tsconfig.json'],
sourceType: 'module',
createDefaultProgram: true, // TODO: waiting for normal fix in @typescript-eslint/parser
},
settings: {
react: {
Expand All @@ -36,6 +35,7 @@ module.exports = {
},
],
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/explicit-member-accessibility': [
Expand Down
18 changes: 3 additions & 15 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
{
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.preferences.importModuleSpecifier": "relative",
"cSpell.enabled": true,
"files.exclude": {
"tsconfig.build.json": true
},
"files.trimTrailingWhitespace": true,
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
],
"npm.packageManager": "yarn",
"cSpell.words": ["injectable", "nestjs", "postgres", "styleguide", "typeorm"],
"gitlens.advanced.blame.customArguments": [],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
},
"eslint.format.enable": true,
"eslint.run": "onSave"
}
2 changes: 1 addition & 1 deletion apps/auth-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
},
"devDependencies": {
"@types/react": "^18.0.28",
"typescript": "^5.0.4"
"typescript": "5.4.3"
}
}
3 changes: 2 additions & 1 deletion apps/blog/contentlayer.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import rehypeSlug from 'rehype-slug'
import { addTOCRehypePlugin } from './src/generation-utils/addTOCRehypePlugin'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
Expand Down Expand Up @@ -33,6 +32,8 @@ const extractSlug = flattenedPath => {
const pathSegments = flattenedPath.split('/')
const lastSegment = pathSegments.at(-1)

assert(lastSegment)

return lastSegment.split('.')[0]
}

Expand Down
2 changes: 1 addition & 1 deletion apps/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"rehype-slug": "^5.1.0",
"schema-dts": "^1.1.2",
"tailwindcss": "^3.3.1",
"typescript": "^5.0.4",
"typescript": "5.4.3",
"unist-util-visit": "^4.1.2",
"vite-tsconfig-paths": "^4.2.1",
"vitest": "^0.34.6"
Expand Down
1 change: 1 addition & 0 deletions apps/blog/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"**/*.ts",
"**/*.tsx",
".contentlayer/generated",
"contentlayer.config.js",
".next/types/**/*.ts"
],
"exclude": [
Expand Down
2 changes: 1 addition & 1 deletion apps/gamehub-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"@types/node": "20.11.30",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"typescript": "^5.0.4"
"typescript": "5.4.3"
}
}
2 changes: 1 addition & 1 deletion apps/ligretto-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@vitejs/plugin-react": "^4.1.1",
"react-test-renderer": "^16.9.0",
"sass": "^1.53.0",
"typescript": "^5.0.4",
"typescript": "5.4.3",
"vite": "^4.5.0",
"vite-plugin-svgr": "^2.2.0",
"vitest": "^0.34.6"
Expand Down
2 changes: 1 addition & 1 deletion apps/ligretto-frontend/src/ducks/game/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const mergePlayerAndUser = (player: SharedPlayer, user: User) =>
avatar: user.isTemporary ? '' : user.avatar,
cards: player.cards,
stackOpenDeck: player.stackOpenDeck,
} as const)
}) as const

export const STACK_OPEN_DECK_INDEX = 'STACK_OPEN_DECK_INDEX' as const

Expand Down
3 changes: 1 addition & 2 deletions apps/ligretto-gameplay-backend/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import type { Config } from 'jest'

const jestConfig: Config = {
testEnvironment: 'node',
setupFiles: ['<rootDir>/test/setup.ts'],
testRegex: '.*\\.spec\\.ts$',
transform: {
'^.+\\.ts$': [
'ts-jest',
{
tsconfig: 'tsconfig.spec.json',
tsconfig: 'tsconfig.json',
},
],
},
Expand Down
11 changes: 4 additions & 7 deletions apps/ligretto-gameplay-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,20 @@
"start:dev": "yarn prestart && nodemon",
"start": "yarn prestart && ts-node src/index.ts",
"prestart": "ts-node src/cli/check-env.ts",
"build": "tsc",
"build": "tsc --project tsconfig.build.json",
"ts-check": "tsc --noEmit"
},
"devDependencies": {
"@types/jest": "^28.1.6",
"@jest/globals": "^29.7.0",
"@types/lodash": "^4.14.182",
"@types/node": "20.11.30",
"cross-env": "^7.0.3",
"jest": "^29.5.0",
"mock-socket": "^9.1.5",
"nodemon": "^2.0.16",
"ts-jest": "^29.0.5",
"ts-loader": "^9.4.2",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"webpack": "^5.28.0",
"webpack-cli": "^4.6.0"
"typescript": "5.4.3"
},
"dependencies": {
"@codexsoft/dotenv-flow": "^3.3.5",
Expand Down
3 changes: 1 addition & 2 deletions apps/ligretto-gameplay-backend/src/bot/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { connectToRoomEmitAction } from '@memebattle/ligretto-shared'
import type { Socket } from 'socket.io'
import { nanoid } from 'nanoid'
import Timeout = NodeJS.Timeout

/**
Expand All @@ -20,7 +19,7 @@ const makeTurn = (socket: Socket, botId: string) => {
}

const makeBot = (socket: Socket) => {
const botId = nanoid()
const botId = 'botId'

makeTurn(socket, botId)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, jest, beforeEach, expect } from '@jest/globals'

import {
createRoomEmitAction,
createRoomErrorAction,
Expand Down
Empty file.
1 change: 1 addition & 0 deletions apps/ligretto-gameplay-backend/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Socket } from 'socket.io'
import { jest } from '@jest/globals'

class _SocketMock {
public id: string
Expand Down
8 changes: 8 additions & 0 deletions apps/ligretto-gameplay-backend/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": "./src"
},
"exclude": ["__tests__/*",],
"include": ["./src/*"]
}
5 changes: 2 additions & 3 deletions apps/ligretto-gameplay-backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"target": "es2021",
"lib": ["es2021"],
"types": ["node", "reflect-metadata"],
"module": "commonjs",
"module": "NodeNext",
"sourceMap": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"moduleResolution": "NodeNext",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "build",
Expand All @@ -16,6 +16,5 @@
"strictPropertyInitialization": false,
"skipLibCheck": true
},
"exclude": ["node_modules", "build", "**/*.spec.ts"],
"include": ["src/**/*"]
}
7 changes: 0 additions & 7 deletions apps/ligretto-gameplay-backend/tsconfig.spec.json

This file was deleted.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,28 @@
"@storybook/react": "^7.0.6",
"@storybook/react-vite": "^7.0.6",
"@types/node": "20.11.30",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"css-loader": "^6.7.1",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.29.4",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react": "7.34.1",
"eslint-plugin-react-hooks": "^4.5.0",
"eslint-plugin-storybook": "^0.6.11",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"prettier": "3.2.5",
"react-docgen-typescript-loader": "^3.7.2",
"react-docgen-typescript-plugin": "^1.0.0",
"sass": "^1.54.9",
"sass-loader": "^13.0.2",
"storybook": "^7.0.6",
"style-loader": "^3.3.1",
"stylelint": "^13.8.0",
"stylelint-config-prettier": "^8.0.2",
"stylelint-prettier": "^1.2.0",
"typescript": "^5.0.4",
"stylelint": "16.2.1",
"stylelint-config-prettier": "^9.0.5",
"stylelint-prettier": "5.0.0",
"typescript": "5.4.3",
"wait-on": "^7.0.1"
},
"packageManager": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"devDependencies": {
"@types/amplitude-js": "8.16.2",
"typescript": "^5.0.4"
"typescript": "5.4.3"
},
"dependencies": {
"amplitude-js": "^8.21.6"
Expand Down
2 changes: 1 addition & 1 deletion packages/ligretto-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"@reduxjs/toolkit": "^1.9.2"
},
"devDependencies": {
"typescript": "^5.0.4"
"typescript": "5.4.3"
}
}
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"devDependencies": {
"@types/react": "^18.0.28",
"typescript": "^5.0.4"
"typescript": "5.4.3"
},
"peerDependencies": {
"lodash": "^4.17.21",
Expand Down
6 changes: 1 addition & 5 deletions packages/ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@
"baseUrl": "./src",
"noImplicitAny": true
},
"include": ["src/**/*"],
"exclude": [
"node_modules",
"src/**/*.stories.tsx",
]
"include": ["src/**/*"]
}
Loading

0 comments on commit 559ed55

Please sign in to comment.