Thank you for your interest in contributing to Eggstractor! This document provides guidelines and information about contributing to this project.
- Getting Started
- Development Process
- Project Structure
- Testing
- Adding New Features
- Style Guide
- Submitting Changes
- Fork the repository
- Clone your fork:
git clone https://github.com/bitovi/eggstractor.git
- Install dependencies:
npm install
- Create a new branch:
git checkout -b feature/your-feature-name
- Make your changes in your feature branch
- Run the plugin in Figma to test your changes
- Run
npm run dev
to start the plugin in watch mode - Load the plugin in Figma and test your changes
- Write or update tests as needed
- Run tests:
npm test
- Run the visualizer to check your changes:
npm run visualizer
src/
├── processors/ # property processors
│ ├── layout.processor.ts
│ ├── spacing.processor.ts
│ ├── border.processor.ts
│ ├── font.processor.ts
│ ├── gradient.processor.ts
│ └── background.processor.ts
├── services/ # data collection services
│ ├── collection.service.ts
│ ├── variable.service.ts
│ └── token.service.ts
├── transformers/ # data transformation services
│ ├── css.transformer.ts
│ └── scss.transformer.ts
├── tests/ # Test files
│ ├── fixtures/ # Test data
│ └── snapshots/ # Test snapshots
├── types/ # TypeScript type definitions
└── utils/ # Utility functions
visualizer/ # Visual testing tool
├── script.js
└── styles.css
- Create test fixtures in
src/tests/fixtures/
- Add test cases in the appropriate test file
- Run tests:
npm test
- Update snapshots if needed:
npm test -- -u
The visualizer helps you see how your changes affect the CSS output:
- Run
npm run visualizer
- Open
http://localhost:3000
in your browser - Check that your changes produce the expected CSS output
- Copy/Paste the css output from the Figma plugin in Figma to the visualizer to verify the output
- Create a new file in
src/processors/
- Follow the existing processor pattern:
export const newProcessor: StyleProcessor[] = [
{
property: "css-property",
bindingKey: "figmaProperty",
process: async (variables, node?) => {
// Your processing logic here
return {
value: "processed-value",
rawValue: "raw-value",
valueType: "unit"
};
}
}
];
- Add tests in
src/tests/
- Update
src/processors/index.ts
to include your processor
- Use TypeScript for all new code
- Follow existing code formatting (enforced by ESLint/Prettier)
- Write clear, descriptive commit messages
- Add comments for complex logic
- Update documentation when adding new features
- Push your changes to your fork
- Create a Pull Request (PR) to the main repository
- Ensure all tests pass
- Wait for review
- Clear description of changes
- Tests for new functionality
- Updated documentation if needed
- Passes all existing tests
- Follows style guidelines
If you have questions or need help:
- Check existing issues
- Create a new issue for discussion
- Tag with appropriate labels
Thank you for contributing to Eggstractor!