ReactStream is a comprehensive development and analysis toolkit for React components. It integrates two powerful tools into a single CLI interface:
- ReactStream Serve - For real-time component development and testing
- ReactStream Analyze - For code analysis, debugging, and optimization
# Global installation
npm install -g reactstream
# Local project installation
npm install --save-dev reactstream
# Or install from source
git clone https://github.com/reactstream/cli
cd reactstream
npm install
npm link
# Analyze a component
reactstream analyze MyComponent.js --debug
# Start development server
reactstream serve MyComponent.js --port=3000
ReactStream now uses a unified command interface with subcommands:
reactstream <command> [options] [arguments]
reactstream analyze <component1.js> [component2.js...] [options]
reactstream serve <component1.js> [component2.js...] [options]
reactstream help
- Hot Module Replacement (HMR)
- Isolated component testing
- Built-in UI component library
- Automatic dependency management
- Real-time preview
- Custom port configuration
- Card system
- Tab navigation
- Alert components
- Form elements
- Layout utilities
- Automatic setup and cleanup
- Webpack configuration
- Babel integration
- CSS processing
- Asset handling
- Syntax validation
- Best practices checking
- Hook rules verification
- Performance optimization
- Accessibility testing
- Automatic debugger insertion
- State tracking
- Effect monitoring
- Performance profiling
- Component comparison
- Code duplication detection
- Import optimization
- Performance suggestions
reactstream analyze [component] [options]
Options:
--debug Enable debug mode
--fix Auto-fix issues
--verbose Detailed output
reactstream serve [component] [options]
Options:
--port=<port> Specify the port to run the server on (default: 3000)
{
port: 3000,
hot: true,
open: true,
components: {
path: './src/components',
extensions: ['.js', '.jsx']
}
}
{
debug: false,
fix: false,
verbose: false,
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn'
}
}
ReactStream analyze performs detailed analysis of React components:
-
Syntax Validation
- Checks JSX syntax correctness
- Ensures proper component structure
- Validates import/export statements
-
Hook Analysis
- Ensures hooks are used according to React's rules
- Checks for proper dependencies in useEffect, useMemo, and useCallback
- Detects potential issues with hook ordering
-
Performance Analysis
- Identifies unnecessary re-renders
- Detects inline object creation in JSX
- Suggests memoization opportunities
-
Accessibility Analysis
- Checks for proper alt text on images
- Detects incorrect onClick handlers on non-interactive elements
- Ensures ARIA attributes are used correctly
The development server provides a robust environment for testing components:
-
Isolated Testing
- Renders components in a clean environment
- Provides built-in UI components for testing
- Supports multiple components simultaneously
-
Hot Module Replacement
- Instant feedback on changes
- Preserves component state during updates
- Accelerates development workflow
-
Built-in Components
- Card system for component display
- Tab navigation for multiple views
- Alert components for notifications
-
Component Development
- Use isolated testing with
reactstream serve
- Enable debug mode for detailed information
- Test components with different props and states
- Use isolated testing with
-
Code Analysis
- Run
reactstream analyze
before commits - Address critical issues first
- Review performance suggestions
- Maintain accessibility standards
- Run
-
Optimization
- Regular code analysis
- Component comparisons
- Performance monitoring
- Regular dependency updates
-
Port Conflicts
# Use a different port if the default is in use reactstream serve MyComponent.js --port=8080
-
ESLint Configuration
- The analyzer uses a default ESLint configuration
- It doesn't require a .eslintrc file in your project
-
JSX Transformation
- If you're using non-standard JSX transformations, you may need to adjust your Babel configuration
-
Analysis Errors
- Try running with
--debug
flag for more detailed error information - Check if your component syntax is valid
- Try running with
Please refer to CONTRIBUTING.md for guidelines on contributing to ReactStream.