@grafana/create-plugin 2.10.0 → 2.10.2-canary.624.1787d34.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 +19 -0
- package/dist/commands/migrate.command.js +1 -1
- package/dist/utils/utils.files.js +12 -1
- package/package.json +2 -2
- package/src/commands/migrate.command.ts +7 -2
- package/src/utils/utils.files.ts +13 -0
- package/templates/app/README.md +3 -3
- package/templates/common/.config/webpack/webpack.config.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# v2.10.1 (Thu Dec 14 2023)
|
|
2
|
+
|
|
3
|
+
:tada: This release contains work from a new contributor! :tada:
|
|
4
|
+
|
|
5
|
+
Thank you, Carson ([@mure](https://github.com/mure)), for all your work!
|
|
6
|
+
|
|
7
|
+
#### 🐛 Bug Fix
|
|
8
|
+
|
|
9
|
+
- Copy over `query_help.md` when building plugins [#374](https://github.com/grafana/plugin-tools/pull/374) ([@mure](https://github.com/mure) [@jackw](https://github.com/jackw))
|
|
10
|
+
- Minor edits to style of README.md [#583](https://github.com/grafana/plugin-tools/pull/583) ([@josmperez](https://github.com/josmperez))
|
|
11
|
+
|
|
12
|
+
#### Authors: 3
|
|
13
|
+
|
|
14
|
+
- Carson ([@mure](https://github.com/mure))
|
|
15
|
+
- Jack Westbrook ([@jackw](https://github.com/jackw))
|
|
16
|
+
- Joseph Perez ([@josmperez](https://github.com/josmperez))
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
1
20
|
# v2.10.0 (Tue Dec 12 2023)
|
|
2
21
|
|
|
3
22
|
#### 🚀 Enhancement
|
|
@@ -53,7 +53,7 @@ var migrate = function () { return __awaiter(void 0, void 0, void 0, function ()
|
|
|
53
53
|
return [4, (0, utils_console_1.confirmPrompt)(constants_1.TEXT.overrideFilesPrompt + '\n' + (0, utils_console_1.displayArrayAsList)(constants_1.MIGRATION_CONFIG.filesToOverride))];
|
|
54
54
|
case 1:
|
|
55
55
|
if (_a.sent()) {
|
|
56
|
-
(0, utils_templates_1.compileTemplateFiles)(constants_1.MIGRATION_CONFIG.filesToOverride, (0, utils_templates_1.getTemplateData)());
|
|
56
|
+
(0, utils_templates_1.compileTemplateFiles)(constants_1.MIGRATION_CONFIG.filesToOverride.map(utils_files_1.getExportTemplateName), (0, utils_templates_1.getTemplateData)());
|
|
57
57
|
(0, utils_console_1.printSuccessMessage)(constants_1.TEXT.overrideFilesSuccess);
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isFileStartingWith = exports.getExportFileName = exports.removeFilesInCwd = exports.getOnlyNotExistingInCwd = exports.getOnlyExistingInCwd = exports.readJsonFile = exports.isFile = exports.filterOutCommonFiles = void 0;
|
|
6
|
+
exports.isFileStartingWith = exports.getExportFileName = exports.getExportTemplateName = exports.removeFilesInCwd = exports.getOnlyNotExistingInCwd = exports.getOnlyExistingInCwd = exports.readJsonFile = exports.isFile = exports.filterOutCommonFiles = void 0;
|
|
7
7
|
var path_1 = __importDefault(require("path"));
|
|
8
8
|
var fs_1 = __importDefault(require("fs"));
|
|
9
9
|
var constants_1 = require("../constants");
|
|
@@ -52,6 +52,17 @@ function removeFilesInCwd(files) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
exports.removeFilesInCwd = removeFilesInCwd;
|
|
55
|
+
function getExportTemplateName(f) {
|
|
56
|
+
var baseName = path_1.default.basename(f);
|
|
57
|
+
for (var _i = 0, _a = Object.entries(configFileNamesMap); _i < _a.length; _i++) {
|
|
58
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
59
|
+
if (value === baseName) {
|
|
60
|
+
return key;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return baseName;
|
|
64
|
+
}
|
|
65
|
+
exports.getExportTemplateName = getExportTemplateName;
|
|
55
66
|
function getExportFileName(f) {
|
|
56
67
|
var baseName = path_1.default.basename(f);
|
|
57
68
|
if (Object.keys(configFileNamesMap).includes(baseName)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "2.10.0",
|
|
3
|
+
"version": "2.10.2-canary.624.1787d34.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/create-plugin",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=20"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "1787d3412fccceb73f95f91a2ed29395674608c4"
|
|
70
70
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { TEXT, MIGRATION_CONFIG } from '../constants';
|
|
2
2
|
import { displayArrayAsList, printMessage, printSuccessMessage, confirmPrompt } from '../utils/utils.console';
|
|
3
3
|
import { compileTemplateFiles, getTemplateData } from '../utils/utils.templates';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getExportTemplateName,
|
|
6
|
+
getOnlyExistingInCwd,
|
|
7
|
+
getOnlyNotExistingInCwd,
|
|
8
|
+
removeFilesInCwd,
|
|
9
|
+
} from '../utils/utils.files';
|
|
5
10
|
import {
|
|
6
11
|
getPackageJsonUpdatesAsText,
|
|
7
12
|
updatePackageJson,
|
|
@@ -23,7 +28,7 @@ export const migrate = async () => {
|
|
|
23
28
|
// 1. Add / update configuration files
|
|
24
29
|
// --------------------------
|
|
25
30
|
if (await confirmPrompt(TEXT.overrideFilesPrompt + '\n' + displayArrayAsList(MIGRATION_CONFIG.filesToOverride))) {
|
|
26
|
-
compileTemplateFiles(MIGRATION_CONFIG.filesToOverride, getTemplateData());
|
|
31
|
+
compileTemplateFiles(MIGRATION_CONFIG.filesToOverride.map(getExportTemplateName), getTemplateData());
|
|
27
32
|
printSuccessMessage(TEXT.overrideFilesSuccess);
|
|
28
33
|
} else {
|
|
29
34
|
printMessage(TEXT.overrideFilesAborted);
|
package/src/utils/utils.files.ts
CHANGED
|
@@ -50,6 +50,19 @@ export function removeFilesInCwd(files: string[]) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/** Given a exported file name it'll return its equivalent
|
|
54
|
+
* in the template folder.
|
|
55
|
+
*/
|
|
56
|
+
export function getExportTemplateName(f: string) {
|
|
57
|
+
const baseName = path.basename(f);
|
|
58
|
+
for (const [key, value] of Object.entries(configFileNamesMap)) {
|
|
59
|
+
if (value === baseName) {
|
|
60
|
+
return key;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return baseName;
|
|
64
|
+
}
|
|
65
|
+
|
|
53
66
|
export function getExportFileName(f: string) {
|
|
54
67
|
const baseName = path.basename(f);
|
|
55
68
|
|
package/templates/app/README.md
CHANGED
|
@@ -4,9 +4,9 @@ This template is a starting point for building an app plugin for Grafana.
|
|
|
4
4
|
|
|
5
5
|
## What are Grafana app plugins?
|
|
6
6
|
|
|
7
|
-
App plugins can let you create a custom out-of-the-box monitoring experience by custom pages, nested
|
|
7
|
+
App plugins can let you create a custom out-of-the-box monitoring experience by custom pages, nested data sources and panel plugins.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Get started
|
|
10
10
|
|
|
11
11
|
{{#if hasBackend}}-- INSERT BACKEND GETTING STARTED --{{/if}}
|
|
12
12
|
-- INSERT FRONTEND GETTING STARTED --
|
|
@@ -19,4 +19,4 @@ Below you can find source code for existing app plugins and other related docume
|
|
|
19
19
|
|
|
20
20
|
- [Basic app plugin example](https://github.com/grafana/grafana-plugin-examples/tree/master/examples/app-basic#readme)
|
|
21
21
|
- [`plugin.json` documentation](https://grafana.com/developers/plugin-tools/reference-plugin-json)
|
|
22
|
-
- [
|
|
22
|
+
- [Sign a plugin](https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin)
|
|
@@ -157,6 +157,7 @@ const config = async (env): Promise<Configuration> => {
|
|
|
157
157
|
{ from: 'img/**/*', to: '.', noErrorOnMissing: true }, // Optional
|
|
158
158
|
{ from: 'libs/**/*', to: '.', noErrorOnMissing: true }, // Optional
|
|
159
159
|
{ from: 'static/**/*', to: '.', noErrorOnMissing: true }, // Optional
|
|
160
|
+
{ from: '**/query_help.md', to: '.', noErrorOnMissing: true}, // Optional
|
|
160
161
|
],
|
|
161
162
|
}),
|
|
162
163
|
// Replace certain template-variables in the README and plugin.json
|