Skip to content

Commit c9c2ed2

Browse files
authored
build: migrate to pnpm (#722)
* build: migrate to pnpm and upgrade to Node 22 * build: restore automated prod release workflow for v7 * chore: fix local development * fix: update e2e docker image to use pnpm * build: sync `pnpm-lock.yaml` with `i18next-cli` dep * build: bump pnpm to 10.33.1 * fix: wrap i18n `label` in JSX fragment to satisfy `JSX.Element` type
1 parent 7f5d5c0 commit c9c2ed2

17 files changed

Lines changed: 13455 additions & 10392 deletions

File tree

.github/workflows/cd.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CD
2+
run-name: Deploy main to dev,ops by @${{ github.actor }}
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: "write"
11+
id-token: "write"
12+
attestations: "write"
13+
pull-requests: "read"
14+
15+
jobs:
16+
CD:
17+
name: Deploy plugin
18+
uses: grafana/plugin-ci-workflows/.github/workflows/cd.yml@ci-cd-workflows/v7.0.0
19+
with:
20+
branch: ${{ github.event_name == 'push' && github.ref_name || github.ref }}
21+
environment: dev,ops
22+
attestation: true
23+
run-playwright: false
24+
grafana-cloud-deployment-type: provisioned
25+
auto-merge-environments: dev,ops
26+
argo-workflow-slack-channel: "#proj-tracesdrilldown-cd"
27+
plugin-version-suffix: ${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}

.github/workflows/ci.yml

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
name: Plugins - CI / CD
1+
name: CI
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
@@ -9,33 +10,13 @@ on:
910
permissions: {}
1011

1112
jobs:
12-
cd:
13-
name: CI / CD
14-
uses: grafana/plugin-ci-workflows/.github/workflows/cd.yml@ci-cd-workflows/v6.0.0
13+
CI:
1514
permissions:
1615
contents: write
1716
id-token: write
1817
attestations: write
19-
pull-requests: read
18+
uses: grafana/plugin-ci-workflows/.github/workflows/ci.yml@ci-cd-workflows/v7.0.0
2019
with:
21-
# Checkout/build PR or main branch, depending on event
22-
branch: ${{ github.event_name == 'push' && github.ref_name || github.ref }}
23-
24-
# When pushing to "main", publish and deploy to "dev" (CD). For PRs, skip publishing and deploying (run CI only)
25-
environment: ${{ (github.event_name == 'push' && github.ref_name == 'main') && 'dev,ops' || 'none' }}
26-
auto-merge-environments: dev,ops
27-
# Deploy provisioned plugin to Grafana Cloud
28-
grafana-cloud-deployment-type: provisioned
29-
argo-workflow-slack-channel: "#proj-tracesdrilldown-cd"
30-
31-
# Scope for the plugin published to the catalog. Setting this to "grafana_cloud" will make it visible only in Grafana Cloud
32-
# (and hide it for on-prem). This is required for some provisioned plugins.
33-
# scopes: grafana_cloud
34-
35-
# Add the git head ref sha to the plugin version as suffix (`+abcdef`). This is required for CD builds.
36-
plugin-version-suffix: ${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
37-
38-
# Playwright
3920
run-playwright: false
4021
run-playwright-docker: true
4122
upload-playwright-artifacts: true # IMPORTANT: we must ensure there are no unmasked secrets in the E2E tests
Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
11
name: Latest Grafana API compatibility check
22
on: [pull_request]
3+
permissions:
4+
contents: 'read'
5+
actions: 'write'
36

47
jobs:
58
compatibilitycheck:
69
runs-on: ubuntu-latest
710
steps:
8-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
11+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
912
with:
1013
persist-credentials: false
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
1116
- name: Setup Node.js environment
12-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
17+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
1318
with:
1419
node-version: '22'
15-
cache: 'yarn'
16-
17-
- name: Restore npm cache
18-
id: restore-npm-cache
19-
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
20-
with:
21-
path: |
22-
node_modules
23-
key: ${{ runner.os }}-npm-${{ hashFiles('**/yarn.lock', '!node_modules/**/yarn.lock') }}
24-
restore-keys: ${{ runner.os }}-npm-
25-
20+
cache: 'pnpm'
2621
- name: Install dependencies
27-
run: yarn install --frozen-lockfile
28-
29-
- name: Save npm cache
30-
id: save-npm-cache
31-
if: steps.restore-npm-cache.outputs.cache-hit != 'true'
32-
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
33-
with:
34-
path: |
35-
node_modules
36-
key: ${{ steps.restore-npm-cache.outputs.cache-primary-key }}
22+
run: pnpm install --frozen-lockfile
3723
- name: Build plugin
38-
run: npm run build
24+
run: pnpm run build
25+
- name: Find module.ts or module.tsx
26+
id: find-module-ts
27+
run: >-
28+
MODULETS="$(find ./src -type f \( -name "module.ts" -o -name
29+
"module.tsx" \))"
30+
31+
echo "modulets=${MODULETS}" >> $GITHUB_OUTPUT
3932
- name: Compatibility check
40-
run: npx @grafana/levitate@latest is-compatible --path src/module.tsx --target @grafana/data,@grafana/ui,@grafana/runtime
33+
uses: grafana/plugin-actions/is-compatible@4698961fa64137fcac207108397ebe8a738a33d1 # main
34+
with:
35+
module: ${{ steps.find-module-ts.outputs.modulets }}
36+
comment-pr: no
37+
fail-if-incompatible: yes
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
CD:
3434
name: Deploy plugin
3535
needs: bump-version
36-
uses: grafana/plugin-ci-workflows/.github/workflows/cd.yml@ci-cd-workflows/v6.0.0
36+
uses: grafana/plugin-ci-workflows/.github/workflows/cd.yml@ci-cd-workflows/v7.0.0
3737
permissions:
3838
contents: write
3939
id-token: write

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ yarn-error.log*
88

