UNPKG

@oriolrius/grafana-business-text

Version:

Data-driven text with Markdown and Handlebars support for Grafana

129 lines (99 loc) • 3.42 kB
# 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