Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added autoformatting and linter. #19

Merged
merged 5 commits into from
Mar 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": "standard-with-typescript",
"overrides": [
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
}
}
21 changes: 21 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: eslint

on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn install
- uses: sibiraj-s/action-eslint@v2
with:
eslint-args: '--ignore-path=.gitignore --quiet'
extensions: 'js,jsx,ts,tsx'
annotations: true
8 changes: 3 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: CI (build)
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -19,16 +19,14 @@ jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest


steps:
# Checks out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18



- name: yarn install, build typescript
run: |
yarn install
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: prettier

on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn install
- run: yarn pretty-check
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: CI (test)
# Controls when the workflow will run
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -27,9 +27,8 @@ jobs:
with:
node-version: 18


# Runs a set of commands using the runners shell
- name: Start server
- name: Start server
run: |
yarn install
yarn start &
Expand Down
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint
yarn pretty
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules/
.eslintrc.json
.prettierignore
.prettierrc.json
jest.config.js
package.json
tsconfig.json
yarn.lock
yarn-error.log
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"jsxSingleQuote": true,
"tabWidth": 2,
"semi": false
}

54 changes: 31 additions & 23 deletions Vision.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
# Pokerio

### Opis {opis}

Celem projektu jest stworzenie prostej aplikacji mobilnej do gry w pokera. Aplikacja dostępna będzie dla użytkowników telefonów z systemem operacyjnym Android. Projekt motywowany jest brakiem aplikacji pozwalających grać w pokera z grupą znajomych przy użyciu wirtualnych żetonów, które nie są powiązane z fizyczną walutą. Użytkownicy będą łączyć się ze sobą przez centralny serwer.

### Grupy użytkowników

Grupą docelową są grupy pełnoletnich 2 do 8 graczy z całego świata, które są zainteresowane graniem w pokera.

### Funkcjonalność
* Generowanie nowego pokoju gry
* Dołączanie do pokoju gry
* Zarządzanie pokojem gry
* Rozgrywka (wg standardowych zasad dla pokera „Texas Holdem”), przebieg rundy:
* Każdy z graczy otrzymuje dwie karty
* Gracze “mała ciemna” oraz “duża ciemna” wchodzą do gry za ustaloną stawkę (duża ciemna = 2 * mała ciemna)
* Kolejni gracze muszą wyrównywać do największej stawki na stole lub ją podbić by grać dalej, lub mogą zrezygnować z gry (jeśli mieli jakieś środki w grze, to pozostają one w grze)
* Pierwsza tura kończy się, kiedy wszyscy gracze, którzy pozostali w grze, grają za tę samą stawkę
* Odsłania się trzy karty na stole
* Gracze mogą wyrównywać, podbijać lub rezygnować z gry (j.w.)
* Runda kończy się j.w.
* Później następują jeszcze dwie rundy, przed każdą z nich wykłada się na stół jedną kartę
* Po ostatniej rundzie ustala się zwycięzcę — zwycięzcą jest gracz, który uzyskał najwyższą rękę (Poker królewski, Poker, Karte, Full, Kolor, Trójka, dwie pary, para, najwyższa karta — brak starszeństwo kolorów), lub ostatni gracz w grze. (Ręka gracza - 5 dowolnie wybranych kart spośród 7 w tej rundzie (5 na stole i 2 karty zawodnika))
* Zwycięzca otrzymuje wszystkie żetony postawione przez graczy w danej rundzie

- Generowanie nowego pokoju gry
- Dołączanie do pokoju gry
- Zarządzanie pokojem gry
- Rozgrywka (wg standardowych zasad dla pokera „Texas Holdem”), przebieg rundy:
- Każdy z graczy otrzymuje dwie karty
- Gracze “mała ciemna” oraz “duża ciemna” wchodzą do gry za ustaloną stawkę (duża ciemna = 2 \* mała ciemna)
- Kolejni gracze muszą wyrównywać do największej stawki na stole lub ją podbić by grać dalej, lub mogą zrezygnować z gry (jeśli mieli jakieś środki w grze, to pozostają one w grze)
- Pierwsza tura kończy się, kiedy wszyscy gracze, którzy pozostali w grze, grają za tę samą stawkę
- Odsłania się trzy karty na stole
- Gracze mogą wyrównywać, podbijać lub rezygnować z gry (j.w.)
- Runda kończy się j.w.
- Później następują jeszcze dwie rundy, przed każdą z nich wykłada się na stół jedną kartę
- Po ostatniej rundzie ustala się zwycięzcę — zwycięzcą jest gracz, który uzyskał najwyższą rękę (Poker królewski, Poker, Karte, Full, Kolor, Trójka, dwie pary, para, najwyższa karta — brak starszeństwo kolorów), lub ostatni gracz w grze. (Ręka gracza - 5 dowolnie wybranych kart spośród 7 w tej rundzie (5 na stole i 2 karty zawodnika))
- Zwycięzca otrzymuje wszystkie żetony postawione przez graczy w danej rundzie

### Technologie
* Kotlin + Jetpack Compose
* Typescript + Node.js (express)
* Firebase Cloud Messaging
* Oracle DB

- Kotlin + Jetpack Compose
- Typescript + Node.js (express)
- Firebase Cloud Messaging
- Oracle DB

### Narzędzia
* Github (Github Actions, Issues, Pull Requests, Milestones)
* Oracle Cloud Infrastrutcture
* JUnit
* Jetpack Compose testing API
* Jest + Supertest

- Github (Github Actions, Issues, Pull Requests, Milestones)
- Oracle Cloud Infrastrutcture
- JUnit
- Jetpack Compose testing API
- Jest + Supertest
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@
"scripts": {
"start": "tsc && node dist/index.js",
"build": "tsc",
"test": "jest src/tests"
"test": "jest src/tests",
"lint": "eslint --ext '.js,.ts,.tsx' src/",
"pretty": "yarn prettier --write .",
"pretty-check": "yarn prettier --check .",
"prepare": "husky install"
},
"devDependencies": {
"@types/express": "^4.17.17",
"@types/jest": "^29.4.4",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-promise": "^6.0.0",
"prettier": "2.8.4",
"ts-jest": "^29.0.5",
"typescript": "^4.9.5"
"typescript": "*",
"husky": "^8.0.0"
},
"dependencies": {
"express": "^4.18.2",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import express from "express"
import express from 'express'

const app = express()
export const port = 42069
Expand Down
12 changes: 5 additions & 7 deletions src/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {port} from '../index'

test('Simple test', async () => {
// for some reason using port from imported varaible gives weird errors
let response = await fetch('http://localhost:42069/test')
let text = await response.text();
expect(text).toEqual('Hello from typescript express!')
});
// for some reason using port from imported varaible gives weird errors
const response = await fetch('http://localhost:42069/test')
const text = await response.text()
expect(text).toEqual('Hello from typescript express!')
})
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"target": "es6",
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist"
"outDir": "dist",
"strictNullChecks": true
},
"lib": ["es2015"],
"include": [
Expand Down
Loading