99
node_modules/
1010

11+
# yarn
12+
.yarn/cache
13+
.yarn/unplugged
14+
.yarn/build-state.yml
15+
.yarn/install-state.gz
16+
.pnp.*
17+
1118
# Runtime data
1219
pids
1320
*.pid
@@ -29,6 +36,9 @@ e2e-results/
2936
**/cypress/videos
3037
**/cypress/report.json
3138

39+
# AI workflow artifacts (Claude Code / superpowers)
40+
docs/superpowers/
41+
3242
# Editor
3343
.idea
3444

devenv/docker-compose.e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ services:
103103
CI: "true"
104104
depends_on:
105105
- grafana
106-
command: sh -c "yarn install --frozen-lockfile && sleep 30 && yarn e2e:fast"
106+
command: sh -c "corepack enable && pnpm install --frozen-lockfile && sleep 30 && pnpm e2e:fast"

devenv/docker-compose.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,26 @@ services:
66
build:
77
context: ../.config
88
args:
9-
grafana_image: ${GRAFANA_IMAGE:-grafana-dev}
9+
grafana_image: ${GRAFANA_IMAGE:-grafana}
1010
grafana_version: ${GRAFANA_VERSION:-12.3.0}
1111
environment:
1212
- GF_FEATURE_TOGGLES_ENABLE=${GF_FEATURE_TOGGLES_ENABLE:-localizationForPlugins}
1313
ports:
1414
- 3000:3000/tcp
1515
volumes:
16-
- ../dist:/var/lib/grafana/plugins/grafana-explore-traces
16+
- ../dist:/var/lib/grafana/plugins/grafana-exploretraces-app
1717
- ../provisioning:/etc/grafana/provisioning
18+
- ./grafana.ini:/etc/grafana/grafana.ini
1819
extra_hosts:
19-
- "host.docker.internal:host-gateway"
20+
- 'host.docker.internal:host-gateway'
2021

2122
tempo:
22-
image: grafana/tempo:latest@sha256:112d818cc82ad33052e42868fc7b2557f5962eaa5ba35d19878402675479e09d
23-
command: [ "-config.file=/etc/tempo.yaml" ]
23+
image: grafana/tempo:2.10.4@sha256:a6616c9d224770c883a67b50e4941e99c5df81b076ef05f516bb7cce5a96cec0
24+
command: ['-config.file=/etc/tempo.yaml']
2425
volumes:
2526
- ./tempo.yaml:/etc/tempo.yaml
2627
ports:
27-
- "3200:3200" # tempo
28+
- '3200:3200' # tempo
2829

