@grafana/create-plugin 0.5.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v0.5.1 (Mon Nov 14 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Fix: include uppercase characters when normalising plugin id [#142](https://github.com/grafana/plugin-tools/pull/142) ([@jackw](https://github.com/jackw))
6
+
7
+ #### Authors: 1
8
+
9
+ - Jack Westbrook ([@jackw](https://github.com/jackw))
10
+
11
+ ---
12
+
1
13
  # v0.5.0 (Mon Nov 07 2022)
2
14
 
3
15
  :tada: This release contains work from a new contributor! :tada:
@@ -22,5 +22,11 @@ describe('Handlebars helpers', function () {
22
22
  var actual = (0, utils_handlebars_1.normalizeId)(pluginName, orgName, type);
23
23
  expect(actual).toEqual("myorg-myplugin-".concat(type));
24
24
  });
25
+ test.each([constants_1.PLUGIN_TYPES.app, constants_1.PLUGIN_TYPES.datasource, constants_1.PLUGIN_TYPES.panel])('should handle uppercase characters', function (type) {
26
+ var pluginName = "MyPlugin";
27
+ var orgName = 'MyOrg';
28
+ var actual = (0, utils_handlebars_1.normalizeId)(pluginName, orgName, type);
29
+ expect(actual).toEqual("myorg-myplugin-".concat(type));
30
+ });
25
31
  });
26
32
  });
@@ -39,7 +39,7 @@ var ifEq = function (a, b, options) {
39
39
  exports.ifEq = ifEq;
40
40
  var normalizeId = function (pluginName, orgName, type) {
41
41
  var re = new RegExp("-?".concat(type, "$"), 'i');
42
- var nameRegex = new RegExp('[^0-9a-z]', 'g');
42
+ var nameRegex = new RegExp('[^0-9a-zA-Z]', 'g');
43
43
  var newPluginName = pluginName.replace(re, '').replace(nameRegex, '');
44
44
  var newOrgName = orgName.replace(nameRegex, '');
45
45
  return changeCase.lowerCase(newOrgName) + '-' + changeCase.lowerCase(newPluginName) + "-".concat(type);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "directory": "packages/create-plugin",
@@ -59,5 +59,5 @@
59
59
  "engines": {
60
60
  "node": ">=16"
61
61
  },
62
- "gitHead": "e1bd595325dbb9ff838c2e3d674ab5c4f4a67a92"
62
+ "gitHead": "26bd2670ad685ef68b2c4e564e99afe045c0c466"
63
63
  }
@@ -31,5 +31,15 @@ describe('Handlebars helpers', () => {
31
31
  expect(actual).toEqual(`myorg-myplugin-${type}`);
32
32
  }
33
33
  );
34
+
35
+ test.each([PLUGIN_TYPES.app, PLUGIN_TYPES.datasource, PLUGIN_TYPES.panel])(
36
+ 'should handle uppercase characters',
37
+ (type: PLUGIN_TYPES) => {
38
+ const pluginName = `MyPlugin`;
39
+ const orgName = 'MyOrg';
40
+ const actual = normalizeId(pluginName, orgName, type);
41
+ expect(actual).toEqual(`myorg-myplugin-${type}`);
42
+ }
43
+ );
34
44
  });
35
45
  });
@@ -12,7 +12,7 @@ export const ifEq = (a: any, b: any, options: HelperOptions) => {
12
12
 
13
13
  export const normalizeId = (pluginName: string, orgName: string, type: PLUGIN_TYPES) => {
14
14
  const re = new RegExp(`-?${type}$`, 'i');
15
- const nameRegex = new RegExp('[^0-9a-z]', 'g');
15
+ const nameRegex = new RegExp('[^0-9a-zA-Z]', 'g');
16
16
 
17
17
  const newPluginName = pluginName.replace(re, '').replace(nameRegex, '');
18
18
  const newOrgName = orgName.replace(nameRegex, '');