Skip to content
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
60 changes: 22 additions & 38 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,22 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build design system
run: npm run design-system:build
run: bun run design-system:build

- name: Check formatting with Prettier
working-directory: ./app
run: npm run prettier
run: bun run prettier

- name: Run ESLint
working-directory: ./app
run: npm run eslint
run: bun run eslint

typecheck:
name: Type checking
Expand All @@ -44,22 +40,18 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build design system
run: npm run design-system:build
run: bun run design-system:build

- name: Run TypeScript type checks
working-directory: ./app
run: npm run typecheck
run: bun run typecheck

test:
name: Tests
Expand All @@ -69,25 +61,21 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build design system
run: npm run design-system:build
run: bun run design-system:build

- name: Run design system tests
run: npm test --workspace=@policyengine/design-system
run: bun run test --filter=@policyengine/design-system

- name: Run app tests
working-directory: ./app
run: npm test
run: bun run test

build:
name: Build
Expand All @@ -97,19 +85,15 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build design system
run: npm run design-system:build
run: bun run design-system:build

- name: Build application
working-directory: ./app
run: npm run build
run: bun run build
11 changes: 7 additions & 4 deletions .github/workflows/publish-design-system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,22 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Setup Node.js for npm publish
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build design system
run: npm run build --workspace=@policyengine/design-system
run: bun run build --filter=@policyengine/design-system

- name: Run tests
run: npm run test --workspace=@policyengine/design-system
run: bun run test --filter=@policyengine/design-system

- name: Release
run: npx semantic-release
Expand Down
60 changes: 22 additions & 38 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,22 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build design system
run: npm run design-system:build
run: bun run design-system:build

- name: Check formatting with Prettier
working-directory: ./app
run: npm run prettier
run: bun run prettier

- name: Run ESLint
working-directory: ./app
run: npm run eslint
run: bun run eslint

typecheck:
name: Type checking
Expand All @@ -43,22 +39,18 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build design system
run: npm run design-system:build
run: bun run design-system:build

- name: Run TypeScript type checks
working-directory: ./app
run: npm run typecheck
run: bun run typecheck

test:
name: Tests
Expand All @@ -68,25 +60,21 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build design system
run: npm run design-system:build
run: bun run design-system:build

- name: Run design system tests
run: npm test --workspace=@policyengine/design-system
run: bun run test --filter=@policyengine/design-system

- name: Run app tests
working-directory: ./app
run: npm test
run: bun run test

build:
name: Build
Expand All @@ -96,19 +84,15 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build design system
run: npm run design-system:build
run: bun run design-system:build

- name: Build application
working-directory: ./app
run: npm run build
run: bun run build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
bun-debug.log*

# Editor directories and files
.vscode/*
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ const PolicyEngineLogo = '/assets/logos/policyengine/white.svg';

## Before Committing

1. Run `cd app && npm run prettier -- --write .` to format
2. Run `npm run lint` to check for errors
1. Run `cd app && bun run prettier -- --write .` to format
2. Run `bun run lint` to check for errors
3. CI uses `--max-warnings 0` so fix all warnings
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ help:
@echo " make deploy - Build and deploy to GitHub Pages"

install:
npm install
bun install

dev:
npm run dev
bun run dev

build:
cd app && npm run build-with-types
cd app && bun run build-with-types

typecheck:
cd app && npm run typecheck
cd app && bun run typecheck

test-all:
cd app && npm run test-all
cd app && bun run test-all

test:
cd app && npm run test
cd app && bun run test

lint:
cd app && npm run lint
cd app && bun run lint

format:
cd app && npm run prettier:write
cd app && bun run prettier:write

clean:
rm -rf app/dist app/node_modules node_modules packages/*/node_modules

deploy: build
@echo "Build complete. GitHub Actions will handle deployment"
@echo "Build complete. GitHub Actions will handle deployment"
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ A modern web application for policy analysis and simulation, built with React, T

### Prerequisites

- Node.js 20 or higher
- npm
- Bun 1.0 or higher (https://bun.sh)

### Installation

Expand Down
10 changes: 5 additions & 5 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
"dev": "node scripts/dev-server.mjs",
"dev:website": "VITE_APP_MODE=website vite",
"dev:calculator": "VITE_APP_MODE=calculator vite",
"build": "npm run build:website && npm run build:calculator",
"build": "bun run build:website && bun run build:calculator",
"build:calculator": "VITE_APP_MODE=calculator vite build",
"build:website": "VITE_APP_MODE=website vite build",
"build-with-types": "tsc --noEmit && vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"lint": "npm run eslint && npm run stylelint",
"lint": "bun run eslint && bun run stylelint",
"eslint": "eslint . --cache",
"stylelint": "stylelint '**/*.css' --cache",
"prettier": "prettier --check \"**/*.{ts,tsx}\"",
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
"vitest": "vitest run",
"vitest:watch": "vitest",
"test-all": "npm run prettier && npm run eslint && npm run typecheck && npm run vitest && npm run build",
"test": "npm run vitest",
"test:quick": "npm run vitest",
"test-all": "bun run prettier && bun run eslint && bun run typecheck && bun run vitest && bun run build",
"test": "bun run vitest",
"test:quick": "bun run vitest",
"storybook": "storybook dev -p 6006",
"storybook:build": "storybook build"
},
Expand Down
10 changes: 6 additions & 4 deletions app/src/tests/unit/hooks/useCreateHousehold.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ describe('useCreateHousehold', () => {
expect(result.current.isPending).toBe(false);
});

// Verify API calls
expect(mockCreateHousehold).toHaveBeenCalledWith(mockHouseholdCreationPayload);
// Verify API calls (check only first argument, as React Query may pass additional context)
expect(mockCreateHousehold).toHaveBeenCalled();
expect(mockCreateHousehold.mock.calls[0][0]).toEqual(mockHouseholdCreationPayload);
expect(mockCreateHouseholdAssociationMutateAsync).toHaveBeenCalledWith({
userId: TEST_IDS.USER_ID,
householdId: TEST_IDS.HOUSEHOLD_ID,
Expand Down Expand Up @@ -177,8 +178,9 @@ describe('useCreateHousehold', () => {
associationError
);

// Household creation should succeed
expect(mockCreateHousehold).toHaveBeenCalledWith(mockHouseholdCreationPayload);
// Household creation should succeed (check only first argument)
expect(mockCreateHousehold).toHaveBeenCalled();
expect(mockCreateHousehold.mock.calls[0][0]).toEqual(mockHouseholdCreationPayload);
});
});

Expand Down
Loading