2930
# generates uninteresting traces, but is useful for testing
3031
k6-tracing:
@@ -46,8 +47,8 @@ services:
4647
image: rabbitmq:management@sha256:23fe4f224d3d4d4e3c3904e82fb8a47824f0ee03412c33b7b21e6bf00b9852fa
4748
restart: always
4849
ports:
49-
- "5672:5672"
50-
- "15672:15672"
50+
- '5672:5672'
51+
- '15672:15672'
5152
healthcheck:
5253
test: rabbitmq-diagnostics check_running
5354
interval: 5s
@@ -59,9 +60,9 @@ services:
5960
image: postgres:14.5@sha256:135c62a8134dcef829a1e4f5568bfae44bcfa2c75659ff948f43c71964366aa4
6061
restart: always
6162
environment:
62-
POSTGRES_PASSWORD: "mythical"
63+
POSTGRES_PASSWORD: 'mythical'
6364
ports:
64-
- "5432:5432"
65+
- '5432:5432'
6566

6667
# A microservice that makes requests to the API server microservice. Requests are also pushed onto the mythical-queue.
6768
mythical-requester-A:
@@ -93,7 +94,7 @@ services:
9394
- OTEL_EXPORTER_OTLP_TRACES_INSECURE=true
9495
- OTEL_RESOURCE_ATTRIBUTES=ip=1.2.3.5,region=eu-east
9596

96-
# A microservice that makes requests to the API server microservice. Requests are also pushed onto the mythical-queue.
97+
# A microservice that makes requests to the API server microservice. Requests are also pushed onto the mythical-queue.
9798
mythical-requester-B:
9899
image: grafana/intro-to-mltp:mythical-beasts-requester-0.3.1@sha256:2643fb2e2cd1100e9edecb44d67c82cfa436ea97ff23aeeb646ea063776e539b
99100
restart: always

devenv/grafana.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[feature_toggles]
2+
# Disable auto-updating of preinstalled plugins so the stable `grafana` image
3+
# doesn't wipe our bind-mounted ../dist trying to "update" grafana-exploretraces-app
4+
# from the catalog. Other preinstalled plugins (loki, pyroscope, metricsdrilldown)
5+
# still install on first boot.
6+
preinstallAutoUpdate = false

devenv/tempo.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ storage:
3232
backend: local # backend configuration to use
3333
block:
3434
bloom_filter_false_positive: .05 # bloom filter false positive rate. lower values create larger filters but fewer false positives
35-
v2_index_downsample_bytes: 1000 # number of bytes per index record
36-
v2_encoding: zstd # block encoding/compression. options: none, gzip, lz4-64k, lz4-256k, lz4-1M, lz4, snappy, zstd, s2
3735
wal:
3836
path: /tmp/tempo/wal # where to store the wal locally
39-
v2_encoding: snappy # wal encoding/compression. options: none, gzip, lz4-64k, lz4-256k, lz4-1M, lz4, snappy, zstd, s2
4037
local:
4138
path: /tmp/tempo/blocks
4239

