@grafana/create-plugin 4.0.0-canary.707.f3e53b0.0 → 4.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,72 @@
1
+ # v4.0.0 (Wed Feb 14 2024)
2
+
3
+ #### 💥 Breaking Change
4
+
5
+ - Create-plugin: Change how the `update` command works [#707](https://github.com/grafana/plugin-tools/pull/707) ([@leventebalogh](https://github.com/leventebalogh))
6
+
7
+ #### Authors: 1
8
+
9
+ - Levente Balogh ([@leventebalogh](https://github.com/leventebalogh))
10
+
11
+ ---
12
+
13
+ # v3.6.0 (Thu Feb 08 2024)
14
+
15
+ #### 🚀 Enhancement
16
+
17
+ - Create Plugin: Run prettier on .config after update [#722](https://github.com/grafana/plugin-tools/pull/722) ([@oshirohugo](https://github.com/oshirohugo))
18
+
19
+ #### Authors: 1
20
+
21
+ - Hugo Kiyodi Oshiro ([@oshirohugo](https://github.com/oshirohugo))
22
+
23
+ ---
24
+
25
+ # v3.5.0 (Fri Feb 02 2024)
26
+
27
+ #### 🚀 Enhancement
28
+
29
+ - Create-plugin: Use react-router v6 by default [#710](https://github.com/grafana/plugin-tools/pull/710) ([@leventebalogh](https://github.com/leventebalogh))
30
+
31
+ #### Authors: 1
32
+
33
+ - Levente Balogh ([@leventebalogh](https://github.com/leventebalogh))
34
+
35
+ ---
36
+
37
+ # v3.4.0 (Fri Feb 02 2024)
38
+
39
+ :tada: This release contains work from a new contributor! :tada:
40
+
41
+ Thank you, Nicolas Ventura ([@6nv](https://github.com/6nv)), for all your work!
42
+
43
+ #### 🚀 Enhancement
44
+
45
+ - Update create-plugin workflow action versions [#711](https://github.com/grafana/plugin-tools/pull/711) ([@6nv](https://github.com/6nv))
46
+
47
+ #### 🐛 Bug Fix
48
+
49
+ - Fix broken livereload injection when using Grafana 10.2.3 [#696](https://github.com/grafana/plugin-tools/pull/696) ([@samjewell](https://github.com/samjewell))
50
+
51
+ #### Authors: 2
52
+
53
+ - Nicolas Ventura ([@6nv](https://github.com/6nv))
54
+ - Sam Jewell ([@samjewell](https://github.com/samjewell))
55
+
56
+ ---
57
+
58
+ # v3.3.0 (Fri Feb 02 2024)
59
+
60
+ #### 🚀 Enhancement
61
+
62
+ - Create-plugin: Check if inside a plugin directory [#706](https://github.com/grafana/plugin-tools/pull/706) ([@leventebalogh](https://github.com/leventebalogh))
63
+
64
+ #### Authors: 1
65
+
66
+ - Levente Balogh ([@leventebalogh](https://github.com/leventebalogh))
67
+
68
+ ---
69
+
1
70
  # v3.2.0 (Thu Feb 01 2024)
2
71
 
3
72
  #### 🚀 Enhancement
@@ -11,7 +11,7 @@ import { getPackageManagerFromUserAgent, getPackageManagerInstallCmd } from '../
11
11
  import { getExportPath } from '../utils/utils.path.js';
12
12
  import { renderTemplateFromFile } from '../utils/utils.templates.js';
13
13
  import { getVersion } from '../utils/utils.version.js';
14
- import { prettifyFiles } from './generate/prettify-files.js';
14
+ import { prettifyFiles } from '../utils/utils.prettifyFiles.js';
15
15
  import { printGenerateSuccessMessage } from './generate/print-success-message.js';
16
16
  import { promptUser } from './generate/prompt-user.js';
17
17
  import { updateGoSdkAndModules } from './generate/update-go-sdk-and-packages.js';
@@ -36,7 +36,7 @@ export const generate = async (argv) => {
36
36
  if (answers.hasBackend) {
37
37
  await execPostScaffoldFunction(updateGoSdkAndModules, exportPath);
38
38
  }
39
- await execPostScaffoldFunction(prettifyFiles, exportPath);
39
+ await execPostScaffoldFunction(prettifyFiles, { targetPath: exportPath });
40
40
  printGenerateSuccessMessage(answers);
41
41
  };
42
42
  function getTemplateData(answers) {
@@ -47,6 +47,7 @@ function getTemplateData(answers) {
47
47
  const { packageManagerName, packageManagerVersion } = getPackageManagerFromUserAgent();
48
48
  const packageManagerInstallCmd = getPackageManagerInstallCmd(packageManagerName);
49
49
  const isAppType = pluginType === PLUGIN_TYPES.app || pluginType === PLUGIN_TYPES.scenes;
50
+ const useReactRouterV6 = features.useReactRouterV6 && pluginType === PLUGIN_TYPES.app;
50
51
  const templateData = {
51
52
  ...answers,
52
53
  pluginId,
@@ -57,6 +58,8 @@ function getTemplateData(answers) {
57
58
  isNPM: packageManagerName === 'npm',
58
59
  version: currentVersion,
59
60
  bundleGrafanaUI: features.bundleGrafanaUI,
61
+ useReactRouterV6,
62
+ reactRouterVersion: useReactRouterV6 ? '6.22.0' : '5.2.0',
60
63
  };
61
64
  return templateData;
62
65
  }
@@ -33,7 +33,7 @@ In case you want to proceed as is please use the ${chalk.bold('--force')} flag.)
33
33
  });
34
34
  process.exit(1);
35
35
  }
36
- updateDotConfigFolder();
36
+ await updateDotConfigFolder();
37
37
  updateNpmScripts();
38
38
  updatePackageJson({
39
39
  onlyOutdated: true,
@@ -51,6 +51,7 @@ function readRCFileSync(path) {
51
51
  }
52
52
  function createFeatureFlags(flags) {
53
53
  return {
54
+ useReactRouterV6: true,
54
55
  bundleGrafanaUI: false,
55
56
  ...flags,
56
57
  };
@@ -3,8 +3,8 @@ import { TEMPLATE_PATHS } from '../constants.js';
3
3
  import { readJsonFile } from './utils.files.js';
4
4
  import { getTemplateData, renderTemplateFromFile } from './utils.templates.js';
5
5
  import fs from 'node:fs';
6
- export function getPackageJson() {
7
- return readJsonFile(path.join(process.cwd(), 'package.json'));
6
+ export function getPackageJson(rootPath = process.cwd()) {
7
+ return readJsonFile(path.join(rootPath, 'package.json'));
8
8
  }
9
9
  export function getLatestPackageJson() {
10
10
  const packageJsonPath = path.join(TEMPLATE_PATHS.common, '_package.json');
@@ -2,6 +2,7 @@ import path from 'node:path';
2
2
  import { readJsonFile } from './utils.files.js';
3
3
  import { compileTemplateFiles, getTemplateData } from './utils.templates.js';
4
4
  import { UDPATE_CONFIG } from '../constants.js';
5
+ import { prettifyFiles } from './utils.prettifyFiles.js';
5
6
  export function getPluginJson(srcDir) {
6
7
  const srcPath = srcDir || path.join(process.cwd(), 'src');
7
8
  const pluginJsonPath = path.join(srcPath, 'plugin.json');
@@ -16,6 +17,7 @@ export function isPluginDirectory() {
16
17
  return false;
17
18
  }
18
19
  }
19
- export function updateDotConfigFolder() {
20
+ export async function updateDotConfigFolder() {
20
21
  compileTemplateFiles(UDPATE_CONFIG.filesToOverride, getTemplateData());
22
+ await prettifyFiles({ targetPath: '.config', projectRoot: '.' });
21
23
  }
@@ -0,0 +1,31 @@
1
+ import { exec as nodeExec } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+ import fs from 'node:fs';
4
+ import { getPackageJson } from './utils.packagejson.js';
5
+ const exec = promisify(nodeExec);
6
+ export async function prettifyFiles(options) {
7
+ const targetPath = options.targetPath ?? process.cwd();
8
+ const projectRoot = options.projectRoot ?? targetPath;
9
+ if (!isPrettierUsed(projectRoot)) {
10
+ return 'Prettify skipped, because it is not used in this project.';
11
+ }
12
+ if (!fs.existsSync(targetPath)) {
13
+ return '';
14
+ }
15
+ const prettierVersion = getPrettierVersion(projectRoot);
16
+ try {
17
+ let command = `npx -y prettier@${prettierVersion} . --write`;
18
+ await exec(command, { cwd: targetPath });
19
+ }
20
+ catch (error) {
21
+ throw new Error('There was a problem running prettier on the plugin files. Please run `npx -y prettier@2 . --write` manually in your plugin directory.');
22
+ }
23
+ return 'Successfully ran prettier against new plugin.';
24
+ }
25
+ function isPrettierUsed(projectRoot) {
26
+ return Boolean(getPrettierVersion(projectRoot));
27
+ }
28
+ function getPrettierVersion(projectRoot) {
29
+ const packageJson = getPackageJson(projectRoot);
30
+ return packageJson.devDependencies?.prettier || packageJson.dependencies?.prettier;
31
+ }
@@ -5,7 +5,7 @@ import mkdirp from 'mkdirp';
5
5
  import { filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
6
6
  import { renderHandlebarsTemplate } from './utils.handlebars.js';
7
7
  import { getPluginJson } from './utils.plugin.js';
8
- import { TEMPLATE_PATHS, EXPORT_PATH_PREFIX, EXTRA_TEMPLATE_VARIABLES } from '../constants.js';
8
+ import { TEMPLATE_PATHS, EXPORT_PATH_PREFIX, EXTRA_TEMPLATE_VARIABLES, PLUGIN_TYPES } from '../constants.js';
9
9
  import { getPackageManagerWithFallback } from './utils.packageManager.js';
10
10
  import { getExportFileName } from '../utils/utils.files.js';
11
11
  import { getVersion } from './utils.version.js';
@@ -69,5 +69,7 @@ export function getTemplateData() {
69
69
  packageManagerVersion,
70
70
  version: currentVersion,
71
71
  bundleGrafanaUI: features.bundleGrafanaUI,
72
+ useReactRouterV6: features.useReactRouterV6 && pluginJson.type === PLUGIN_TYPES.app,
73
+ reactRouterVersion: features.useReactRouterV6 ? '6.22.0' : '5.2.0',
72
74
  };
73
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "4.0.0-canary.707.f3e53b0.0",
3
+ "version": "4.0.0",
4
4
  "repository": {
5
5
  "directory": "packages/create-plugin",
6
6
  "url": "https://github.com/grafana/plugin-tools"
@@ -86,5 +86,5 @@
86
86
  "engines": {
87
87
  "node": ">=20"
88
88
  },
89
- "gitHead": "f3e53b064d64f6368a99236625090c00915080b8"
89
+ "gitHead": "92324b2132998a4d239118a61147fe4eecabd7bc"
90
90
  }
@@ -12,7 +12,7 @@ import { getPackageManagerFromUserAgent, getPackageManagerInstallCmd } from '../
12
12
  import { getExportPath } from '../utils/utils.path.js';
13
13
  import { renderTemplateFromFile } from '../utils/utils.templates.js';
14
14
  import { getVersion } from '../utils/utils.version.js';
15
- import { prettifyFiles } from './generate/prettify-files.js';
15
+ import { prettifyFiles } from '../utils/utils.prettifyFiles.js';
16
16
  import { printGenerateSuccessMessage } from './generate/print-success-message.js';
17
17
  import { promptUser } from './generate/prompt-user.js';
18
18
  import { updateGoSdkAndModules } from './generate/update-go-sdk-and-packages.js';
@@ -45,7 +45,7 @@ export const generate = async (argv: minimist.ParsedArgs) => {
45
45
  if (answers.hasBackend) {
46
46
  await execPostScaffoldFunction(updateGoSdkAndModules, exportPath);
47
47
  }
48
- await execPostScaffoldFunction(prettifyFiles, exportPath);
48
+ await execPostScaffoldFunction(prettifyFiles, { targetPath: exportPath });
49
49
 
50
50
  printGenerateSuccessMessage(answers);
51
51
  };
@@ -59,6 +59,7 @@ function getTemplateData(answers: CliArgs) {
59
59
  const { packageManagerName, packageManagerVersion } = getPackageManagerFromUserAgent();
60
60
  const packageManagerInstallCmd = getPackageManagerInstallCmd(packageManagerName);
61
61
  const isAppType = pluginType === PLUGIN_TYPES.app || pluginType === PLUGIN_TYPES.scenes;
62
+ const useReactRouterV6 = features.useReactRouterV6 && pluginType === PLUGIN_TYPES.app;
62
63
  const templateData: TemplateData = {
63
64
  ...answers,
64
65
  pluginId,
@@ -69,6 +70,8 @@ function getTemplateData(answers: CliArgs) {
69
70
  isNPM: packageManagerName === 'npm',
70
71
  version: currentVersion,
71
72
  bundleGrafanaUI: features.bundleGrafanaUI,
73
+ useReactRouterV6,
74
+ reactRouterVersion: useReactRouterV6 ? '6.22.0' : '5.2.0',
72
75
  };
73
76
 
74
77
  return templateData;
@@ -19,4 +19,6 @@ export type TemplateData = {
19
19
  isNPM: boolean;
20
20
  version: string;
21
21
  bundleGrafanaUI: boolean;
22
+ useReactRouterV6: boolean;
23
+ reactRouterVersion: string;
22
24
  };
@@ -46,7 +46,7 @@ In case you want to proceed as is please use the ${chalk.bold('--force')} flag.)
46
46
  // Updating the plugin (.config/, NPM package dependencies, package.json scripts)
47
47
  // (More info on the why: https://docs.google.com/document/d/15dm4WV9v7Ga9Z_Hp3CJMf2D3meuTyEWqBc3omqiOksQ)
48
48
  // -------------------
49
- updateDotConfigFolder();
49
+ await updateDotConfigFolder();
50
50
  updateNpmScripts();
51
51
  updatePackageJson({
52
52
  onlyOutdated: true,
@@ -4,6 +4,10 @@ import { getVersion } from './utils.version.js';
4
4
 
5
5
  type FeatureFlags = {
6
6
  bundleGrafanaUI: boolean;
7
+
8
+ // If set to true, the plugin will be scaffolded with React Router v6. Defaults to true.
9
+ // (Attention! We always scaffold new projects with React Router v6, so if you are changing this to `false` manually you will need to make changes to the React code as well.)
10
+ useReactRouterV6: boolean;
7
11
  };
8
12
 
9
13
  type CreatePluginConfig = UserConfig & {
@@ -66,6 +70,7 @@ function readRCFileSync(path: string): CreatePluginConfig | undefined {
66
70
 
67
71
  function createFeatureFlags(flags?: FeatureFlags): FeatureFlags {
68
72
  return {
73
+ useReactRouterV6: true,
69
74
  bundleGrafanaUI: false,
70
75
  ...flags,
71
76
  };
@@ -10,8 +10,8 @@ export type PackageJson = {
10
10
  devDependencies: Record<string, string>;
11
11
  packageManager?: string;
12
12
  } & Record<string, any>;
13
- export function getPackageJson(): PackageJson {
14
- return readJsonFile(path.join(process.cwd(), 'package.json'));
13
+ export function getPackageJson(rootPath = process.cwd()): PackageJson {
14
+ return readJsonFile(path.join(rootPath, 'package.json'));
15
15
  }
16
16
 
17
17
  // Returns with a package.json that is generated based on the latest templates
@@ -2,6 +2,7 @@ import path from 'node:path';
2
2
  import { readJsonFile } from './utils.files.js';
3
3
  import { compileTemplateFiles, getTemplateData } from './utils.templates.js';
4
4
  import { UDPATE_CONFIG } from '../constants.js';
5
+ import { prettifyFiles } from './utils.prettifyFiles.js';
5
6
 
6
7
  export function getPluginJson(srcDir?: string) {
7
8
  const srcPath = srcDir || path.join(process.cwd(), 'src');
@@ -20,6 +21,7 @@ export function isPluginDirectory() {
20
21
  }
21
22
 
22
23
  // Updates the .config/ directory with the latest templates
23
- export function updateDotConfigFolder() {
24
+ export async function updateDotConfigFolder() {
24
25
  compileTemplateFiles(UDPATE_CONFIG.filesToOverride, getTemplateData());
26
+ await prettifyFiles({ targetPath: '.config', projectRoot: '.' });
25
27
  }
@@ -0,0 +1,48 @@
1
+ import { exec as nodeExec } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+ import fs from 'node:fs';
4
+ import { getPackageJson } from './utils.packagejson.js';
5
+
6
+ const exec = promisify(nodeExec);
7
+
8
+ type PrettifyFilesArgs = {
9
+ // The path where we want to prettify files, defaults to the CWD
10
+ targetPath?: string;
11
+
12
+ // In case the `targetPath` would be set to a subdirectory, e.g. `.config/`. Defaults to `targetPath`.
13
+ projectRoot?: string;
14
+ };
15
+
16
+ export async function prettifyFiles(options: PrettifyFilesArgs) {
17
+ const targetPath = options.targetPath ?? process.cwd();
18
+ const projectRoot = options.projectRoot ?? targetPath;
19
+
20
+ if (!isPrettierUsed(projectRoot)) {
21
+ return 'Prettify skipped, because it is not used in this project.';
22
+ }
23
+
24
+ if (!fs.existsSync(targetPath)) {
25
+ return '';
26
+ }
27
+
28
+ const prettierVersion = getPrettierVersion(projectRoot);
29
+
30
+ try {
31
+ let command = `npx -y prettier@${prettierVersion} . --write`;
32
+ await exec(command, { cwd: targetPath });
33
+ } catch (error) {
34
+ throw new Error(
35
+ 'There was a problem running prettier on the plugin files. Please run `npx -y prettier@2 . --write` manually in your plugin directory.'
36
+ );
37
+ }
38
+ return 'Successfully ran prettier against new plugin.';
39
+ }
40
+
41
+ function isPrettierUsed(projectRoot?: string) {
42
+ return Boolean(getPrettierVersion(projectRoot));
43
+ }
44
+
45
+ function getPrettierVersion(projectRoot?: string) {
46
+ const packageJson = getPackageJson(projectRoot);
47
+ return packageJson.devDependencies?.prettier || packageJson.dependencies?.prettier;
48
+ }
@@ -5,7 +5,7 @@ import mkdirp from 'mkdirp';
5
5
  import { filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
6
6
  import { renderHandlebarsTemplate } from './utils.handlebars.js';
7
7
  import { getPluginJson } from './utils.plugin.js';
8
- import { TEMPLATE_PATHS, EXPORT_PATH_PREFIX, EXTRA_TEMPLATE_VARIABLES } from '../constants.js';
8
+ import { TEMPLATE_PATHS, EXPORT_PATH_PREFIX, EXTRA_TEMPLATE_VARIABLES, PLUGIN_TYPES } from '../constants.js';
9
9
  import { getPackageManagerWithFallback } from './utils.packageManager.js';
10
10
  import { getExportFileName } from '../utils/utils.files.js';
11
11
  import { getVersion } from './utils.version.js';
@@ -97,5 +97,7 @@ export function getTemplateData() {
97
97
  packageManagerVersion,
98
98
  version: currentVersion,
99
99
  bundleGrafanaUI: features.bundleGrafanaUI,
100
+ useReactRouterV6: features.useReactRouterV6 && pluginJson.type === PLUGIN_TYPES.app,
101
+ reactRouterVersion: features.useReactRouterV6 ? '6.22.0' : '5.2.0',
100
102
  };
101
103
  }
@@ -1,21 +1,20 @@
1
1
  import React from 'react';
2
- import { Route, Switch } from 'react-router-dom';
2
+ import { Route, Routes } from 'react-router-dom';
3
3
  import { AppRootProps } from '@grafana/data';
4
4
  import { ROUTES } from '../../constants';
5
5
  import { PageFour, PageOne, PageThree, PageTwo } from '../../pages';
6
- import { prefixRoute } from '../../utils/utils.routing';
7
6
 
8
7
  export function App(props: AppRootProps) {
9
8
  return (
10
- <Switch>
11
- <Route exact path={prefixRoute(ROUTES.Two)} component={PageTwo} />
12
- <Route exact path={prefixRoute(`${ROUTES.Three}/:id?`)} component={PageThree} />
9
+ <Routes>
10
+ <Route path={ROUTES.Two} element={<PageTwo />} />
11
+ <Route path={`${ROUTES.Three}/:id?`} element={<PageThree />} />
13
12
 
14
13
  {/* Full-width page (this page will have no side navigation) */}
15
- <Route exact path={prefixRoute(ROUTES.Four)} component={PageFour} />
14
+ <Route path={ROUTES.Four} element={<PageFour />} />
16
15
 
17
16
  {/* Default page */}
18
- <Route component={PageOne} />
19
- </Switch>
17
+ <Route path="*" element={<PageOne />} />
18
+ </Routes>
20
19
  );
21
20
  }
@@ -13,4 +13,4 @@ ENV GF_DEFAULT_APP_MODE "development"
13
13
 
14
14
  # Inject livereload script into grafana index.html
15
15
  USER root
16
- RUN sed -i 's/<\/body><\/html>/<script src=\"http:\/\/localhost:35729\/livereload.js\"><\/script><\/body><\/html>/g' /usr/share/grafana/public/views/index.html
16
+ RUN sed -i 's|</body>|<script src="http://localhost:35729/livereload.js"></script></body>|g' /usr/share/grafana/public/views/index.html
@@ -49,8 +49,8 @@ const config = async (env): Promise<Configuration> => {
49
49
  'react-redux',
50
50
  'redux',
51
51
  'rxjs',
52
- 'react-router',
53
- 'react-router-dom',
52
+ 'react-router',{{#unless useReactRouterV6}}
53
+ 'react-router-dom',{{/unless}}
54
54
  'd3',
55
55
  'angular',{{#unless bundleGrafanaUI}}
56
56
  '@grafana/ui',{{/unless}}
@@ -2,5 +2,7 @@
2
2
  "features": {
3
3
  {{#if bundleGrafanaUI}}
4
4
  "bundleGrafanaUI": true{{/if}}
5
+ {{#if useReactRouterV6}}
6
+ "useReactRouterV6": true{{/if}}
5
7
  }
6
8
  }
@@ -30,8 +30,8 @@
30
30
  "@testing-library/react": "14.0.0",
31
31
  "@types/jest": "^29.5.0",
32
32
  "@types/lodash": "^4.14.194",
33
- "@types/node": "^20.8.7",{{#if isAppType}}
34
- "@types/react-router-dom": "^5.3.3",{{/if}}
33
+ "@types/node": "^20.8.7",{{#unless useReactRouterV6}}
34
+ "@types/react-router-dom": "^{{ reactRouterVersion }}",{{/unless}}
35
35
  "@types/testing-library__jest-dom": "5.14.8",
36
36
  "copy-webpack-plugin": "^11.0.0",
37
37
  "css-loader": "^6.7.3",
@@ -67,7 +67,7 @@
67
67
  "@grafana/scenes": "^1.28.0",{{/if_eq}}
68
68
  "react": "18.2.0",
69
69
  "react-dom": "18.2.0",{{#if isAppType}}
70
- "react-router-dom": "5.3.3",
70
+ "react-router-dom": "^{{ reactRouterVersion }}",
71
71
  "rxjs": "7.8.0",{{/if}}
72
72
  "tslib": "2.5.3"
73
73
  },
@@ -17,14 +17,14 @@ jobs:
17
17
  env:
18
18
  GRAFANA_ACCESS_POLICY_TOKEN: $\{{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
19
19
  steps:
20
- - uses: actions/checkout@v3
20
+ - uses: actions/checkout@v4
21
21
  {{#if_eq packageManagerName "pnpm"}}
22
22
  # pnpm action uses the packageManager field in package.json to
23
23
  # understand which version to install.
24
24
  - uses: pnpm/action-setup@v2
25
25
  {{/if_eq}}
26
26
  - name: Setup Node.js environment
27
- uses: actions/setup-node@v3
27
+ uses: actions/setup-node@v4
28
28
  with:
29
29
  node-version: '20'
30
30
  cache: '{{ packageManagerName }}'
@@ -51,20 +51,20 @@ jobs:
51
51
 
52
52
  - name: Setup Go environment
53
53
  if: steps.check-for-backend.outputs.has-backend == 'true'
54
- uses: actions/setup-go@v3
54
+ uses: actions/setup-go@v5
55
55
  with:
56
56
  go-version: '1.21'
57
57
 
58
58
  - name: Test backend
59
59
  if: steps.check-for-backend.outputs.has-backend == 'true'
60
- uses: magefile/mage-action@v2
60
+ uses: magefile/mage-action@v3
61
61
  with:
62
62
  version: latest
63
63
  args: coverage
64
64
 
65
65
  - name: Build backend
66
66
  if: steps.check-for-backend.outputs.has-backend == 'true'
67
- uses: magefile/mage-action@v2
67
+ uses: magefile/mage-action@v3
68
68
  with:
69
69
  version: latest
70
70
  args: buildAll
@@ -90,7 +90,7 @@ jobs:
90
90
  run: docker-compose down
91
91
 
92
92
  - name: Archive E2E output
93
- uses: actions/upload-artifact@v3
93
+ uses: actions/upload-artifact@v4
94
94
  if: steps.check-for-e2e.outputs.has-e2e == 'true' && steps.run-e2e-tests.outcome != 'success'
95
95
  with:
96
96
  name: cypress-videos
@@ -121,7 +121,7 @@ jobs:
121
121
  zip $\{{ steps.metadata.outputs.archive }} $\{{ steps.metadata.outputs.plugin-id }} -r
122
122
 
123
123
  - name: Archive Build
124
- uses: actions/upload-artifact@v3
124
+ uses: actions/upload-artifact@v4
125
125
  with:
126
126
  name: $\{{ steps.metadata.outputs.plugin-id }}-$\{{ steps.metadata.outputs.plugin-version }}
127
127
  path: $\{{ steps.metadata.outputs.plugin-id }}
@@ -15,7 +15,7 @@ jobs:
15
15
  release:
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - uses: actions/checkout@v3
18
+ - uses: actions/checkout@v4
19
19
  - uses: grafana/plugin-actions/build-plugin@release
20
20
  # Uncomment to enable plugin signing
21
21
  # (For more info on how to generate the access policy token see https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin#generate-an-access-policy-token)
@@ -5,14 +5,14 @@ jobs:
5
5
  compatibilitycheck:
6
6
  runs-on: ubuntu-latest
7
7
  steps:
8
- - uses: actions/checkout@v3
8
+ - uses: actions/checkout@v4
9
9
  {{#if_eq packageManagerName "pnpm"}}
10
10
  # pnpm action uses the packageManager field in package.json to
11
11
  # understand which version to install.
12
12
  - uses: pnpm/action-setup@v2
13
13
  {{/if_eq}}
14
14
  - name: Setup Node.js environment
15
- uses: actions/setup-node@v3
15
+ uses: actions/setup-node@v4
16
16
  with:
17
17
  node-version: '20'
18
18
  cache: '{{ packageManagerName }}'
@@ -1,17 +0,0 @@
1
- import { exec as nodeExec } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- import fs from 'node:fs';
4
- const exec = promisify(nodeExec);
5
- export async function prettifyFiles(exportPath) {
6
- if (!fs.existsSync(exportPath)) {
7
- return '';
8
- }
9
- try {
10
- let command = 'npx -y prettier@2 . --write';
11
- await exec(command, { cwd: exportPath });
12
- }
13
- catch (error) {
14
- throw new Error('There was a problem running prettier on the plugin files. Please run `npx -y prettier@2 . --write` manually in your plugin directory.');
15
- }
16
- return 'Successfully ran prettier against new plugin.';
17
- }
@@ -1,21 +0,0 @@
1
- import { exec as nodeExec } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- import fs from 'node:fs';
4
-
5
- const exec = promisify(nodeExec);
6
-
7
- export async function prettifyFiles(exportPath: string) {
8
- if (!fs.existsSync(exportPath)) {
9
- return '';
10
- }
11
-
12
- try {
13
- let command = 'npx -y prettier@2 . --write';
14
- await exec(command, { cwd: exportPath });
15
- } catch (error) {
16
- throw new Error(
17
- 'There was a problem running prettier on the plugin files. Please run `npx -y prettier@2 . --write` manually in your plugin directory.'
18
- );
19
- }
20
- return 'Successfully ran prettier against new plugin.';
21
- }