Thank you for your interest in contributing to @kloud-diagramming/core! This document provides guidelines and information for contributors.
- Node.js >= 16.0.0
- npm >= 8.0.0
- Git
-
Fork and Clone
git clone https://github.com/your-username/kloud-diagramming-core.git cd kloud-diagramming-core -
Install Dependencies
npm install
-
Build the Project
npm run build
-
Run Tests
npm test -
Start Development Server
npm run demo
src/
├── core/ # Core diagram classes (Diagram, Node, Edge, Cluster)
├── nodes/ # Cloud service node implementations
│ ├── aws/ # AWS service classes
│ ├── azure/ # Azure service classes
│ └── gcp/ # GCP service classes
├── renderers/ # D3.js renderer implementation
├── icons/ # Icon registry and provider modules
├── utils/ # Utility functions
├── types.ts # TypeScript type definitions
└── index.ts # Main exports
We use ESLint and Prettier for code formatting:
# Check linting
npm run lint
# Fix linting issues
npm run lint:fix
# Format code
npm run format
# Check formatting
npm run format:check# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage# Clean and build
npm run build
# Build in watch mode
npm run dev
# Check bundle size
npm run size-check- Create an issue describing the bug
- Fork the repository
- Create a branch:
git checkout -b fix/bug-description - Make your changes
- Add tests if applicable
- Submit a pull request
- Create an issue to discuss the feature
- Wait for approval from maintainers
- Fork the repository
- Create a branch:
git checkout -b feature/feature-name - Implement the feature
- Add comprehensive tests
- Update documentation
- Submit a pull request
To add a new cloud service node:
-
Create the service class in the appropriate provider directory:
// src/nodes/aws/NewService.ts import { AWSNode } from "../CloudNodes"; import { NodeOptions } from "../../types"; export class NewService extends AWSNode { constructor(id: string, label: string = "New Service", options: NodeOptions = {}) { super(id, label, "newservice", { category: "Compute", // or appropriate category description: "Description of the new service", ...options, }); } }
-
Export the class in the provider's index file:
// src/nodes/aws/AWSServices.ts export { NewService } from "./NewService";
-
Add to main exports:
// src/index.ts export { NewService } from "./nodes/aws/AWSServices";
-
Add tests:
// tests/nodes/aws/NewService.test.ts import { NewService } from "../../../src/nodes/aws/AWSServices"; describe("NewService", () => { it("should create a new service node", () => { const service = new NewService("test", "Test Service"); expect(service.provider).toBe("aws"); expect(service.service).toBe("newservice"); }); });
-
Add icon data to the appropriate provider file:
// src/icons/aws.ts export const awsIcons: Record<string, IconData> = { newservice: { svg: "data:image/svg+xml;base64,...", metadata: { name: "AWS New Service", description: "New service icon", category: "Compute", provider: "aws", service: "newservice", tags: ["aws", "compute"], version: "1.0.0", }, }, };
-
Test the icon in the demo
- Code follows the project's style guidelines
- Tests pass locally
- New features include tests
- Documentation is updated
- Commit messages are clear and descriptive
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tests pass
- [ ] New tests added
- [ ] Manual testing completed
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or clearly documented)- Write tests for all new functions and classes
- Use descriptive test names
- Test both success and error cases
- Aim for high code coverage
- Test complete workflows
- Test renderer functionality
- Test icon loading and fallbacks
describe("ComponentName", () => {
beforeEach(() => {
// Setup
});
afterEach(() => {
// Cleanup
});
describe("methodName", () => {
it("should handle normal case", () => {
// Test implementation
});
it("should handle edge case", () => {
// Test implementation
});
it("should throw error for invalid input", () => {
// Test implementation
});
});
});- Use JSDoc comments for all public APIs
- Include examples in documentation
- Document complex algorithms
- Keep comments up to date
- Update examples when adding features
- Keep API documentation current
- Add new service classes to the list
- Version Bump: Update version in
package.json - Changelog: Update
CHANGELOG.md - Build: Run
npm run build - Test: Run
npm run validate - Tag: Create git tag
- Publish: Run
npm publish
- Be respectful and inclusive
- Help others learn and grow
- Provide constructive feedback
- Follow the project's code of conduct
- Use GitHub issues for bug reports and feature requests
- Use GitHub discussions for questions and ideas
- Be clear and concise in communications
- Provide examples when possible
- Documentation: Check the docs
- Issues: Search existing issues first
- Discussions: Use GitHub discussions for questions
- Examples: Check the
examples/directory
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to @kloud-diagramming/core! 🎉