package.json

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
"test:ci": "jest --passWithNoTests --maxWorkers 4",
1717
"typecheck": "tsc --noEmit",
1818
"lint": "eslint --cache .",
19-
"lint:fix": "yarn run lint --fix && prettier --write --list-different .",
19+
"lint:fix": "pnpm run lint --fix && prettier --write --list-different .",
2020
"server": "docker compose -f ./devenv/docker-compose.yaml up --build -d",
2121
"server:ci": "docker compose -f ./devenv/docker-compose.e2e.yaml up --build -d",
2222
"server:ci:down": "docker compose -f ./devenv/docker-compose.e2e.yaml down",
2323
"server:react19": "GRAFANA_VERSION=dev-preview-react19 GRAFANA_IMAGE=grafana-enterprise GF_FEATURE_TOGGLES_ENABLE=react19 docker compose -f ./devenv/docker-compose.yaml up --build",
24-
"start": "yarn install && yarn dev",
25-
"sign": "npx --yes @grafana/sign-plugin@latest"
24+
"start": "pnpm install && pnpm dev",
25+
"sign": "pnpm dlx @grafana/sign-plugin@latest"
2626
},
2727
"author": "Grafana",
2828
"license": "AGPL-3.0-only",
@@ -47,6 +47,8 @@
4747
"@types/jest": "29.5.14",
4848
"@types/lodash": "4.17.24",
4949
"@types/node": "22.19.15",
50+
"@types/react": "^18.3.28",
51+
"@types/react-dom": "^18.3.7",
5052
"@types/semver": "7.7.1",
5153
"@types/testing-library__jest-dom": "5.14.9",
5254
"@typescript-eslint/eslint-plugin": "8.57.2",
@@ -101,31 +103,43 @@
101103
"@openfeature/ofrep-web-provider": "^0.3.5",
102104
"@openfeature/react-sdk": "^1.2.0",
103105
"@openfeature/web-sdk": "^1.7.2",
106+
"@react-aria/dialog": "^3.6.0",
107+
"@react-aria/overlays": "^3.32.0",
104108
"@testing-library/dom": "^10.4.0",
109+
"moment": "^2.30.1",
110+
"rc-drawer": "^7.3.0",
105111
"react": "^18.3.1",
106112
"react-dom": "^18.3.1",
113+
"react-inlinesvg": "^4.3.0",
107114
"react-loading-skeleton": "^3.5.0",
108115
"react-router-dom": "^6.30.2",
116+
"react-select": "^5.10.2",
109117
"react-use": "^17.6.0",
110-
"rxjs": "7.8.2"
118+
"rxjs": "7.8.2",
119+
"uplot": "^1.6.32",
120+
"uuid": "^13.0.0"
111121
},
112-
"resolutions": {
113-
"nwsapi": "2.2.23",
114-
"@tootallnate/once": ">=3.0.1",
115-
"schema-utils/ajv": "8.18.0",
116-
"rxjs": "^7.8.1",
117-
"js-yaml": "4.1.1",
118-
"@remix-run/router": "1.23.2",
119-
"lodash": "4.18.1",
120-
"react-router": "6.30.3",
121-
"rtl-css-js": "1.16.1",
122-
"serialize-javascript": "7.0.5",
123-
"flatted": "3.4.2",
124-
"immutable": "5.1.5",
125-
"dompurify": "3.4.0",
126-
"diff": "4.0.4",
127-
"picomatch": ">=2.3.2",
128-
"yaml": ">=2.8.3"
122+
"pnpm": {
123+
"overrides": {
124+
"@remix-run/router": "^1.23.2",
125+
"lodash": "^4.18.0",
126+
"react-router": "^6.30.2",
127+
"serialize-javascript": "^7.0.5",
128+
"flatted": "^3.4.0",
129+
"immutable": "^5.1.5",
130+
"dompurify": "^3.4.0",
131+
"picomatch@^2": "~2.3.2",
132+
"picomatch@^4": "^4.0.4",
133+
"yaml": "^2.8.3",
134+
"minimatch@^3": "~3.1.4",
135+
"minimatch@^9": "~10.2.0",
136+
"minimatch@^10": "^10.2.3",
137+
"undici": "^7.24.0",
138+
"brace-expansion@^1": "^1.1.13",
139+
"brace-expansion@^5": "^5.0.5",
140+
"@types/react": "^18.3.28",
141+
"@types/react-dom": "^18.3.7"
142+
}
129143
},
130-
"packageManager": "yarn@1.22.22"
144+
"packageManager": "pnpm@10.33.1+sha512.05ba3c1d5d1c18f68df06470d74055e62d41fc110a0c660db1b2dfb2785327f04cf0f68345d4609bc52089e7fa0343c31593b2f9594e2c5d5da426230acc9820"
131145
}

0 commit comments

Comments
 (0)