@grafana/create-plugin 1.2.0 → 1.2.1-canary.217.9983fdf.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.
@@ -42,7 +42,7 @@ var utils_templates_1 = require("../utils/utils.templates");
42
42
  var utils_console_1 = require("../utils/utils.console");
43
43
  var utils_npm_1 = require("../utils/utils.npm");
44
44
  var update = function () { return __awaiter(void 0, void 0, void 0, function () {
45
- var PROMPT_CHOICES, shouldUpdateDeps, error_1;
45
+ var updatableText, PROMPT_CHOICES, shouldUpdateDeps, error_1;
46
46
  return __generator(this, function (_a) {
47
47
  switch (_a.label) {
48
48
  case 0:
@@ -59,12 +59,14 @@ var update = function () { return __awaiter(void 0, void 0, void 0, function ()
59
59
  process.exit(0);
60
60
  }
61
61
  if (!(0, utils_npm_1.hasNpmDependenciesToUpdate)()) return [3, 3];
62
+ updatableText = (0, utils_npm_1.getPackageJsonUpdatesAsText)({ ignoreGrafanaDependencies: true });
63
+ if (!(updatableText.length > 0)) return [3, 3];
62
64
  PROMPT_CHOICES = {
63
65
  ALL: 'Yes, all of them',
64
66
  ONLY_OUTDATED: 'Yes, but only the outdated ones',
65
67
  NONE: 'No'
66
68
  };
67
- return [4, (0, utils_console_1.selectPrompt)(constants_1.TEXT.updateNpmDependenciesPrompt + (0, utils_npm_1.getPackageJsonUpdatesAsText)(), [
69
+ return [4, (0, utils_console_1.selectPrompt)(constants_1.TEXT.updateNpmDependenciesPrompt + updatableText, [
68
70
  PROMPT_CHOICES.ALL,
69
71
  PROMPT_CHOICES.ONLY_OUTDATED,
70
72
  PROMPT_CHOICES.NONE,
@@ -72,7 +74,10 @@ var update = function () { return __awaiter(void 0, void 0, void 0, function ()
72
74
  case 2:
73
75
  shouldUpdateDeps = _a.sent();
74
76
  if (shouldUpdateDeps && shouldUpdateDeps !== PROMPT_CHOICES.NONE) {
75
- (0, utils_npm_1.updatePackageJson)({ onlyOutdated: shouldUpdateDeps === PROMPT_CHOICES.ONLY_OUTDATED });
77
+ (0, utils_npm_1.updatePackageJson)({
78
+ onlyOutdated: shouldUpdateDeps === PROMPT_CHOICES.ONLY_OUTDATED,
79
+ ignoreGrafanaDependencies: true
80
+ });
76
81
  (0, utils_console_1.printSuccessMessage)(constants_1.TEXT.updateNpmDependenciesSuccess);
77
82
  }
78
83
  else {
@@ -55,10 +55,12 @@ function getPackageJsonUpdatesAsText(options) {
55
55
  if (options === void 0) { options = {}; }
56
56
  var asText = '';
57
57
  var _a = getPackageJsonUpdates(options), dependencyUpdates = _a.dependencyUpdates, devDependencyUpdates = _a.devDependencyUpdates;
58
- if (Object.keys(dependencyUpdates).length > 0) {
58
+ var npmDependencyUpdatesText = getNpmDependencyUpdatesAsText(dependencyUpdates);
59
+ var npmDevDependencyUpdatesText = getNpmDependencyUpdatesAsText(devDependencyUpdates);
60
+ if (npmDependencyUpdatesText.length > 0) {
59
61
  asText += "\n\n **Dependencies**\n ".concat(getNpmDependencyUpdatesAsText(dependencyUpdates));
60
62
  }
61
- if (Object.keys(devDependencyUpdates).length > 0) {
63
+ if (npmDevDependencyUpdatesText.length > 0) {
62
64
  asText += "\n\n **Dev Dependencies**\n ".concat(getNpmDependencyUpdatesAsText(devDependencyUpdates));
63
65
  }
64
66
  return asText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "1.2.0",
3
+ "version": "1.2.1-canary.217.9983fdf.0",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "directory": "packages/create-plugin",
@@ -63,5 +63,5 @@
63
63
  "engines": {
64
64
  "node": ">=16"
65
65
  },
66
- "gitHead": "286c9962e8625f004f8915f860b8145f633cf215"
66
+ "gitHead": "9983fdf8b9b000ad6baf275366780cae62a4facf"
67
67
  }
@@ -28,22 +28,30 @@ export const update = async () => {
28
28
  // (skipped automatically if there is nothing to update)
29
29
  // ------------------------------------------------
30
30
  if (hasNpmDependenciesToUpdate()) {
31
- const PROMPT_CHOICES = {
32
- ALL: 'Yes, all of them',
33
- ONLY_OUTDATED: 'Yes, but only the outdated ones',
34
- NONE: 'No',
35
- };
36
- const shouldUpdateDeps = await selectPrompt(TEXT.updateNpmDependenciesPrompt + getPackageJsonUpdatesAsText(), [
37
- PROMPT_CHOICES.ALL,
38
- PROMPT_CHOICES.ONLY_OUTDATED,
39
- PROMPT_CHOICES.NONE,
40
- ]);
31
+ const updatableText = getPackageJsonUpdatesAsText({ ignoreGrafanaDependencies: true });
41
32
 
42
- if (shouldUpdateDeps && shouldUpdateDeps !== PROMPT_CHOICES.NONE) {
43
- updatePackageJson({ onlyOutdated: shouldUpdateDeps === PROMPT_CHOICES.ONLY_OUTDATED });
44
- printSuccessMessage(TEXT.updateNpmDependenciesSuccess);
45
- } else {
46
- printMessage(TEXT.updateNpmDependenciesAborted);
33
+ if (updatableText.length > 0) {
34
+ const PROMPT_CHOICES = {
35
+ ALL: 'Yes, all of them',
36
+ ONLY_OUTDATED: 'Yes, but only the outdated ones',
37
+ NONE: 'No',
38
+ };
39
+
40
+ const shouldUpdateDeps = await selectPrompt(TEXT.updateNpmDependenciesPrompt + updatableText, [
41
+ PROMPT_CHOICES.ALL,
42
+ PROMPT_CHOICES.ONLY_OUTDATED,
43
+ PROMPT_CHOICES.NONE,
44
+ ]);
45
+
46
+ if (shouldUpdateDeps && shouldUpdateDeps !== PROMPT_CHOICES.NONE) {
47
+ updatePackageJson({
48
+ onlyOutdated: shouldUpdateDeps === PROMPT_CHOICES.ONLY_OUTDATED,
49
+ ignoreGrafanaDependencies: true,
50
+ });
51
+ printSuccessMessage(TEXT.updateNpmDependenciesSuccess);
52
+ } else {
53
+ printMessage(TEXT.updateNpmDependenciesAborted);
54
+ }
47
55
  }
48
56
  }
49
57
 
@@ -22,7 +22,7 @@ export function printSuccessMessage(msg: string) {
22
22
  console.log(displayAsMarkdown(`\n✔ ${msg}`));
23
23
  }
24
24
 
25
- export function confirmPrompt(message: string) {
25
+ export function confirmPrompt(message: string): Promise<boolean> {
26
26
  const prompt = new Confirm({
27
27
  name: 'question',
28
28
  message: displayAsMarkdown(message),
@@ -31,7 +31,7 @@ export function confirmPrompt(message: string) {
31
31
  return prompt.run();
32
32
  }
33
33
 
34
- export function selectPrompt(message: string, choices: string[]) {
34
+ export function selectPrompt(message: string, choices: string[]): Promise<string> {
35
35
  const prompt = new Select({
36
36
  choices,
37
37
  message: displayAsMarkdown(message),
@@ -53,11 +53,14 @@ export function getPackageJsonUpdatesAsText(options: UpdateOptions = {}) {
53
53
  let asText = '';
54
54
  const { dependencyUpdates, devDependencyUpdates } = getPackageJsonUpdates(options);
55
55
 
56
- if (Object.keys(dependencyUpdates).length > 0) {
56
+ const npmDependencyUpdatesText = getNpmDependencyUpdatesAsText(dependencyUpdates);
57
+ const npmDevDependencyUpdatesText = getNpmDependencyUpdatesAsText(devDependencyUpdates);
58
+
59
+ if (npmDependencyUpdatesText.length > 0) {
57
60
  asText += `\n\n **Dependencies**\n ${getNpmDependencyUpdatesAsText(dependencyUpdates)}`;
58
61
  }
59
62
 
60
- if (Object.keys(devDependencyUpdates).length > 0) {
63
+ if (npmDevDependencyUpdatesText.length > 0) {
61
64
  asText += `\n\n **Dev Dependencies**\n ${getNpmDependencyUpdatesAsText(devDependencyUpdates)}`;
62
65
  }
63
66
 
@@ -0,0 +1,16 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "Standalone debug mode",
6
+ "type": "go",
7
+ "request": "launch",
8
+ "mode": "debug",
9
+ "program": "${workspaceFolder}/pkg",
10
+ "env": {},
11
+ "args": [
12
+ "-standalone"
13
+ ]
14
+ }
15
+ ]
16
+ }
@@ -2,7 +2,7 @@ module github.com/{{ kebabCase orgName }}/{{ kebabCase pluginName }}
2
2
 
3
3
  go 1.19
4
4
 
5
- require github.com/grafana/grafana-plugin-sdk-go v0.155.0
5
+ require github.com/grafana/grafana-plugin-sdk-go v0.156.0
6
6
 
7
7
  require (
8
8
  github.com/BurntSushi/toml v1.2.1 // indirect
@@ -112,8 +112,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1
112
112
  github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
113
113
  github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
114
114
  github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
115
- github.com/grafana/grafana-plugin-sdk-go v0.155.0 h1:i6yQu3RegxxFph2poE2+DOG8EHT1R9LS5WDbTglIhSQ=
116
- github.com/grafana/grafana-plugin-sdk-go v0.155.0/go.mod h1:Wj4WD+sfoUB/q5UG016IvUQBM7HBJaNEAc88b++4szs=
115
+ github.com/grafana/grafana-plugin-sdk-go v0.156.0 h1:LPR5gpROmdwkkvm5oGihl0mSKyWNHWIjAjzzTxk3k7M=
116
+ github.com/grafana/grafana-plugin-sdk-go v0.156.0/go.mod h1:Wj4WD+sfoUB/q5UG016IvUQBM7HBJaNEAc88b++4szs=
117
117
  github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw=
118
118
  github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y=
119
119
  github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
@@ -0,0 +1,16 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "Standalone debug mode",
6
+ "type": "go",
7
+ "request": "launch",
8
+ "mode": "debug",
9
+ "program": "${workspaceFolder}/pkg",
10
+ "env": {},
11
+ "args": [
12
+ "-standalone"
13
+ ]
14
+ }
15
+ ]
16
+ }
@@ -2,7 +2,7 @@ module github.com/{{ kebabCase orgName }}/{{ kebabCase pluginName }}
2
2
 
3
3
  go 1.19
4
4
 
5
- require github.com/grafana/grafana-plugin-sdk-go v0.155.0
5
+ require github.com/grafana/grafana-plugin-sdk-go v0.156.0
6
6
 
7
7
  require (
8
8
  github.com/BurntSushi/toml v1.2.1 // indirect
@@ -112,8 +112,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1
112
112
  github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
113
113
  github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
114
114
  github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
115
- github.com/grafana/grafana-plugin-sdk-go v0.155.0 h1:i6yQu3RegxxFph2poE2+DOG8EHT1R9LS5WDbTglIhSQ=
116
- github.com/grafana/grafana-plugin-sdk-go v0.155.0/go.mod h1:Wj4WD+sfoUB/q5UG016IvUQBM7HBJaNEAc88b++4szs=
115
+ github.com/grafana/grafana-plugin-sdk-go v0.156.0 h1:LPR5gpROmdwkkvm5oGihl0mSKyWNHWIjAjzzTxk3k7M=
116
+ github.com/grafana/grafana-plugin-sdk-go v0.156.0/go.mod h1:Wj4WD+sfoUB/q5UG016IvUQBM7HBJaNEAc88b++4szs=
117
117
  github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw=
118
118
  github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y=
119
119
  github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=