Thank you for your interest in contributing to DemoScript! This document provides guidelines and instructions for contributing.
- Node.js 18+
- npm 9+
-
Clone the repository:
git clone https://github.com/yourusername/demoscript.git cd demoscript -
Install dependencies:
npm install
-
Build all packages:
npm run build
-
Run tests:
cd packages/cli && npm test cd ../ui && npm test
demoscript/
├── packages/
│ ├── cli/ # CLI tool (serve, record, build commands)
│ │ ├── src/
│ │ │ ├── commands/ # CLI command implementations
│ │ │ ├── lib/ # Shared utilities
│ │ │ └── server/ # Express middleware
│ │ └── package.json
│ └── ui/ # React web interface
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── context/ # React context providers
│ │ ├── lib/ # Utility functions
│ │ └── types/ # TypeScript types
│ └── package.json
├── examples/ # Example demos
└── package.json # Root workspace config
cd packages/ui
npm run devThis starts the Vite dev server with hot reload.
cd packages/cli
npm run buildThen test with:
node dist/index.js serve ../examples/hello-worldnpm run build
node packages/cli/dist/index.js serve examples/hello-world --port 3000- TypeScript: Strict mode enabled
- React: Functional components with hooks
- Styling: Tailwind CSS
- Formatting: Use your editor's default formatting
- Keep components small and focused
- Use TypeScript types from
packages/ui/src/types/schema.ts - Test utility functions (see
*.test.tsfiles) - Avoid adding dependencies unless necessary
We use Vitest for testing. Tests are located alongside source files with .test.ts suffix.
# Run CLI tests
cd packages/cli && npm test
# Run UI tests
cd packages/ui && npm test- Test utility functions thoroughly
- Focus on edge cases and error handling
- Use descriptive test names
- Create a feature branch from
main - Make your changes
- Ensure tests pass
- Update documentation if needed
- Submit a pull request
- Keep PRs focused on a single feature or fix
- Include a clear description of changes
- Reference any related issues
To add a new step type:
-
Define the type in
packages/ui/src/types/schema.ts:export interface MyNewStep extends BaseStep { myNew: string; // ... other properties }
-
Create the component in
packages/ui/src/components/MyNewStep.tsx -
Add type guard in
packages/ui/src/types/schema.ts:export function isMyNewStep(step: Step): step is MyNewStep { return 'myNew' in step; }
-
Register in StepViewer (
packages/ui/src/components/StepViewer.tsx):if (isMyNewStep(step)) { return <MyNewStep step={step} />; }
-
Add CLI support if the step needs server-side execution
When reporting issues, please include:
- DemoScript version
- Node.js version
- Operating system
- Steps to reproduce
- Expected vs actual behavior
By contributing, you agree that your contributions will be licensed under the project's license.