Skip to content

Commit 5d639a5

Browse files
committed
Add Makefile to centralize build commands
- Create Makefile with targets: install, test, test-coverage, build, lint, lint-fix, clean, ci, start - Update GitHub Actions CI workflow to use Makefile commands - Add help target to display available commands - Run prettier to fix code formatting
1 parent 080ef5c commit 5d639a5

File tree

3 files changed

+60
-7
lines changed

3 files changed

+60
-7
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
cache: 'yarn'
2727

2828
- name: Install dependencies
29-
run: yarn install --frozen-lockfile
29+
run: make install
3030

31-
- name: Run tests
32-
run: yarn test --coverage --watchAll=false
31+
- name: Run tests with coverage
32+
run: make test-coverage
3333

3434
- name: Build
35-
run: yarn build
35+
run: make build
3636

3737
- name: Upload coverage to Codecov
3838
if: matrix.node-version == '20.x'
@@ -57,7 +57,7 @@ jobs:
5757
cache: 'yarn'
5858

5959
- name: Install dependencies
60-
run: yarn install --frozen-lockfile
60+
run: make install
6161

6262
- name: Check formatting with Prettier
63-
run: yarn prettier --check "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"
63+
run: make lint

Makefile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.PHONY: help install test test-coverage build lint lint-fix clean ci start
2+
3+
# Default target
4+
help:
5+
@echo "Available targets:"
6+
@echo " make install - Install dependencies"
7+
@echo " make test - Run tests"
8+
@echo " make test-coverage - Run tests with coverage"
9+
@echo " make build - Build production bundle"
10+
@echo " make lint - Check code formatting"
11+
@echo " make lint-fix - Fix code formatting"
12+
@echo " make clean - Clean build artifacts"
13+
@echo " make ci - Run all CI checks (test + build + lint)"
14+
@echo " make start - Start development server"
15+
16+
# Install dependencies
17+
install:
18+
yarn install --frozen-lockfile
19+
20+
# Run tests without coverage
21+
test:
22+
yarn test --watchAll=false
23+
24+
# Run tests with coverage
25+
test-coverage:
26+
yarn test --watchAll=false --coverage
27+
28+
# Build production bundle
29+
build:
30+
yarn build
31+
32+
# Check code formatting with Prettier
33+
lint:
34+
yarn prettier --check "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"
35+
36+
# Fix code formatting with Prettier
37+
lint-fix:
38+
yarn prettier --write "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"
39+
40+
# Clean build artifacts
41+
clean:
42+
rm -rf build
43+
rm -rf coverage
44+
rm -rf node_modules
45+
46+
# Run all CI checks
47+
ci: test-coverage build lint
48+
49+
# Start development server
50+
start:
51+
yarn start

src/App.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ describe("URL parameter handling", () => {
122122
// The "No" option for display mode should be bold (active)
123123
const displayModeOptions = screen.getAllByText(/^(Yes|No)$/);
124124
const noOption = displayModeOptions.find(
125-
(el) => el.textContent === "No" && el.getAttribute("href") === "#disable-displaymode"
125+
(el) =>
126+
el.textContent === "No" &&
127+
el.getAttribute("href") === "#disable-displaymode"
126128
);
127129

128130
expect(noOption).toHaveStyle({ fontWeight: "bold" });

0 commit comments

Comments
 (0)