Skip to content

Commit fb6114a

Browse files
Copilothuangyiirene
andcommitted
Add documentation and update package configs for testing
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent bf89379 commit fb6114a

13 files changed

Lines changed: 256 additions & 9 deletions

File tree

.github/workflows/pr-checks.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: PR Checks
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
validate:
9+
name: Validate PR
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup pnpm
19+
uses: pnpm/action-setup@v4
20+
with:
21+
version: 8
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20.x'
27+
cache: 'pnpm'
28+
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
31+
32+
- name: Type check
33+
run: pnpm build
34+
35+
- name: Run tests
36+
run: pnpm test
37+
38+
- name: Run linter
39+
run: pnpm lint
40+
continue-on-error: true
41+
42+
- name: Comment on PR
43+
if: success()
44+
uses: actions/github-script@v7
45+
with:
46+
script: |
47+
const message = `✅ All checks passed!\n\n- ✅ Type check passed\n- ✅ Tests passed\n- ✅ Lint check completed`;
48+
github.rest.issues.createComment({
49+
issue_number: context.issue.number,
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
body: message
53+
});

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Comprehensive test suite using Vitest and React Testing Library
13+
- Test coverage for @object-ui/protocol, @object-ui/engine, @object-ui/renderer, @object-ui/ui, and @object-ui/designer packages
14+
- GitHub Actions CI/CD workflows:
15+
- CI workflow for automated testing, linting, and building
16+
- Release workflow for publishing new versions
17+
- Test coverage reporting with @vitest/coverage-v8
18+
- Contributing guidelines (CONTRIBUTING.md)
19+
- Documentation for testing and development workflow in README
20+
21+
### Changed
22+
23+
- Updated package.json scripts to use Vitest instead of placeholder test commands
24+
- Enhanced README with testing instructions and CI status badges
25+
26+
## [0.1.0] - Initial Release
27+
28+
### Added
29+
30+
- Core packages:
31+
- @object-ui/protocol - Pure metadata definitions and types
32+
- @object-ui/engine - Headless logic for handling data
33+
- @object-ui/renderer - Schema to UI component renderer
34+
- @object-ui/ui - High-quality UI components built with Tailwind CSS & Shadcn
35+
- @object-ui/designer - Drag-and-drop visual editor
36+
- Monorepo structure using pnpm and TurboRepo
37+
- Basic TypeScript configuration
38+
- Example applications in the examples directory
39+
40+
[Unreleased]: https://github.com/objectql/object-ui/compare/v0.1.0...HEAD
41+
[0.1.0]: https://github.com/objectql/object-ui/releases/tag/v0.1.0

