Thank you for your interest in contributing to the wasmCloud TypeScript ecosystem! This guide will help you get started with contributing to our collection of TypeScript examples and project templates for wasmCloud.
- Development Setup
- Repository Structure
- Development Workflow
- Code Standards
- Testing
- Commit Guidelines
- Pull Request Process
- Working with wasmCloud
- Debugging
- Getting Help
-
Fork and clone the repository:
git clone https://github.com/your-username/typescript.git cd typescript -
Install dependencies for the example or template you're working on:
cd examples/components/http-hello-world npm install
The repository is organized as follows:
├── examples/ # Example components and usage
│ └── components/ # TypeScript component examples
├── templates/ # Project templates for wash new
└── .github/ # GitHub configuration and workflows
| Example | Path | Description |
|---|---|---|
| TypeScript Components | examples/components/ |
Sample wasmCloud components written in TypeScript |
To create a new example component, copy the structure of an existing example. See examples/README.md for details on the expected structure and configuration.
- Examples should be standalone and self-contained
Each example and template is a standalone npm package. Navigate to the directory you're working in and use npm scripts directly.
npm run buildnpm testCheck code style and linting:
npm run lintAutomatically fix linting issues:
npm run lint:fixCheck code formatting:
npm run formatAutomatically fix formatting issues:
npm run format:fix- Use strict TypeScript configuration
- Prefer explicit types over
any - Use meaningful variable and function names
- Document public APIs with JSDoc comments
We use ESLint and Prettier for consistent code formatting:
- ESLint: Enforces code quality and consistency rules
- Prettier: Handles code formatting
- Import ordering: Imports should be ordered (external, internal, relative)
- Files:
kebab-case.ts - Directories:
kebab-case - Functions/Variables:
camelCase - Types/Interfaces:
PascalCase - Constants/Globals:
SCREAMING_SNAKE_CASE
- Write unit tests for all business logic
- Use descriptive test names
- Follow the Arrange-Act-Assert pattern
- Mock external dependencies
- Test component interactions
- Verify API contracts
- Test error scenarios
- Avoid mocks where possible (prefer containerized dependencies for realistic testing environments)
- Test complete user workflows
- Require running wasmCloud infrastructure
- Use realistic test data
suite('Component', () => {
describe('feature', () => {
test('should handle normal case', () => {
// Test implementation
});
test('should handle edge case', () => {
// Test implementation
});
test('should throw error for invalid input', () => {
// Test implementation
});
});
});We follow Conventional Commits for commit messages:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Supported scopes include:
examples: Example components and usagedeps: Dependency updatesci: CI/CD changes
docs(readme): update installation instructions- Conventional commits: All commit messages must follow the Conventional Commits specification
- Sign-off required: All commits must be signed off (
git commit -s) as per Developer Certificate of Origin (DCO) - Descriptive messages: Explain what and why, not just what
- Single responsibility: One logical change per commit
- Working state: Each commit should leave the code in a working state
-
Create a feature branch:
git checkout -b feat/your-feature-name
-
Make your changes and test:
npm run build npm run lint npm test -
Commit with sign-off:
git commit -s -m "feat: your descriptive commit message"
Before creating a PR, ensure that your contribution(s) meet the following criteria:
- Descriptive title: Use conventional commit format
- Clear description: Explain what changes and why
- Link issues: Reference related issues with "Fixes #123"
- Tests: Include tests for new functionality
- Documentation: Update docs for user-facing changes
- Code follows project style guidelines
- Self-review completed
- Tests added/updated and passing
- Documentation updated if needed
- All commits are signed off
- CI checks are passing
To run and test examples locally you'll need the wash CLI.
Start a local wasmCloud environment:
wash upStop it when done:
wash down- Build errors: Ensure dependencies are installed (
npm install) and trynpm run build - Connection issues: Verify wasmCloud and NATS are running (
wash up)
- Issues: Check existing GitHub issues
- Discussions: Use GitHub Discussions
- Community: Join the wasmCloud Slack
- Documentation: See wasmCloud docs
Thank you for contributing to wasmCloud TypeScript! Your contributions help make WebAssembly and wasmCloud more accessible to the TypeScript ecosystem.