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
104 changes: 104 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: CI

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm test

- name: Generate coverage report
if: matrix.node-version == '20.x'
run: pnpm test:coverage

- name: Upload coverage to Codecov
if: matrix.node-version == '20.x'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run linter
run: pnpm lint

build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build packages
run: pnpm build

- name: Check for build artifacts
run: |
if [ ! -d "packages/protocol/dist" ]; then
echo "Protocol package build failed"
exit 1
fi
echo "All packages built successfully"
53 changes: 53 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: PR Checks

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
validate:
name: Validate PR
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Type check
run: pnpm build

- name: Run tests
run: pnpm test

- name: Run linter
run: pnpm lint
continue-on-error: true

- name: Comment on PR
if: success()
uses: actions/github-script@v7
with:
script: |
const message = `✅ All checks passed!\n\n- ✅ Type check passed\n- ✅ Tests passed\n- ✅ Lint check completed`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: message
});
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
name: Create Release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm test

- name: Build packages
run: pnpm build

- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ steps.get_version.outputs.VERSION }}
body: |
Release version ${{ steps.get_version.outputs.VERSION }}

## What's Changed
Please see the [CHANGELOG](CHANGELOG.md) for details.
draft: false
prerelease: false

# Uncomment the following steps when ready to publish to npm
# - name: Publish to npm
# run: pnpm publish -r --access public
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Comprehensive test suite using Vitest and React Testing Library
- Test coverage for @object-ui/protocol, @object-ui/engine, @object-ui/renderer, @object-ui/ui, and @object-ui/designer packages
- GitHub Actions CI/CD workflows:
- CI workflow for automated testing, linting, and building
- Release workflow for publishing new versions
- Test coverage reporting with @vitest/coverage-v8
- Contributing guidelines (CONTRIBUTING.md)
- Documentation for testing and development workflow in README

### Changed

- Updated package.json scripts to use Vitest instead of placeholder test commands
- Enhanced README with testing instructions and CI status badges

## [0.1.0] - Initial Release

### Added

- Core packages:
- @object-ui/protocol - Pure metadata definitions and types
- @object-ui/engine - Headless logic for handling data
- @object-ui/renderer - Schema to UI component renderer
- @object-ui/ui - High-quality UI components built with Tailwind CSS & Shadcn
- @object-ui/designer - Drag-and-drop visual editor
- Monorepo structure using pnpm and TurboRepo
- Basic TypeScript configuration
- Example applications in the examples directory

[Unreleased]: https://github.com/objectql/object-ui/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/objectql/object-ui/releases/tag/v0.1.0
112 changes: 112 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Contributing to Object UI

Thank you for your interest in contributing to Object UI! This document provides guidelines and instructions for contributing.

## Getting Started

1. Fork the repository
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/object-ui.git`
3. Install dependencies: `pnpm install`
4. Create a new branch: `git checkout -b feature/your-feature-name`

## Development Workflow

### Running Tests

```bash
# Run all tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Run tests with UI
pnpm test:ui

# Generate coverage report
pnpm test:coverage
```

### Building

```bash
# Build all packages
pnpm build

# Build specific package
cd packages/protocol && pnpm build
```

### Linting

```bash
# Lint all packages
pnpm lint
```

## Writing Tests

All tests should be placed in `__tests__` directories within the source code. We use **Vitest** and **React Testing Library**.

Example test structure:

```typescript
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';

describe('ComponentName', () => {
it('should render correctly', () => {
render(<ComponentName />);
expect(screen.getByText('Expected Text')).toBeInTheDocument();
});
});
```

## Commit Guidelines

We follow conventional commit messages:

- `feat:` - New features
- `fix:` - Bug fixes
- `docs:` - Documentation changes
- `test:` - Adding or updating tests
- `chore:` - Maintenance tasks
- `refactor:` - Code refactoring

Example: `feat: add new button variant`

## Pull Request Process

1. Ensure all tests pass: `pnpm test`
2. Ensure the build succeeds: `pnpm build`
3. Update documentation if needed
4. Create a pull request with a clear description of changes
5. Link any relevant issues

## Code Style

- Follow existing code style in the project
- Use TypeScript for type safety
- Write meaningful variable and function names
- Add comments for complex logic
- Keep functions small and focused

## Adding New Packages

If you need to add a new package to the monorepo:

1. Create a new directory under `packages/`
2. Add a `package.json` with proper workspace dependencies
3. Update the main README if the package is user-facing
4. Add tests for the new package

## Questions?

If you have questions, feel free to:
- Open an issue with the `question` label
- Start a discussion in GitHub Discussions
- Reach out to the maintainers

## License

By contributing, you agree that your contributions will be licensed under the MIT License.
Loading
Loading