CONTRIBUTING.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Contributing to Object UI
2+
3+
Thank you for your interest in contributing to Object UI! This document provides guidelines and instructions for contributing.
4+
5+
## Getting Started
6+
7+
1. Fork the repository
8+
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/object-ui.git`
9+
3. Install dependencies: `pnpm install`
10+
4. Create a new branch: `git checkout -b feature/your-feature-name`
11+
12+
## Development Workflow
13+
14+
### Running Tests
15+
16+
```bash
17+
# Run all tests
18+
pnpm test
19+
20+
# Run tests in watch mode
21+
pnpm test:watch
22+
23+
# Run tests with UI
24+
pnpm test:ui
25+
26+
# Generate coverage report
27+
pnpm test:coverage
28+
```
29+
30+
### Building
31+
32+
```bash
33+
# Build all packages
34+
pnpm build
35+
36+
# Build specific package
37+
cd packages/protocol && pnpm build
38+
```
39+
40+
### Linting
41+
42+
```bash
43+
# Lint all packages
44+
pnpm lint
45+
```
46+
47+
## Writing Tests
48+
49+
All tests should be placed in `__tests__` directories within the source code. We use **Vitest** and **React Testing Library**.
50+
51+
Example test structure:
52+
53+
```typescript
54+
import { describe, it, expect } from 'vitest';
55+
import { render, screen } from '@testing-library/react';
56+
57+
describe('ComponentName', () => {
58+
it('should render correctly', () => {
59+
render(<ComponentName />);
60+
expect(screen.getByText('Expected Text')).toBeInTheDocument();
61+
});
62+
});
63+
```
64+
65+
## Commit Guidelines
66+
67+
We follow conventional commit messages:
68+
69+
- `feat:` - New features
70+
- `fix:` - Bug fixes
71+
- `docs:` - Documentation changes
72+
- `test:` - Adding or updating tests
73+
- `chore:` - Maintenance tasks
74+
- `refactor:` - Code refactoring
75+
76+
Example: `feat: add new button variant`
77+
78+
## Pull Request Process
79+
80+
1. Ensure all tests pass: `pnpm test`
81+
2. Ensure the build succeeds: `pnpm build`
82+
3. Update documentation if needed
83+
4. Create a pull request with a clear description of changes
84+
5. Link any relevant issues
85+
86+
## Code Style
87+
88+
- Follow existing code style in the project
89+
- Use TypeScript for type safety
90+
- Write meaningful variable and function names
91+
- Add comments for complex logic
92+
- Keep functions small and focused
93+
94+
## Adding New Packages
95+
96+
If you need to add a new package to the monorepo:
97+
98+
1. Create a new directory under `packages/`
99+
2. Add a `package.json` with proper workspace dependencies
100+
3. Update the main README if the package is user-facing
101+
4. Add tests for the new package
102+
103+
## Questions?
104+
105+
If you have questions, feel free to:
106+
- Open an issue with the `question` label
107+
- Start a discussion in GitHub Discussions
108+
- Reach out to the maintainers
109+
110+
## License
111+
112+
By contributing, you agree that your contributions will be licensed under the MIT License.

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
A high-performance, schema-driven UI system built on **React 18**, **Tailwind CSS**, and **Shadcn UI**.
88

9+
[![CI](https://github.com/objectql/object-ui/actions/workflows/ci.yml/badge.svg)](https://github.com/objectql/object-ui/actions/workflows/ci.yml)
10+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11+
912
[Documentation](https://objectui.org) · [Playground](https://object-ui.org/playground) · [Report Bug](https://github.com/objectql/object-ui/issues)
1013

1114
</div>
@@ -126,6 +129,36 @@ pnpm dev
126129

127130
```
128131

132+
### Testing
133+
134+
We use **Vitest** for testing. All tests are located in `__tests__` directories within each package.
135+
136+
```bash
137+
# Run all tests
138+
pnpm test
139+
140+
# Run tests in watch mode
141+
pnpm test:watch
142+
143+
# Run tests with UI
144+
pnpm test:ui
145+
146+
# Generate coverage report
147+
pnpm test:coverage
148+
149+
```
150+
151+
### Building
152+
153+
```bash
154+
# Build all packages
155+
pnpm build
156+
157+
# Lint all packages
158+
pnpm lint
159+
160+
```
161+
129162
## 🤝 Contributing
130163

131164
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

packages/designer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"types": "dist/index.d.ts",
77
"scripts": {
88
"build": "tsc",
9-
"test": "echo \"Error: no test specified\" && exit 1"
9+
"test": "vitest run",
10+
"test:watch": "vitest"
1011
},
1112
"peerDependencies": {
1213
"react": "^19.2.3",

packages/designer/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"noEmit": false,
66
"jsx": "react-jsx"
77
},
8-
"include": ["src"]
8+
"include": ["src"],
9+
"exclude": ["**/__tests__/**", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"]
910
}

packages/engine/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"types": "dist/index.d.ts",
77
"scripts": {
88
"build": "tsc",
9-
"test": "echo \"Error: no test specified\" && exit 1"
9+
"test": "vitest run",
10+
"test:watch": "vitest"
1011
},
1112
"dependencies": {
1213
"@object-ui/protocol": "workspace:*"

packages/engine/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"noUnusedParameters": true,
1515
"noFallthroughCasesInSwitch": true
1616
},
17-
"include": ["src"]
17+
"include": ["src"],
18+
"exclude": ["**/__tests__/**", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"]
1819
}

packages/protocol/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"types": "dist/index.d.ts",
77
"scripts": {
88
"build": "tsc",
9-
"test": "echo \"Error: no test specified\" && exit 1"
9+
"test": "vitest run",
10+
"test:watch": "vitest"
1011
},
1112
"dependencies": {
1213
}

packages/protocol/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"outDir": "./dist",
55
"noEmit": false
66
},
7-
"include": ["src"]
7+
"include": ["src"],
8+
"exclude": ["**/__tests__/**", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"]
89
}

0 commit comments

Comments
 (0)