@oriolrius/grafana-business-text
Version:
Data-driven text with Markdown and Handlebars support for Grafana
129 lines (99 loc) ⢠3.42 kB
Markdown
# Development Guide
## Project Structure
```txt
business-text/
āāā š .config/ # Grafana scaffolded configuration
ā āāā webpack/ # Webpack build configuration
ā āāā jest/ # Jest test configuration
ā āāā types/ # TypeScript definitions
āāā š .github/ # GitHub workflows and CI/CD
āāā š backend/ # Go backend components
ā āāā go.mod # Go module definition
ā āāā go.sum # Go dependencies lockfile
ā āāā magefile.go # Mage build tool
ā āāā pkg/ # Go packages
āāā š docs/ # Documentation
ā āāā BACKEND.md # Backend-specific documentation
āāā š docker/ # Docker configuration
āāā š scripts/ # Build and utility scripts
āāā š src/ # Frontend source code
ā āāā components/ # React components
ā āāā types/ # TypeScript type definitions
ā āāā utils/ # Utility functions
ā āāā hooks/ # React hooks
ā āāā constants/ # Application constants
ā āāā __mocks__/ # Jest mocks
ā āāā module.ts # Main plugin module
ā āāā plugin.json # Plugin metadata
āāā š static/ # Static assets
āāā š test/ # E2E tests (Playwright)
āāā š CHANGELOG.md # Version history
āāā š LICENSE # License file
āāā š README.md # Main documentation
āāā š package.json # Node.js dependencies
āāā š tsconfig.json # TypeScript configuration
āāā š webpack.config.ts # Webpack build configuration
```
## Development Commands
### Setup
```bash
# Install dependencies
npm install
# Install Go dependencies (for backend)
go mod download
```
### Development
```bash
# Start frontend development server
npm run dev
# Start backend development server
npm run dev:backend
# Start both frontend and backend
npm run dev:full
```
### Building
```bash
# Build frontend
npm run build
# Build backend
npm run build:backend
# Build both (using script)
./scripts/build.sh
```
### Testing
```bash
# Run unit tests
npm test
# Run unit tests with coverage
npm run test:ci
# Run E2E tests
npm run test:e2e
# Run E2E tests in UI mode
npm run test:e2e:dev
```
### Code Quality
```bash
# Lint code
npm run lint
# Fix linting issues
npm run lint:fix
# Check TypeScript types
npm run typecheck
```
## Development Workflow
1. **Frontend Development**: Edit files in `src/` directory
2. **Backend Development**: Edit files in `backend/` directory
3. **Testing**: Write unit tests alongside source files, E2E tests in `test/`
4. **Documentation**: Update `docs/` for backend, `README.md` for general docs
5. **Configuration**: Modify `.config/` files for build settings
## Key Files
- `src/module.ts` - Main plugin entry point
- `src/plugin.json` - Plugin metadata and configuration
- `backend/pkg/main.go` - Backend entry point
- `webpack.config.ts` - Custom webpack configuration
- `playwright.config.ts` - E2E test configuration
## Notes
- Unit tests are co-located with source files
- E2E tests are in the `test/` directory
- Configuration follows Grafana plugin conventions
- Backend is optional and can be disabled