Skip to content

Commit f3bff31

Browse files
Merge pull request #1 from DIG-Network/cursor/build-typescript-chia-blockchain-client-50c9
Build TypeScript Chia blockchain client
2 parents 81274a1 + 9c6b416 commit f3bff31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+8871
-1
lines changed

.github/CI_OVERVIEW.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# CI/CD Overview for Chia Blockchain TypeScript Client
2+
3+
This document provides an overview of the continuous integration and deployment setup for this project.
4+
5+
## GitHub Actions Workflows
6+
7+
### 1. Main CI Pipeline (`ci.yml`)
8+
9+
**Trigger**: Push to main/develop branches, Pull requests
10+
11+
**Features**:
12+
- Multi-platform testing (Ubuntu, Windows, macOS)
13+
- Multi-version Node.js testing (16.x, 18.x, 20.x)
14+
- Test execution and coverage reporting
15+
- Integration with Codecov for coverage tracking
16+
- Security vulnerability scanning
17+
- PostgreSQL integration testing
18+
19+
**Key Steps**:
20+
1. Checkout code
21+
2. Setup Node.js with caching
22+
3. Install dependencies
23+
4. Run linter
24+
5. Build project
25+
6. Execute tests
26+
7. Generate coverage report
27+
8. Upload to Codecov
28+
29+
### 2. Code Quality Checks (`code-quality.yml`)
30+
31+
**Trigger**: Pull requests and pushes to main/develop
32+
33+
**Features**:
34+
- ESLint with automatic annotations
35+
- TypeScript strict mode verification
36+
- Console.log detection
37+
- TODO/FIXME comment tracking
38+
- Type coverage analysis (>90% required)
39+
- Bundle size checks (<500KB per file)
40+
- Circular dependency detection
41+
- Documentation coverage
42+
- Code complexity analysis
43+
- Duplication detection (<5% allowed)
44+
- License compatibility checks
45+
46+
### 3. Release Automation (`release.yml`)
47+
48+
**Trigger**: Git tags (v*.*.*) or manual dispatch
49+
50+
**Features**:
51+
- Automated version management
52+
- Changelog generation
53+
- GitHub release creation
54+
- NPM publishing
55+
- GitHub Packages publishing
56+
- Asset attachment to releases
57+
58+
### 4. Dependency Management (`dependency-update.yml`)
59+
60+
**Trigger**: Weekly schedule (Mondays at 9am UTC) or manual
61+
62+
**Features**:
63+
- Automated dependency updates
64+
- Security vulnerability detection
65+
- Automatic PR creation for updates
66+
- Vulnerability issue creation
67+
- Testing with updated dependencies
68+
69+
### 5. Pull Request Validation (`status-check.yml`)
70+
71+
**Trigger**: PR events (opened, synchronized, reopened)
72+
73+
**Features**:
74+
- Conventional commit validation
75+
- PR title format checking
76+
- Automatic PR labeling
77+
- PR size labeling
78+
- Merge conflict detection
79+
- Welcome message for new contributors
80+
81+
## Dependabot Configuration
82+
83+
**Update Schedule**: Weekly on Mondays
84+
85+
**Features**:
86+
- Grouped dependency updates
87+
- Major version update restrictions
88+
- Automatic PR creation
89+
- GitHub Actions dependency updates
90+
91+
## CI/CD Best Practices Implemented
92+
93+
### 1. Testing Strategy
94+
- Unit tests with Jest
95+
- Integration tests with PostgreSQL
96+
- Multi-platform compatibility testing
97+
- Coverage reporting and thresholds
98+
99+
### 2. Code Quality
100+
- Strict TypeScript configuration
101+
- ESLint with custom rules
102+
- Automated code formatting
103+
- Complexity analysis
104+
105+
### 3. Security
106+
- Regular dependency audits
107+
- License compatibility checks
108+
- Vulnerability scanning
109+
- Security issue reporting
110+
111+
### 4. Release Management
112+
- Semantic versioning
113+
- Automated changelog generation
114+
- Multi-registry publishing (NPM, GitHub)
115+
- Release asset management
116+
117+
### 5. Developer Experience
118+
- Fast CI feedback
119+
- Clear error messages
120+
- Automatic PR labeling
121+
- Helpful bot comments
122+
123+
## Required Secrets
124+
125+
The following secrets need to be configured in the repository:
126+
127+
1. `NPM_TOKEN` - For publishing to NPM registry
128+
2. `CODECOV_TOKEN` - For coverage reporting (optional)
129+
3. `GITHUB_TOKEN` - Automatically provided by GitHub Actions
130+
131+
## Local CI Simulation
132+
133+
Developers can simulate CI checks locally:
134+
135+
```bash
136+
# Install dependencies
137+
npm ci
138+
139+
# Run all checks
140+
npm run lint
141+
npm run build
142+
npm test
143+
npm run test:coverage
144+
npm audit
145+
146+
# Check for circular dependencies
147+
npx madge --circular --extensions ts src/
148+
149+
# Check bundle size
150+
npm run build && find dist -name "*.js" -size +500k
151+
152+
# Type coverage
153+
npx type-coverage --at-least 90
154+
```
155+
156+
## Monitoring and Notifications
157+
158+
- Build status badges in README
159+
- Failed build notifications via GitHub
160+
- PR comment notifications
161+
- Issue creation for vulnerabilities
162+
163+
## Performance Optimizations
164+
165+
1. **Dependency caching** - Node modules are cached between runs
166+
2. **Parallel jobs** - Tests run on multiple platforms simultaneously
167+
3. **Conditional steps** - Coverage only uploaded from one job
168+
4. **Smart test execution** - Only affected tests run on PRs
169+
170+
## Maintenance
171+
172+
### Regular Tasks
173+
- Review and merge Dependabot PRs
174+
- Monitor security alerts
175+
- Update GitHub Actions versions
176+
- Review and optimize workflow performance
177+
178+
### Troubleshooting Common Issues
179+
180+
1. **Cache issues**: Clear cache in Actions settings
181+
2. **Flaky tests**: Add retry logic or increase timeouts
182+
3. **Permission errors**: Check repository settings and PAT tokens
183+
4. **npm publish failures**: Verify NPM_TOKEN and 2FA settings
184+
185+
## Future Improvements
186+
187+
- [ ] Add visual regression testing
188+
- [ ] Implement canary deployments
189+
- [ ] Add performance benchmarking
190+
- [ ] Set up branch protection rules
191+
- [ ] Add CODEOWNERS file
192+
- [ ] Implement automated backports
193+
194+
## Resources
195+
196+
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
197+
- [Conventional Commits](https://www.conventionalcommits.org/)
198+
- [Semantic Versioning](https://semver.org/)
199+
- [Jest Documentation](https://jestjs.io/)
200+
- [TypeScript Handbook](https://www.typescriptlang.org/docs/)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
## Bug Description
11+
12+
A clear and concise description of what the bug is.
13+
14+
## To Reproduce
15+
16+
Steps to reproduce the behavior:
17+
1. Initialize client with '...'
18+
2. Call method '...'
19+
3. See error
20+
21+
## Expected Behavior
22+
23+
A clear and concise description of what you expected to happen.
24+
25+
## Actual Behavior
26+
27+
What actually happened instead.
28+
29+
## Code Example
30+
31+
```typescript
32+
// Minimal code example that reproduces the issue
33+
const client = new ChiaBlockchainClient({
34+
// config
35+
});
36+
37+
// Code that causes the bug
38+
```
39+
40+
## Error Messages
41+
42+
```
43+
// Any error messages or stack traces
44+
```
45+
46+
## Environment
47+
48+
- **OS**: [e.g., Ubuntu 22.04, Windows 11, macOS 13]
49+
- **Node.js version**: [e.g., 18.17.0]
50+
- **Package version**: [e.g., 1.0.0]
51+
- **TypeScript version**: [e.g., 5.1.6]
52+
53+
## Additional Context
54+
55+
Add any other context about the problem here.
56+
57+
## Possible Solution
58+
59+
If you have an idea of how to fix the bug, please describe it here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Documentation
4+
url: https://github.com/your-org/chia-blockchain-client#readme
5+
about: Please check the documentation first
6+
- name: Discord Community
7+
url: https://discord.gg/chia
8+
about: Join our Discord for discussions and quick questions
9+
- name: Security Issues
10+
url: https://github.com/your-org/chia-blockchain-client/security/policy
11+
about: Please report security vulnerabilities privately
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: 'enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
## Feature Description
11+
12+
A clear and concise description of what you want to happen.
13+
14+
## Problem Statement
15+
16+
Describe the problem you're trying to solve. Ex. I'm always frustrated when [...]
17+
18+
## Proposed Solution
19+
20+
Describe the solution you'd like to see implemented.
21+
22+
## Alternative Solutions
23+
24+
Describe any alternative solutions or features you've considered.
25+
26+
## API Design (if applicable)
27+
28+
```typescript
29+
// Example of how the API might look
30+
client.newFeature({
31+
option1: 'value',
32+
option2: true
33+
});
34+
```
35+
36+
## Use Cases
37+
38+
List specific use cases for this feature:
39+
1. Use case 1
40+
2. Use case 2
41+
3. Use case 3
42+
43+
## Breaking Changes
44+
45+
Would this feature require any breaking changes to existing APIs?
46+
47+
## Implementation Considerations
48+
49+
- Performance implications
50+
- Security considerations
51+
- Backward compatibility
52+
- Testing requirements
53+
54+
## Additional Context
55+
56+
Add any other context, mockups, or examples about the feature request here.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Question
3+
about: Ask a question about the project
4+
title: '[QUESTION] '
5+
labels: 'question'
6+
assignees: ''
7+
8+
---
9+
10+
## Question
11+
12+
A clear and concise description of your question.
13+
14+
## Context
15+
16+
Provide context about what you're trying to achieve.
17+
18+
## What I've Tried
19+
20+
Describe what you've already tried or researched:
21+
- Documentation sections read
22+
- Code examples attempted
23+
- Related issues reviewed
24+
25+
## Code Example (if applicable)
26+
27+
```typescript
28+
// Any relevant code
29+
```
30+
31+
## Environment
32+
33+
- **Package version**: [e.g., 1.0.0]
34+
- **Node.js version**: [e.g., 18.17.0]
35+
- **TypeScript version**: [e.g., 5.1.6]
36+
37+
## Additional Information
38+
39+
Any other relevant information that might help answer your question.

0 commit comments

Comments
 (0)