diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7969284 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + name: Test and Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + + - name: Setup Bun + uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0 + with: + bun-version: latest + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Test code + run: bun run test + + - name: Lint code + run: bun run lint diff --git a/apps/wordle/src/lib/get-tile-colors.ts b/apps/wordle/src/lib/get-tile-colors.ts index a4b04f1..6ee09a7 100644 --- a/apps/wordle/src/lib/get-tile-colors.ts +++ b/apps/wordle/src/lib/get-tile-colors.ts @@ -9,7 +9,10 @@ function getTileColors(guessWord: string, secretWord: string): TileColor[] { "absent", ); const letterCounts = [...secret].reduce>( - (res, char) => ((res[char] = (res[char] || 0) + 1), res), + (res, char) => { + res[char] = (res[char] || 0) + 1; + return res; + }, {}, ); diff --git a/package.json b/package.json index cd9efa6..19acb35 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,9 @@ } }, "scripts": { - "format": "bunx biome format --write" + "test": "bun test", + "lint": "biome lint", + "format": "biome format --write" }, "devDependencies": { "@biomejs/biome": "2.3.10",