@grafana/create-plugin 0.1.1 → 0.2.1
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/README.md +24 -61
- package/dist/commands/migrate.command.js +1 -0
- package/dist/utils/utils.npm.js +17 -1
- package/jest.config.js +2 -17
- package/package.json +9 -21
- package/src/commands/migrate.command.ts +6 -1
- package/src/utils/utils.npm.ts +17 -0
- package/templates/common/.config/README.md +4 -4
- package/templates/common/.config/tsconfig.json +8 -0
- package/templates/common/.config/webpack/webpack.config.ts +1 -0
- package/templates/common/docker-compose.yaml +2 -2
- package/templates/common/jest.config.js +4 -0
- package/templates/common/package.json +7 -6
- package/templates/github/ci/.github/workflows/release.yml +2 -2
- package/tsconfig.json +4 -13
- package/.eslintrc +0 -6
- package/.github/workflows/create-release.yml +0 -49
- package/.github/workflows/npm-bump-version.yml +0 -51
- package/.github/workflows/test.yml +0 -31
- package/.prettierrc +0 -10
- package/CONTRIBUTING.md +0 -42
- package/docs/example.mp4 +0 -0
- package/templates/common/.config/webpack/tsconfig.webpack.json +0 -9
package/README.md
CHANGED
|
@@ -4,11 +4,18 @@ Create Grafana plugins with ease.
|
|
|
4
4
|
|
|
5
5
|
**ToC**
|
|
6
6
|
|
|
7
|
-
- [
|
|
8
|
-
- [
|
|
9
|
-
- [
|
|
10
|
-
- [
|
|
11
|
-
- [
|
|
7
|
+
- [Grafana / Create Plugin](#grafana--create-plugin)
|
|
8
|
+
- [Create a new plugin](#create-a-new-plugin)
|
|
9
|
+
- [Quick overview](#quick-overview)
|
|
10
|
+
- [`yarn` (1.x)](#yarn-1x)
|
|
11
|
+
- [`yarn` (> 2.x)](#yarn--2x)
|
|
12
|
+
- [`npx`](#npx)
|
|
13
|
+
- [`npm`](#npm)
|
|
14
|
+
- [Migrate your existing plugin](#migrate-your-existing-plugin)
|
|
15
|
+
- [Things to check after migration](#things-to-check-after-migration)
|
|
16
|
+
- [Update your plugin build config](#update-your-plugin-build-config)
|
|
17
|
+
- [Customizing or extending the basic configs](#customizing-or-extending-the-basic-configs)
|
|
18
|
+
- [Contributing](#contributing)
|
|
12
19
|
|
|
13
20
|
**Links**
|
|
14
21
|
|
|
@@ -16,46 +23,39 @@ Create Grafana plugins with ease.
|
|
|
16
23
|
- [Plugin migration guide](https://grafana.com/docs/grafana/latest/developers/plugins/migration-guide/)
|
|
17
24
|
|
|
18
25
|
**`@grafana/create-plugin`** works on macOS, Windows and Linux.<br />
|
|
19
|
-
If something doesn
|
|
26
|
+
If something doesn't work, please [file an issue](https://github.com/grafana/create-plugin/issues/new).<br />
|
|
20
27
|
If you have questions or need help, please ask in [GitHub Discussions](https://github.com/grafana/create-plugin/discussions).
|
|
21
28
|
|
|
22
29
|
## Create a new plugin
|
|
23
30
|
|
|
24
31
|
### Quick overview
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
Run the command in the folder where you want to store your plugins. The new plugin will be scaffolded in a sub-directory of the folder where you run the command.
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
mkdir my-plugin && cd my-plugin
|
|
30
|
-
yarn create @grafana/plugin
|
|
31
|
-
yarn install
|
|
32
|
-
yarn dev
|
|
33
|
-
```
|
|
35
|
+
You can run the command with the package manager of your choice:
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
#### [`npx`](https://github.com/npm/npx)
|
|
37
|
+
#### [`yarn`](https://classic.yarnpkg.com/blog/2017/05/12/introducing-yarn/) (1.x)
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
|
|
40
|
+
yarn create @grafana/plugin
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
#### [`
|
|
43
|
+
#### [`yarn`](https://yarnpkg.com/cli/dlx) (> 2.x)
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
|
|
46
|
+
yarn dlx @grafana/create-plugin
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
#### [`
|
|
49
|
+
#### [`npx`](https://github.com/npm/npx)
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
|
|
52
|
+
npx @grafana/create-plugin
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
#### [`
|
|
55
|
+
#### [`npm`](https://docs.npmjs.com/cli/v7/commands/npm-init)
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
|
|
58
|
+
npm init @grafana/plugin
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
---
|
|
@@ -97,47 +97,10 @@ npx @grafana/create-plugin update
|
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
100
|
-
## Start developing your plugin
|
|
101
|
-
|
|
102
|
-
We have put together the following dev scripts for you, so you can start coding right away:
|
|
103
|
-
|
|
104
|
-
#### `yarn dev`
|
|
105
|
-
|
|
106
|
-
Starts the build in watch mode.
|
|
107
|
-
The build output (plugin bundle) is going to be exported to `./dist`.
|
|
108
|
-
|
|
109
|
-
#### `yarn build`
|
|
110
|
-
|
|
111
|
-
Creates a production build for your plugin.
|
|
112
|
-
The build output is going to be exported to `./dist`.
|
|
113
|
-
|
|
114
|
-
#### `yarn test`
|
|
115
|
-
|
|
116
|
-
Runs the tests under `./src` directory in watch mode.
|
|
117
|
-
Give your test files a `.test.tsx` or `.test.ts` extension.
|
|
118
|
-
|
|
119
|
-
#### `yarn test:ci`
|
|
120
|
-
|
|
121
|
-
Runs the tests and returns with either a zero or a non-zero exit status.
|
|
122
|
-
|
|
123
|
-
#### `yarn typecheck`
|
|
124
|
-
|
|
125
|
-
Runs the Typescript compiler against the codebase in a dry-run mode to highlight any type errors or warnings.
|
|
126
|
-
|
|
127
|
-
#### `yarn lint`
|
|
128
|
-
|
|
129
|
-
Runs ESLint against the codebase.
|
|
130
|
-
|
|
131
|
-
#### `yarn lint:fix`
|
|
132
|
-
|
|
133
|
-
Runs ESLint against the codebase and attempts to fix the simpler errors.
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
100
|
## Customizing or extending the basic configs
|
|
138
101
|
|
|
139
102
|
You can read more about customizing or extending the basic configuration [here](templates/common/.config/README.md)
|
|
140
103
|
|
|
141
104
|
## Contributing
|
|
142
105
|
|
|
143
|
-
We are always grateful for contribution! See the [CONTRIBUTING.md](
|
|
106
|
+
We are always grateful for contribution! See the [CONTRIBUTING.md](../CONTRIBUTING.md) for more information.
|
|
@@ -120,6 +120,7 @@ var migrate = function () { return __awaiter(void 0, void 0, void 0, function ()
|
|
|
120
120
|
else {
|
|
121
121
|
(0, utils_console_1.printMessage)(constants_1.TEXT.updateNpmScriptsAborted);
|
|
122
122
|
}
|
|
123
|
+
(0, utils_npm_1.cleanUpPackageJson)();
|
|
123
124
|
(0, utils_console_1.printSuccessMessage)(constants_1.TEXT.migrationCommandSuccess);
|
|
124
125
|
return [3, 12];
|
|
125
126
|
case 11:
|
package/dist/utils/utils.npm.js
CHANGED
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
exports.__esModule = true;
|
|
17
|
-
exports.updateNpmScripts = exports.removeNpmDependencies = exports.getRemovableNpmDependencies = exports.getUpdatableNpmDependencies = exports.getPackageJsonUpdates = exports.updateNpmDependencies = exports.updatePackageJson = exports.hasNpmDependenciesToUpdate = exports.getPackageJsonUpdatesAsText = exports.getNpmDependencyUpdatesAsText = exports.writePackageJson = exports.getLatestPackageJson = exports.getPackageJson = void 0;
|
|
17
|
+
exports.cleanUpPackageJson = exports.updateNpmScripts = exports.removeNpmDependencies = exports.getRemovableNpmDependencies = exports.getUpdatableNpmDependencies = exports.getPackageJsonUpdates = exports.updateNpmDependencies = exports.updatePackageJson = exports.hasNpmDependenciesToUpdate = exports.getPackageJsonUpdatesAsText = exports.getNpmDependencyUpdatesAsText = exports.writePackageJson = exports.getLatestPackageJson = exports.getPackageJson = void 0;
|
|
18
18
|
var path_1 = __importDefault(require("path"));
|
|
19
19
|
var fs_1 = __importDefault(require("fs"));
|
|
20
20
|
var semver_1 = __importDefault(require("semver"));
|
|
@@ -160,3 +160,19 @@ function updateNpmScripts() {
|
|
|
160
160
|
writePackageJson(packageJson);
|
|
161
161
|
}
|
|
162
162
|
exports.updateNpmScripts = updateNpmScripts;
|
|
163
|
+
function cleanUpPackageJson() {
|
|
164
|
+
var packageJson = getPackageJson();
|
|
165
|
+
packageJson.scripts = sortKeysAlphabetically(packageJson.scripts);
|
|
166
|
+
packageJson.dependencies = sortKeysAlphabetically(packageJson.dependencies);
|
|
167
|
+
packageJson.devDependencies = sortKeysAlphabetically(packageJson.devDependencies);
|
|
168
|
+
writePackageJson(packageJson);
|
|
169
|
+
}
|
|
170
|
+
exports.cleanUpPackageJson = cleanUpPackageJson;
|
|
171
|
+
function sortKeysAlphabetically(obj) {
|
|
172
|
+
return Object.keys(obj)
|
|
173
|
+
.sort()
|
|
174
|
+
.reduce(function (acc, key) {
|
|
175
|
+
acc[key] = obj[key];
|
|
176
|
+
return acc;
|
|
177
|
+
}, {});
|
|
178
|
+
}
|
package/jest.config.js
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
|
+
const sharedConfig = require('../../jest.config.base');
|
|
1
2
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
transform: {
|
|
4
|
-
'^.+\\.(t|j)sx?$': [
|
|
5
|
-
'@swc/jest',
|
|
6
|
-
{
|
|
7
|
-
sourceMaps: true,
|
|
8
|
-
jsc: {
|
|
9
|
-
parser: {
|
|
10
|
-
syntax: 'typescript',
|
|
11
|
-
tsx: true,
|
|
12
|
-
decorators: false,
|
|
13
|
-
dynamicImport: true,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
},
|
|
3
|
+
...sharedConfig,
|
|
19
4
|
modulePathIgnorePatterns: ['<rootDir>/templates/'],
|
|
20
5
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"main": "index.js",
|
|
5
|
-
"repository":
|
|
5
|
+
"repository": {
|
|
6
|
+
"directory": "packages/create-plugin",
|
|
7
|
+
"url": "git@github.com:grafana/create-plugin.git"
|
|
8
|
+
},
|
|
6
9
|
"author": "Grafana",
|
|
7
10
|
"license": "Apache-2.0",
|
|
8
11
|
"bin": "./dist/bin/run.js",
|
|
@@ -17,42 +20,27 @@
|
|
|
17
20
|
"generate-app": "tsc && yarn clean-generated && CREATE_PLUGIN_DEV=true node ./dist/bin/run.js -- create-plugin 'Sample app' 'sample-org' 'This is a sample app.' 'app' 't' 't' 't'",
|
|
18
21
|
"generate-panel": "tsc && yarn clean-generated && CREATE_PLUGIN_DEV=true node ./dist/bin/run.js -- create-plugin 'Sample panel' 'sample-org' 'This is a sample panel.' 'panel' 't' 't' 't'",
|
|
19
22
|
"generate-datasource": "tsc && yarn clean-generated && CREATE_PLUGIN_DEV=true node ./dist/bin/run.js -- create-plugin 'Sample datasource' 'sample-org' 'This is a sample datasource.' 'datasource' 't' 't' 't'",
|
|
20
|
-
"lint": "eslint --cache --
|
|
23
|
+
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./src",
|
|
21
24
|
"lint:fix": "yarn lint --fix",
|
|
22
|
-
"test": "jest
|
|
25
|
+
"test": "jest",
|
|
23
26
|
"typecheck": "tsc --noEmit"
|
|
24
27
|
},
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@grafana/tsconfig": "^1.2.0-rc1",
|
|
27
|
-
"@swc/core": "^1.2.162",
|
|
28
29
|
"@types/minimist": "^1.2.2",
|
|
29
30
|
"@types/mkdirp": "^1.0.2",
|
|
30
31
|
"@types/semver": "^7.3.9",
|
|
31
32
|
"enquirer": "^2.3.6",
|
|
32
33
|
"glob": "^7.1.7",
|
|
33
|
-
"jest": "^27.5.1",
|
|
34
|
-
"marked-terminal": "^5.1.1",
|
|
35
34
|
"marked": "^4.0.12",
|
|
35
|
+
"marked-terminal": "^5.1.1",
|
|
36
36
|
"mkdirp": "^1.0.4",
|
|
37
37
|
"plop": "^2.7.4",
|
|
38
38
|
"semver": "^7.3.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@grafana/eslint-config": "^2.5.0",
|
|
42
|
-
"@swc/jest": "^0.2.20",
|
|
43
41
|
"@types/glob": "^7.0.0",
|
|
44
|
-
"@types/jest": "^27.4.1",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
46
|
-
"@typescript-eslint/parser": "^4.33.0",
|
|
47
|
-
"eslint": "^7.32.0",
|
|
48
|
-
"eslint-config-prettier": "^8.3.0",
|
|
49
|
-
"eslint-plugin-jsdoc": "^36.1.0",
|
|
50
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
51
42
|
"eslint-plugin-react": "^7.26.1",
|
|
52
|
-
"eslint-plugin-react-hooks": "^4.2.0"
|
|
53
|
-
"nodemon": "^2.0.13",
|
|
54
|
-
"tsc-watch": "^4.5.0",
|
|
55
|
-
"typescript": "^4.4.3"
|
|
43
|
+
"eslint-plugin-react-hooks": "^4.2.0"
|
|
56
44
|
},
|
|
57
45
|
"nodemonConfig": {
|
|
58
46
|
"watch": [
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getRemovableNpmDependencies,
|
|
10
10
|
removeNpmDependencies,
|
|
11
11
|
updateNpmScripts,
|
|
12
|
+
cleanUpPackageJson,
|
|
12
13
|
} from '../utils/utils.npm';
|
|
13
14
|
|
|
14
15
|
export const migrate = async () => {
|
|
@@ -90,7 +91,11 @@ export const migrate = async () => {
|
|
|
90
91
|
printMessage(TEXT.updateNpmScriptsAborted);
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
//
|
|
94
|
+
// Tidy package.json file so any changed fields are sorted as a
|
|
95
|
+
// package manager would expect.
|
|
96
|
+
cleanUpPackageJson();
|
|
97
|
+
|
|
98
|
+
// 7. Summary
|
|
94
99
|
// -------------
|
|
95
100
|
printSuccessMessage(TEXT.migrationCommandSuccess);
|
|
96
101
|
} catch (error) {
|
package/src/utils/utils.npm.ts
CHANGED
|
@@ -187,3 +187,20 @@ export function updateNpmScripts() {
|
|
|
187
187
|
|
|
188
188
|
writePackageJson(packageJson);
|
|
189
189
|
}
|
|
190
|
+
|
|
191
|
+
export function cleanUpPackageJson() {
|
|
192
|
+
const packageJson = getPackageJson();
|
|
193
|
+
packageJson.scripts = sortKeysAlphabetically(packageJson.scripts);
|
|
194
|
+
packageJson.dependencies = sortKeysAlphabetically(packageJson.dependencies);
|
|
195
|
+
packageJson.devDependencies = sortKeysAlphabetically(packageJson.devDependencies);
|
|
196
|
+
writePackageJson(packageJson);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function sortKeysAlphabetically(obj: Record<string, string>) {
|
|
200
|
+
return Object.keys(obj)
|
|
201
|
+
.sort()
|
|
202
|
+
.reduce<Record<string, string>>((acc, key) => {
|
|
203
|
+
acc[key] = obj[key];
|
|
204
|
+
return acc;
|
|
205
|
+
}, {});
|
|
206
|
+
}
|
|
@@ -109,12 +109,12 @@ We need to update the `scripts` in the `package.json` to use the extended Webpac
|
|
|
109
109
|
|
|
110
110
|
**Update for `build`:**
|
|
111
111
|
```diff
|
|
112
|
-
-"build": "
|
|
113
|
-
+"build": "
|
|
112
|
+
-"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
|
|
113
|
+
+"build": "webpack -c ./webpack.config.ts --env production",
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
**Update for `dev`:**
|
|
117
117
|
```diff
|
|
118
|
-
-"dev": "
|
|
119
|
-
+"dev": "
|
|
118
|
+
-"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
|
|
119
|
+
+"dev": "webpack -w -c ./webpack.config.ts --env development",
|
|
120
120
|
```
|
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"typeRoots": ["../node_modules/@types"],
|
|
13
13
|
"resolveJsonModule": true
|
|
14
14
|
},
|
|
15
|
+
"ts-node": {
|
|
16
|
+
"compilerOptions": {
|
|
17
|
+
"module": "commonjs",
|
|
18
|
+
"target": "es5",
|
|
19
|
+
"esModuleInterop": true
|
|
20
|
+
},
|
|
21
|
+
"transpileOnly": true
|
|
22
|
+
},
|
|
15
23
|
"include": ["../src", "./types"],
|
|
16
24
|
"extends": "@grafana/tsconfig"
|
|
17
25
|
}
|
|
@@ -3,12 +3,12 @@ version: '3.0'
|
|
|
3
3
|
services:
|
|
4
4
|
grafana:
|
|
5
5
|
container_name: '{{ kebabCase pluginName }}'
|
|
6
|
-
build:
|
|
6
|
+
build:
|
|
7
7
|
context: ./.config
|
|
8
8
|
args:
|
|
9
9
|
grafana_version: ${GRAFANA_VERSION:-{{~grafanaVersion~}} }
|
|
10
10
|
ports:
|
|
11
11
|
- 3000:3000/tcp
|
|
12
12
|
volumes:
|
|
13
|
-
- ./dist:/var/lib/grafana/plugins/{{ kebabCase pluginName }}
|
|
13
|
+
- ./dist:/var/lib/grafana/plugins/{{ kebabCase pluginName }}
|
|
14
14
|
- ./provisioning:/etc/grafana/provisioning
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// force timezone to UTC to allow tests to work regardless of local timezone
|
|
2
|
+
// generally used by snapshots, but can affect specific tests
|
|
3
|
+
process.env.TZ = 'UTC';
|
|
4
|
+
|
|
1
5
|
module.exports = {
|
|
2
6
|
// Jest configuration provided by Grafana scaffolding
|
|
3
7
|
...require('./.config/jest.config'),
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"description": "{{ sentenceCase pluginDescription }}",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "
|
|
7
|
-
"dev": "
|
|
6
|
+
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
|
|
7
|
+
"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
|
|
8
8
|
"test": "jest --watch --onlyChanged",
|
|
9
9
|
"test:ci": "jest --maxWorkers 4",
|
|
10
10
|
"typecheck": "tsc --noEmit",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"@testing-library/jest-dom": "^5.16.2",
|
|
29
29
|
"@testing-library/react": "^12.1.3",
|
|
30
30
|
"@types/glob": "^8.0.0",
|
|
31
|
-
"@types/jest": "^27.4.1",
|
|
31
|
+
"@types/jest": "^27.4.1",
|
|
32
|
+
"@types/lodash": "latest",{{#if_eq pluginType "app"}}
|
|
32
33
|
"@types/react-router-dom": "^5.3.3",{{/if_eq}}
|
|
33
34
|
"@types/node": "^17.0.19",
|
|
34
35
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
@@ -62,8 +63,8 @@
|
|
|
62
63
|
"@grafana/data": "{{ grafanaVersion }}",
|
|
63
64
|
"@grafana/runtime": "{{ grafanaVersion }}",
|
|
64
65
|
"@grafana/ui": "{{ grafanaVersion }}",
|
|
65
|
-
"
|
|
66
|
-
"react-
|
|
67
|
-
{{/if_eq}}
|
|
66
|
+
"react": "17.0.2",
|
|
67
|
+
"react-dom": "17.0.2"{{#if_eq pluginType "app"}},
|
|
68
|
+
"react-router-dom": "^5.2.0"{{/if_eq}}
|
|
68
69
|
}
|
|
69
70
|
}
|
|
@@ -120,10 +120,10 @@ jobs:
|
|
|
120
120
|
- name: Lint plugin
|
|
121
121
|
run: |
|
|
122
122
|
git clone https://github.com/grafana/plugin-validator
|
|
123
|
-
pushd ./plugin-validator/cmd/
|
|
123
|
+
pushd ./plugin-validator/pkg/cmd/plugincheck2
|
|
124
124
|
go install
|
|
125
125
|
popd
|
|
126
|
-
|
|
126
|
+
plugincheck2 -config ./plugin-validator/config/publishing.yaml $\{{ steps.metadata.outputs.archive }}
|
|
127
127
|
|
|
128
128
|
- name: Create release
|
|
129
129
|
id: create_release
|
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"removeComments": true,
|
|
5
|
-
"preserveConstEnums": true,
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"noImplicitAny": true,
|
|
8
|
-
"noImplicitReturns": true,
|
|
9
|
-
"noImplicitThis": true,
|
|
10
|
-
"noUnusedLocals": true,
|
|
11
|
-
"pretty": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
3
|
+
"outDir": "./dist"
|
|
14
4
|
},
|
|
15
|
-
"include": ["src"],
|
|
16
5
|
"exclude": ["node_modules", "templates"],
|
|
17
|
-
|
|
6
|
+
"extends": "../../tsconfig.base.json",
|
|
7
|
+
"include": ["src"]
|
|
8
|
+
}
|
package/.eslintrc
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
on:
|
|
2
|
-
push:
|
|
3
|
-
tags:
|
|
4
|
-
- 'v*'
|
|
5
|
-
|
|
6
|
-
name: Create Release
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
publish:
|
|
10
|
-
name: Publish to npm
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v2
|
|
14
|
-
|
|
15
|
-
- name: Setup environment
|
|
16
|
-
uses: actions/setup-node@v2.5.1
|
|
17
|
-
with:
|
|
18
|
-
node-version: '16'
|
|
19
|
-
registry-url: 'https://registry.npmjs.org'
|
|
20
|
-
cache: 'yarn'
|
|
21
|
-
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
run: yarn install --immutable
|
|
24
|
-
|
|
25
|
-
- name: Build package
|
|
26
|
-
run: yarn build
|
|
27
|
-
|
|
28
|
-
- name: Publish
|
|
29
|
-
run: npm publish --access public
|
|
30
|
-
env:
|
|
31
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
32
|
-
|
|
33
|
-
create-github-release:
|
|
34
|
-
name: Create GitHub Release
|
|
35
|
-
runs-on: ubuntu-latest
|
|
36
|
-
needs: publish
|
|
37
|
-
steps:
|
|
38
|
-
- name: Checkout code
|
|
39
|
-
uses: actions/checkout@v3
|
|
40
|
-
|
|
41
|
-
- name: Create Release Notes
|
|
42
|
-
uses: actions/github-script@v4.0.2
|
|
43
|
-
with:
|
|
44
|
-
github-token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
|
|
45
|
-
script: |
|
|
46
|
-
await github.request(`POST /repos/${{ github.repository }}/releases`, {
|
|
47
|
-
tag_name: "${{ github.ref }}",
|
|
48
|
-
generate_release_notes: true
|
|
49
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
name: NPM bump version
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
inputs:
|
|
6
|
-
version:
|
|
7
|
-
description: 'Semver type of new version (major / minor / patch)'
|
|
8
|
-
required: true
|
|
9
|
-
type: choice
|
|
10
|
-
options:
|
|
11
|
-
- patch
|
|
12
|
-
- minor
|
|
13
|
-
- major
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
bump-version:
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
|
|
19
|
-
steps:
|
|
20
|
-
- uses: actions/checkout@v3
|
|
21
|
-
with:
|
|
22
|
-
token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
|
|
23
|
-
|
|
24
|
-
- name: Setup environment
|
|
25
|
-
uses: actions/setup-node@v3.1.1
|
|
26
|
-
with:
|
|
27
|
-
node-version: '16'
|
|
28
|
-
cache: 'yarn'
|
|
29
|
-
|
|
30
|
-
- name: Install dependencies
|
|
31
|
-
run: yarn install --immutable
|
|
32
|
-
|
|
33
|
-
- name: Check types
|
|
34
|
-
run: yarn typecheck
|
|
35
|
-
|
|
36
|
-
- name: Lint
|
|
37
|
-
run: yarn lint
|
|
38
|
-
|
|
39
|
-
- name: Unit tests
|
|
40
|
-
run: yarn jest
|
|
41
|
-
|
|
42
|
-
- name: Setup Git
|
|
43
|
-
run: |
|
|
44
|
-
git config user.name 'grafanabot'
|
|
45
|
-
git config user.email 'bot@grafana.com'
|
|
46
|
-
|
|
47
|
-
- name: bump version
|
|
48
|
-
run: npm version ${{ github.event.inputs.version }}
|
|
49
|
-
|
|
50
|
-
- name: Push latest version
|
|
51
|
-
run: git push origin main --follow-tags
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
name: test
|
|
2
|
-
on: push
|
|
3
|
-
|
|
4
|
-
jobs:
|
|
5
|
-
test:
|
|
6
|
-
runs-on: ubuntu-latest
|
|
7
|
-
name: Run unit tests
|
|
8
|
-
steps:
|
|
9
|
-
- name: Checkout repository
|
|
10
|
-
uses: actions/checkout@v2
|
|
11
|
-
with:
|
|
12
|
-
ref: ${{ github.ref }}
|
|
13
|
-
- name: Setup .npmrc file for NPM registry
|
|
14
|
-
uses: actions/setup-node@v2
|
|
15
|
-
with:
|
|
16
|
-
node-version: '16'
|
|
17
|
-
registry-url: 'https://registry.npmjs.org'
|
|
18
|
-
- name: Install dependencies
|
|
19
|
-
run: yarn
|
|
20
|
-
- name: Check types
|
|
21
|
-
run: yarn typecheck
|
|
22
|
-
- name: Lint
|
|
23
|
-
run: yarn lint
|
|
24
|
-
- name: Unit tests
|
|
25
|
-
run: yarn jest
|
|
26
|
-
- name: test an app plugin generation
|
|
27
|
-
run: yarn generate-app && (cd generated && yarn && yarn build && yarn lint)
|
|
28
|
-
- name: test panel plugin generation
|
|
29
|
-
run: yarn generate-panel && (cd generated && yarn && yarn build && yarn lint)
|
|
30
|
-
- name: test datasource plugin generation
|
|
31
|
-
run: yarn generate-datasource && (cd generated && yarn && yarn build && yarn lint)
|
package/.prettierrc
DELETED
package/CONTRIBUTING.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Contributing to Grafana / Create Plugin
|
|
2
|
-
|
|
3
|
-
We are always grateful to receive contribution!<br />
|
|
4
|
-
The following guidelines help you on how to start with the codebase and how to submit your work.
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
### Prerequisites
|
|
9
|
-
|
|
10
|
-
You need to have `npm` or `yarn` installed.
|
|
11
|
-
|
|
12
|
-
### Installing
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
git clone git@github.com:grafana/create-plugin.git
|
|
16
|
-
cd create-plugin
|
|
17
|
-
yarn install
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Overview
|
|
21
|
-
|
|
22
|
-
### Technologies
|
|
23
|
-
|
|
24
|
-
- [**`Plop`**](https://github.com/plopjs/plop) - we are using Plop for the CLI tool and for scaffolding
|
|
25
|
-
|
|
26
|
-
### Folder structure
|
|
27
|
-
|
|
28
|
-
_Work in progress._
|
|
29
|
-
|
|
30
|
-
## Development
|
|
31
|
-
|
|
32
|
-
### Conventions
|
|
33
|
-
|
|
34
|
-
_Work in progress._
|
|
35
|
-
|
|
36
|
-
### Developing the templates
|
|
37
|
-
|
|
38
|
-
_Work in progress._
|
|
39
|
-
|
|
40
|
-
### Submitting a Pull Request
|
|
41
|
-
|
|
42
|
-
_Work in progress._
|
package/docs/example.mp4
DELETED
|
Binary file
|