@grafana/create-plugin 4.7.0 → 4.7.1-canary.890.5d6b0d7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTING.md CHANGED
@@ -21,7 +21,9 @@ npm install
21
21
 
22
22
  ### Technologies
23
23
 
24
- - [**`Plop`**](https://github.com/plopjs/plop) - we are using Plop for the CLI tool and for scaffolding
24
+ - [**`minimist`**](https://www.npmjs.com/package/minimist) - for parsing cmd line args
25
+ - [**`enquirer`**](https://www.npmjs.com/package/enquirer) - for prompting users for information
26
+ - [**`handlebars`**](https://www.npmjs.com/package/handlebars) - for file templates
25
27
 
26
28
  ### Folder structure
27
29
 
@@ -32,7 +34,7 @@ npm install
32
34
  │ ├── bin // the entrypoint file
33
35
  │ ├── commands // Code that runs commands
34
36
  │ └── utils // Utilities used by commands
35
- └── templates // Plop templates
37
+ └── templates // Handlebars templates
36
38
  ├── _partials // Composable parts of a template
37
39
  ├── app // Templates specific to scaffolding an app plugin
38
40
  ├── backend // Templates specific to scaffolding backend plugin code
@@ -76,6 +78,6 @@ _Work in progress._
76
78
 
77
79
  ### Developing the templates
78
80
 
79
- The templates are used by Plop to scaffold Grafana plugins. Whilst they appear to be the intended filetype they are infact treated as markdown by Plop when it runs. As such we need to be mindful of syntax and to [escape particular characters](https://handlebarsjs.com/guide/expressions.html#whitespace-control) where necessary. The [github/ci.yml](./templates/github/ci/.github/workflows/ci.yml) file is a good example of this.
81
+ The templates are used by Handlebars to scaffold Grafana plugins. Whilst they appear to be the intended filetype they are infact treated as markdown by Handlebars when it runs. As such we need to be mindful of syntax and to [escape particular characters](https://handlebarsjs.com/guide/expressions.html#whitespace-control) where necessary. The [github/ci.yml](./templates/github/ci/.github/workflows/ci.yml) file is a good example of this.
80
82
 
81
83
  Note that certain files are intentionally named differently (e.g. npmrc, package.json). This is done due to other tooling preventing the files from being packaged for NPM or breaking other tools during local development.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "4.7.0",
3
+ "version": "4.7.1-canary.890.5d6b0d7.0",
4
4
  "repository": {
5
5
  "directory": "packages/create-plugin",
6
6
  "url": "https://github.com/grafana/plugin-tools"
@@ -87,5 +87,5 @@
87
87
  "engines": {
88
88
  "node": ">=20"
89
89
  },
90
- "gitHead": "b18692d9bdc211888da99627436f58b1229d88ad"
90
+ "gitHead": "5d6b0d7333e7d79945ae1b0b6bbed281436dd985"
91
91
  }
package/src/constants.ts CHANGED
@@ -39,7 +39,7 @@ export enum PLUGIN_TYPES {
39
39
  scenes = 'scenesapp',
40
40
  }
41
41
 
42
- // This gets merged into variables coming from user prompts (when using Plop) or any other dynamic variables,
42
+ // This gets merged into variables coming from user prompts (when scaffolding) or any other dynamic variables,
43
43
  // and will be available to use in the templates.
44
44
  // Example: "@grafana/ui": "{{ grafanaVersion }}"
45
45
  export const EXTRA_TEMPLATE_VARIABLES = {
@@ -11,6 +11,7 @@ services:
11
11
  args:
12
12
  grafana_image: ${GRAFANA_IMAGE:-{{~grafanaImage~}} }
13
13
  grafana_version: ${GRAFANA_VERSION:-{{~grafanaVersion~}} }
14
+ development: ${DEVELOPMENT:-true}
14
15
  ports:
15
16
  - 3000:3000/tcp
16
17
  {{#if hasBackend}}
@@ -11,7 +11,11 @@ on:
11
11
  - master
12
12
  - main
13
13
 
14
- permissions: read-all
14
+ permissions:
15
+ contents: read
16
+ {{#if_eq orgName "grafana"}}
17
+ id-token: write
18
+ {{/if_eq}}
15
19
 
16
20
  jobs:
17
21
  build:
@@ -141,11 +145,6 @@ jobs:
141
145
  runs-on: ubuntu-latest
142
146
  steps:
143
147
  - uses: actions/checkout@v4
144
- with:
145
- sparse-checkout: |
146
- provisioning
147
- tests
148
- .config
149
148
 
150
149
  - name: Download plugin
151
150
  if: needs.build.outputs.has-backend == 'true'
@@ -176,7 +175,7 @@ jobs:
176
175
  - name: Start Grafana
177
176
  run: |
178
177
  docker-compose pull
179
- GRAFANA_VERSION=$\{{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=$\{{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
178
+ DEVELOPMENT=false GRAFANA_VERSION=$\{{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=$\{{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
180
179
 
181
180
  - name: Wait for Grafana to start
182
181
  uses: nev7n/wait_for_response@v1
@@ -187,7 +186,7 @@ jobs:
187
186
  interval: 500
188
187
 
189
188
  - name: Install Playwright Browsers
190
- run: npx playwright install chromium --with-deps
189
+ run: {{ packageManagerName }} exec playwright install chromium --with-deps
191
190
 
192
191
  - name: Run Playwright tests
193
192
  id: run-tests
@@ -208,7 +207,7 @@ jobs:
208
207
  name: $\{{ matrix.GRAFANA_IMAGE.NAME }}-v$\{{ matrix.GRAFANA_IMAGE.VERSION }}-$\{{github.run_id}}-server-log
209
208
  path: grafana-server.log
210
209
  retention-days: 5
211
-
210
+
212
211
  # If your repository is public, uploading the Playwright report will make it public on the Internet.
213
212
  # Beware not to expose sensitive information.
214
213
  - name: Upload artifacts
@@ -218,3 +217,14 @@ jobs:
218
217
  name: playwright-report-$\{{ matrix.GRAFANA_IMAGE.NAME }}-v$\{{ matrix.GRAFANA_IMAGE.VERSION }}-$\{{github.run_id}}
219
218
  path: playwright-report/
220
219
  retention-days: 5
220
+
221
+ {{#if_eq orgName "grafana"}}
222
+ # Repos in the grafana Github org can publish the report to GCS so that they can be browsed without having to download them.
223
+ # This will make the report public on the Internet, so beware to skip this step if the report contains sensitive information.
224
+ - name: Publish report to GCS
225
+ if: $\{{ always() && steps.run-tests.outcome == 'failure' }}
226
+ uses: grafana/plugin-actions/publish-report@main
227
+ with:
228
+ grafana-version: ${{ matrix.GRAFANA_IMAGE.VERSION }}
229
+ path: playwright-report
230
+ {{/if_eq}}