Skip to content

Commit 87b1047

Browse files
jordangarsideclaude
andcommitted
[config][infra] add grafana-react monorepo integration
__Changes__ - Add GitHub workflow for syncing grafana-react to public repo - Add moon.yml with build, test, lint, and CLI tasks - Register grafana-react and dashboards project in moon workspace - Add dashboards project to pnpm workspace - Add notes documenting OSS sync workflow and schema alignment __Why__ - Enables automatic sync of oss/grafana-react/pkg to kiwi-research/grafana-react - Provides moon tasks for building dashboards within the monorepo Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7e8ba83 commit 87b1047

File tree

91 files changed

+9710
-5548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+9710
-5548
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup pnpm
1717
uses: pnpm/action-setup@v4
1818
with:
19-
version: 9
19+
version: 10
2020

2121
- name: Setup Node.js
2222
uses: actions/setup-node@v4
@@ -28,8 +28,14 @@ jobs:
2828
- name: Install dependencies
2929
run: pnpm install --frozen-lockfile
3030

31+
- name: Check formatting
32+
run: pnpm format:check
33+
34+
- name: Lint
35+
run: pnpm lint
36+
3137
- name: Type check
32-
run: pnpm exec tsc --noEmit
38+
run: pnpm typecheck
3339

3440
- name: Build
3541
run: pnpm build

.github/workflows/npm-publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '22'
21+
registry-url: 'https://registry.npmjs.org'
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: 9
27+
28+
- name: Install dependencies
29+
run: pnpm install --frozen-lockfile
30+
31+
- name: Build
32+
run: pnpm run build
33+
34+
- name: Publish
35+
run: npm publish --provenance --access public

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Build outputs
2+
build/
3+
docs/dist/
4+
5+
# Dependencies
6+
node_modules/
7+
8+
# Astro
9+
docs/.astro/
10+
11+
# Generated docs (from source JSDoc)
12+
docs/src/content/docs/components/_generated/

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Prettier respects .gitignore by default
2+
# This file only needs entries for things to ignore from prettier but keep in git
3+
4+
# Lock files (committed for CI, but don't format)
5+
pnpm-lock.yaml

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.0.1] - 2026-01-09
11+
12+
### Added
13+
14+
- Initial release
15+
- Core components: `Dashboard`, `Row`, `Variable`, `Annotation`, `Link`, `Query`, `Override`
16+
- Panel components:
17+
- Core: `Stat`, `Timeseries`, `Table`, `BarGauge`, `Heatmap`, `Gauge`, `Text`
18+
- Charts: `BarChart`, `PieChart`, `Histogram`, `StateTimeline`, `StatusHistory`, `Candlestick`, `Trend`, `XYChart`
19+
- Data display: `Logs`, `Datagrid`
20+
- Specialized: `NodeGraph`, `Traces`, `FlameGraph`, `Canvas`, `Geomap`
21+
- Widgets: `DashboardList`, `AlertList`, `AnnotationsList`, `News`
22+
- Plugins: `PluginPanel`, `BusinessVariablePanel`
23+
- CLI with `build`, `build-all`, `validate`, and `watch` commands
24+
- `render()` and `renderToString()` functions for programmatic use
25+
- Full TypeScript support with comprehensive type exports
26+
- Automatic panel positioning with row wrapping
27+
- Threshold normalization (object syntax: `{ 70: 'yellow', 90: 'red' }`)
28+
- Legend configuration (string shorthand or object)
29+
- Tooltip configuration
30+
- Row padding support
31+
32+
[Unreleased]: https://github.com/kiwi-research/grafana-react/compare/v0.0.1...HEAD
33+
[0.0.1]: https://github.com/kiwi-research/grafana-react/releases/tag/v0.0.1

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
React-based DSL for creating Grafana dashboards. Write dashboards as JSX components and compile them to Grafana JSON.
44

5+
<p align="center">
6+
<img src="docs/public/img/hero-code.svg" alt="JSX code for Stat panel" height="180" />
7+
&nbsp;&nbsp;&nbsp;
8+
<img src="docs/public/img/hero-grafana-stat-panel.png" alt="Rendered Grafana Stat panel" height="140" />
9+
</p>
10+
511
## Features
612

713
- **Declarative JSX Syntax** - Write dashboards using familiar React patterns
@@ -46,10 +52,20 @@ export default function MyDashboard() {
4652
}
4753
```
4854

49-
Build to JSON:
55+
Build to JSON using the CLI:
5056

5157
```bash
52-
grafana-react build my-dashboard.dashboard.tsx output/my-dashboard.json
58+
grafana-react build my-dashboard.tsx output/my-dashboard.json
59+
```
60+
61+
Or programmatically with `renderToString`:
62+
63+
```ts
64+
import React from 'react';
65+
import { renderToString } from 'grafana-react';
66+
67+
// Use the JSON string directly, e.g. add as a ConfigMap with Pulumi
68+
const json = renderToString(React.createElement(MyDashboard));
5369
```
5470

5571
## Documentation

docs/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/astro.config.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default defineConfig({
77
integrations: [
88
starlight({
99
title: 'grafana-react',
10+
customCss: ['./src/styles/custom.css'],
1011
description: 'React DSL for Grafana dashboards',
1112
social: [
1213
{
@@ -31,11 +32,17 @@ export default defineConfig({
3132
{
3233
label: 'Components',
3334
items: [
34-
{ label: 'Structure', link: '/components/structure/' },
35-
{ label: 'Query', link: '/components/query/' },
35+
{
36+
label: 'Structure',
37+
autogenerate: { directory: 'components/_generated/structure' },
38+
},
39+
{
40+
label: 'Query',
41+
autogenerate: { directory: 'components/_generated/query' },
42+
},
3643
{
3744
label: 'Panels',
38-
autogenerate: { directory: 'components/panels' },
45+
autogenerate: { directory: 'components/_generated/panels' },
3946
},
4047
],
4148
},

docs/package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33
"type": "module",
44
"private": true,
55
"scripts": {
6-
"dev": "astro dev",
7-
"start": "astro dev",
8-
"build": "astro build",
9-
"preview": "astro preview"
6+
"generate": "tsx scripts/generate-docs.ts",
7+
"dev": "npm run generate && astro dev",
8+
"start": "npm run generate && astro dev",
9+
"build": "npm run generate && astro build",
10+
"preview": "astro preview",
11+
"typecheck": "astro check"
1012
},
1113
"dependencies": {
1214
"@astrojs/starlight": "^0.37.2",
1315
"astro": "^5.16.7",
1416
"sharp": "^0.34.5"
17+
},
18+
"devDependencies": {
19+
"@astrojs/check": "^0.9.6",
20+
"ts-morph": "^24.0.0",
21+
"tsx": "^4.21.0",
22+
"typescript": "^5.7.2"
1523
}
1624
}

0 commit comments

Comments
 (0)