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

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

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Type check
run: npm run typecheck

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Test
run: npm run test:run
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'WASM version (e.g., 0.0.46.1)'
required: true
t_ruby_version:
description: 't-ruby version (e.g., 0.0.46, defaults to latest)'
required: false

permissions:
contents: write
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm install

- name: Extract version
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ inputs.version }}"
T_RUBY_VERSION="${{ inputs.t_ruby_version }}"
else
VERSION=${GITHUB_REF#refs/tags/v}
T_RUBY_VERSION=""
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "t_ruby_version=$T_RUBY_VERSION" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"

- name: Build
run: npm run build

- name: Update version
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version

- name: Publish to npm
run: npm publish --access public --provenance

- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: "v${{ steps.version.outputs.version }}"
generate_release_notes: true
files: |
dist/*
package.json
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Dependencies
node_modules/

# Build output
dist/

# IDE
.idea/
.vscode/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Logs
*.log
npm-debug.log*

# Test coverage
coverage/

# Environment
.env
.env.local
.env.*.local

# Temporary files
tmp/
temp/
*.tmp

# Package manager locks (optional, uncomment if not using)
# package-lock.json
# yarn.lock
# pnpm-lock.yaml
114 changes: 114 additions & 0 deletions CONTRIBUTING.ko.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# T-Ruby WASM 기여 가이드

> [English Documentation](./CONTRIBUTING.md)

T-Ruby WASM에 기여해 주셔서 감사합니다! 이 문서는 기여자를 위한 가이드라인과 정보를 제공합니다.

## 행동 강령

모든 상호작용에서 존중과 건설적인 태도를 유지해 주세요. 모든 배경과 경험 수준의 기여자를 환영합니다.

## 시작하기

1. 저장소를 포크하세요
2. 포크한 저장소를 클론하세요:
```bash
git clone https://github.com/YOUR_USERNAME/t-ruby-wasm.git
cd t-ruby-wasm
```
3. 의존성을 설치하세요:
```bash
npm install
```
4. 변경사항을 위한 브랜치를 생성하세요:
```bash
git checkout -b feature/your-feature-name
```

## 개발 가이드라인

### 코드 스타일

- 모든 소스 파일에 TypeScript 사용
- 기존 코드 스타일 준수
- 각 파일은 하나의 export만 가져야 함
- 파일은 100줄 미만으로 유지 (주석 포함)
- 종합적인 JSDoc 주석 작성

### SOLID 원칙

SOLID 원칙을 따릅니다:

- **S**ingle Responsibility: 각 클래스/모듈은 하나의 책임만
- **O**pen/Closed: 확장에 열려있고 수정에 닫혀있음
- **L**iskov Substitution: 서브타입은 대체 가능해야 함
- **I**nterface Segregation: 인터페이스를 작고 집중적으로 유지
- **D**ependency Inversion: 추상화에 의존

### DRY 원칙

같은 코드를 반복하지 마세요. 공통 로직은 재사용 가능한 유틸리티로 추출하세요.

## 테스팅

### 테스트 주도 개발 (TDD)

TDD 방법론을 사용합니다:

1. 먼저 실패하는 테스트 작성
2. 테스트를 통과하는 최소한의 코드 작성
3. 테스트를 통과 상태로 유지하면서 리팩토링

### 테스트 실행

```bash
# 테스트 실행
npm test

# 감시 모드로 테스트 실행
npm run test:watch

# 커버리지와 함께 테스트 실행
npm run test:coverage
```

## Pull Request 과정

1. 모든 테스트가 통과하는지 확인
2. 필요한 경우 문서 업데이트
3. 새 기능에 대한 테스트 추가
4. 커밋은 원자적이고 설명이 잘 되어야 함
5. 관련 이슈 참조

### 커밋 메시지 형식

```
type: 짧은 설명

필요한 경우 더 긴 설명.

Fixes #123
```

타입: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`

## 프로젝트 구조

```
t-ruby-wasm/
├── src/
│ ├── types/ # 타입 정의 (파일당 하나)
│ ├── vm/ # Ruby VM 관련 코드
│ ├── utils/ # 유틸리티 함수
│ ├── TRuby.ts # 메인 TRuby 클래스
│ ├── createTRuby.ts # 팩토리 함수
│ ├── VirtualFileSystem.ts
│ └── index.ts # 공개 exports
├── tests/ # 테스트 파일
├── scripts/ # 빌드 스크립트
└── dist/ # 빌드 출력
```

## 질문이 있으신가요?

질문이나 논의를 위해 이슈를 열어주세요.
114 changes: 114 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Contributing to T-Ruby WASM

> [한국어 문서](./CONTRIBUTING.ko.md)

Thank you for your interest in contributing to T-Ruby WASM! This document provides guidelines and information for contributors.

## Code of Conduct

Please be respectful and constructive in all interactions. We welcome contributors of all backgrounds and experience levels.

## Getting Started

1. Fork the repository
2. Clone your fork:
```bash
git clone https://github.com/YOUR_USERNAME/t-ruby-wasm.git
cd t-ruby-wasm
```
3. Install dependencies:
```bash
npm install
```
4. Create a branch for your changes:
```bash
git checkout -b feature/your-feature-name
```

## Development Guidelines

### Code Style

- Use TypeScript for all source files
- Follow the existing code style
- Each file should have a single export
- Keep files under 100 lines (including comments)
- Write comprehensive JSDoc comments

### SOLID Principles

We follow SOLID principles:

- **S**ingle Responsibility: Each class/module has one responsibility
- **O**pen/Closed: Open for extension, closed for modification
- **L**iskov Substitution: Subtypes must be substitutable
- **I**nterface Segregation: Keep interfaces small and focused
- **D**ependency Inversion: Depend on abstractions

### DRY Principle

Don't Repeat Yourself. Extract common logic into reusable utilities.

## Testing

### Test-Driven Development (TDD)

We use TDD methodology:

1. Write a failing test first
2. Write the minimum code to pass the test
3. Refactor while keeping tests green

### Running Tests

```bash
# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage
```

## Pull Request Process

1. Ensure all tests pass
2. Update documentation if needed
3. Add tests for new functionality
4. Keep commits atomic and well-described
5. Reference any related issues

### Commit Message Format

```
type: short description

Longer description if needed.

Fixes #123
```

Types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`

## Project Structure

```
t-ruby-wasm/
├── src/
│ ├── types/ # Type definitions (one per file)
│ ├── vm/ # Ruby VM related code
│ ├── utils/ # Utility functions
│ ├── TRuby.ts # Main TRuby class
│ ├── createTRuby.ts # Factory function
│ ├── VirtualFileSystem.ts
│ └── index.ts # Public exports
├── tests/ # Test files
├── scripts/ # Build scripts
└── dist/ # Build output
```

## Questions?

Feel free to open an issue for questions or discussions.
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BSD 2-Clause License

Copyright (c) 2024-2025, Y. Fred Kim
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading