@grafana/create-plugin 0.10.0 → 1.0.0-canary.193.70e38b4.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 +0 -12
- package/README.md +6 -7
- package/dist/bin/run.js +2 -1
- package/dist/commands/index.js +1 -0
- package/dist/commands/version.command.js +63 -0
- package/dist/constants.js +1 -1
- package/package.json +2 -2
- package/src/bin/run.ts +2 -1
- package/src/commands/index.ts +1 -0
- package/src/commands/version.command.ts +21 -0
- package/src/constants.ts +1 -1
- package/templates/common/.config/.eslintrc +2 -1
- package/templates/common/.config/Dockerfile +1 -2
- package/templates/common/.config/README.md +0 -23
- package/templates/common/.config/jest-setup.js +2 -1
- package/templates/common/.config/tsconfig.json +2 -1
- package/templates/common/.config/webpack/webpack.config.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
# v0.10.0 (Thu Feb 02 2023)
|
|
2
|
-
|
|
3
|
-
#### 🚀 Enhancement
|
|
4
|
-
|
|
5
|
-
- CreatePlugin: Change default docker image to grafana-enterprise [#197](https://github.com/grafana/plugin-tools/pull/197) ([@mckn](https://github.com/mckn))
|
|
6
|
-
|
|
7
|
-
#### Authors: 1
|
|
8
|
-
|
|
9
|
-
- Marcus Andersson ([@mckn](https://github.com/mckn))
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
1
|
# v0.9.1 (Thu Feb 02 2023)
|
|
14
2
|
|
|
15
3
|
#### 🐛 Bug Fix
|
package/README.md
CHANGED
|
@@ -12,13 +12,13 @@ Create Grafana plugins with ease.
|
|
|
12
12
|
- [`npx`](#npx)
|
|
13
13
|
- [`npm`](#npm)
|
|
14
14
|
- [Migrate your existing plugin](#migrate-your-existing-plugin)
|
|
15
|
-
- [Things to check after migration](#things-to-check-after-migration)
|
|
16
15
|
- [Update your plugin build config](#update-your-plugin-build-config)
|
|
17
16
|
- [Customizing or extending the basic configs](#customizing-or-extending-the-basic-configs)
|
|
18
17
|
- [Contributing](#contributing)
|
|
19
18
|
|
|
20
19
|
**Links**
|
|
21
20
|
|
|
21
|
+
- [Plugin Tools docs](https://grafana.github.io/plugin-tools/)
|
|
22
22
|
- [Plugin developer docs](https://grafana.com/docs/grafana/latest/developers/plugins/)
|
|
23
23
|
- [Plugin migration guide](https://grafana.com/docs/grafana/latest/developers/plugins/migration-guide/)
|
|
24
24
|
|
|
@@ -61,6 +61,7 @@ npm init @grafana/plugin
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
63
|
## Migrate your existing plugin
|
|
64
|
+
|
|
64
65
|
:warning: We [do not support](https://grafana.com/docs/grafana/latest/developers/angular_deprecation/) plugins written in `angular`
|
|
65
66
|
|
|
66
67
|
In case you have an existing plugin previously created using the `@grafana/toolkit` you can use the
|
|
@@ -73,11 +74,7 @@ cd ./my-plugin
|
|
|
73
74
|
npx @grafana/create-plugin migrate
|
|
74
75
|
```
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- If you have a custom webpack configuration you might need to migrate it. You can read more about customizing or extending the basic configuration [here](templates/common/.config/README.md)
|
|
79
|
-
- Build your plugin. Run `yarn build` to check your plugin builds as intended.
|
|
80
|
-
- Test your plugin. Test your plugin inside grafana to confirm it is working as intended.
|
|
77
|
+
For more information see [here](https://grafana.github.io/plugin-tools/docs/migrating-from-toolkit)
|
|
81
78
|
|
|
82
79
|
---
|
|
83
80
|
|
|
@@ -96,11 +93,13 @@ cd ./my-plugin
|
|
|
96
93
|
npx @grafana/create-plugin update
|
|
97
94
|
```
|
|
98
95
|
|
|
96
|
+
For more information see [here](https://grafana.github.io/plugin-tools/docs/updating-to-new-releases)
|
|
97
|
+
|
|
99
98
|
---
|
|
100
99
|
|
|
101
100
|
## Customizing or extending the basic configs
|
|
102
101
|
|
|
103
|
-
You can read more about customizing or extending the basic configuration [here](
|
|
102
|
+
You can read more about customizing or extending the basic configuration [here](https://grafana.github.io/plugin-tools/docs/advanced-configuration/)
|
|
104
103
|
|
|
105
104
|
## Contributing
|
|
106
105
|
|
package/dist/bin/run.js
CHANGED
|
@@ -11,7 +11,8 @@ var argv = (0, minimist_1["default"])(args);
|
|
|
11
11
|
var commands = {
|
|
12
12
|
migrate: commands_1.migrate,
|
|
13
13
|
generate: commands_1.generate,
|
|
14
|
-
update: commands_1.update
|
|
14
|
+
update: commands_1.update,
|
|
15
|
+
version: commands_1.version
|
|
15
16
|
};
|
|
16
17
|
var command = commands[argv._[0]] || commands.generate;
|
|
17
18
|
command(argv);
|
package/dist/commands/index.js
CHANGED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
exports.version = void 0;
|
|
40
|
+
var path_1 = require("path");
|
|
41
|
+
var fs_1 = require("fs");
|
|
42
|
+
var version = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
try {
|
|
45
|
+
console.log(getVersion());
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error(error);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
return [2];
|
|
52
|
+
});
|
|
53
|
+
}); };
|
|
54
|
+
exports.version = version;
|
|
55
|
+
var getVersion = function () {
|
|
56
|
+
var packageJsonPath = (0, path_1.resolve)(__dirname, '..', '..', 'package.json');
|
|
57
|
+
var pkg = (0, fs_1.readFileSync)(packageJsonPath, 'utf8');
|
|
58
|
+
var version = JSON.parse(pkg).version;
|
|
59
|
+
if (!version) {
|
|
60
|
+
throw "Could not find the version of sign-plugin";
|
|
61
|
+
}
|
|
62
|
+
return version;
|
|
63
|
+
};
|
package/dist/constants.js
CHANGED
|
@@ -80,7 +80,7 @@ exports.TEXT = {
|
|
|
80
80
|
updateNpmScriptsSuccess: 'NPM scripts updated successfully.',
|
|
81
81
|
updateNpmScriptsAborted: 'No NPM scripts have been added or updated.',
|
|
82
82
|
migrationCommandWarning: '**⚠️ Warning!**\nThis is going to change files in your current project to make it up-to-date with the latest plugin configuration.\nPlease make sure that you have backed up your changes.',
|
|
83
|
-
migrationCommandSuccess: "\n## What's next?\n * Run `yarn install` to install the latest dependencies.\n * Check your tsconfig.json. You might need to update if you had a custom configuration.\n * If you have a custom webpack configuration you might need to update it too.\n * Run `yarn build` and observe the output for any errors.\n * Test your plugin in grafana and make sure everything works as expected.\n\nSee instructions on how to customize your configuration here https://github.
|
|
83
|
+
migrationCommandSuccess: "\n## What's next?\n * Run `yarn install` to install the latest dependencies.\n * Check your tsconfig.json. You might need to update if you had a custom configuration.\n * If you have a custom webpack configuration you might need to update it too.\n * Run `yarn build` and observe the output for any errors.\n * Test your plugin in grafana and make sure everything works as expected.\n\nSee instructions on how to customize your configuration here https://grafana.github.io/plugin-tools/docs/advanced-configuration/\n ",
|
|
84
84
|
updateCommandWarning: '**⚠️ Warning!**\nThis is going to update files under the `.config/` folder.\nMake sure to commit your changes before running this script.',
|
|
85
85
|
updateCommandSuccess: '**Done.**\nIf you have any questions please open an issue/discussion in https://github.com/grafana/plugin-tools.'
|
|
86
86
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-canary.193.70e38b4.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/create-plugin",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=16"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "70e38b4e71526b3a2a3af29e646777b949ef3a04"
|
|
64
64
|
}
|
package/src/bin/run.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import minimist from 'minimist';
|
|
4
|
-
import { generate, update, migrate } from '../commands';
|
|
4
|
+
import { generate, update, migrate, version } from '../commands';
|
|
5
5
|
|
|
6
6
|
const args = process.argv.slice(2);
|
|
7
7
|
const argv = minimist(args);
|
|
@@ -9,6 +9,7 @@ const commands: Record<string, (argv: minimist.ParsedArgs) => void> = {
|
|
|
9
9
|
migrate,
|
|
10
10
|
generate,
|
|
11
11
|
update,
|
|
12
|
+
version,
|
|
12
13
|
};
|
|
13
14
|
const command = commands[argv._[0]] || commands.generate;
|
|
14
15
|
|
package/src/commands/index.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
|
|
4
|
+
export const version = async () => {
|
|
5
|
+
try {
|
|
6
|
+
console.log(getVersion());
|
|
7
|
+
} catch (error) {
|
|
8
|
+
console.error(error);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getVersion = () => {
|
|
14
|
+
const packageJsonPath = resolve(__dirname, '..', '..', 'package.json');
|
|
15
|
+
const pkg = readFileSync(packageJsonPath, 'utf8');
|
|
16
|
+
const { version } = JSON.parse(pkg);
|
|
17
|
+
if (!version) {
|
|
18
|
+
throw `Could not find the version of sign-plugin`;
|
|
19
|
+
}
|
|
20
|
+
return version;
|
|
21
|
+
};
|
package/src/constants.ts
CHANGED
|
@@ -115,7 +115,7 @@ export const TEXT = {
|
|
|
115
115
|
* Run \`yarn build\` and observe the output for any errors.
|
|
116
116
|
* Test your plugin in grafana and make sure everything works as expected.
|
|
117
117
|
|
|
118
|
-
See instructions on how to customize your configuration here https://github.
|
|
118
|
+
See instructions on how to customize your configuration here https://grafana.github.io/plugin-tools/docs/advanced-configuration/
|
|
119
119
|
`,
|
|
120
120
|
|
|
121
121
|
updateCommandWarning: '**⚠️ Warning!**\nThis is going to update files under the `.config/` folder.\nMake sure to commit your changes before running this script.',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
3
|
*
|
|
4
|
-
* In order to extend the configuration follow the steps in
|
|
4
|
+
* In order to extend the configuration follow the steps in
|
|
5
|
+
* https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-eslint-config
|
|
5
6
|
*/
|
|
6
7
|
{
|
|
7
8
|
"extends": ["@grafana/eslint-config"],
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
ARG grafana_version=latest
|
|
2
|
-
ARG grafana_image=grafana-enterprise
|
|
3
2
|
|
|
4
|
-
FROM grafana
|
|
3
|
+
FROM grafana/grafana:${grafana_version}
|
|
5
4
|
|
|
6
5
|
# Make it as simple as possible to access the grafana instance for development purposes
|
|
7
6
|
# Do NOT enable these settings in a public facing / production grafana instance
|
|
@@ -139,26 +139,3 @@ We need to update the `scripts` in the `package.json` to use the extended Webpac
|
|
|
139
139
|
-"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
|
|
140
140
|
+"dev": "webpack -w -c ./webpack.config.ts --env development",
|
|
141
141
|
```
|
|
142
|
-
|
|
143
|
-
### Configure grafana image to use when running docker
|
|
144
|
-
|
|
145
|
-
By default `grafana-enterprise` will be used as the docker image for all docker related commands. If you want to override this behaviour simply alter the `docker-compose.yaml` by adding the following build arg `grafana_image`.
|
|
146
|
-
|
|
147
|
-
**Example:**
|
|
148
|
-
|
|
149
|
-
```yaml
|
|
150
|
-
version: '3.7'
|
|
151
|
-
|
|
152
|
-
services:
|
|
153
|
-
grafana:
|
|
154
|
-
container_name: 'myorg-basic-app'
|
|
155
|
-
build:
|
|
156
|
-
context: ./.config
|
|
157
|
-
args:
|
|
158
|
-
grafana_version: ${GRAFANA_VERSION:-9.1.2}
|
|
159
|
-
grafana_image: ${GRAFANA_IMAGE:-grafana}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
In this example we are assigning the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will give you the possibility to set the value while running the docker-compose commands which might be convinent in some scenarios.
|
|
163
|
-
|
|
164
|
-
---
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
3
|
*
|
|
4
|
-
* In order to extend the configuration follow the steps in
|
|
4
|
+
* In order to extend the configuration follow the steps in
|
|
5
|
+
* https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-jest-config
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
8
|
import '@testing-library/jest-dom';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
3
|
*
|
|
4
|
-
* In order to extend the configuration follow the steps in
|
|
4
|
+
* In order to extend the configuration follow the steps in
|
|
5
|
+
* https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-typescript-config
|
|
5
6
|
*/
|
|
6
7
|
{
|
|
7
8
|
"compilerOptions": {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
3
|
*
|
|
4
|
-
* In order to extend the configuration follow the steps in
|
|
4
|
+
* In order to extend the configuration follow the steps in
|
|
5
|
+
* https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-webpack-config
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
8
|
import CopyWebpackPlugin from 'copy-webpack-plugin';
|