@grafana/sign-plugin 0.0.3 → 0.1.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 CHANGED
@@ -1,3 +1,19 @@
1
+ # v0.1.0 (Thu Jan 26 2023)
2
+
3
+ :tada: This release contains work from a new contributor! :tada:
4
+
5
+ Thank you, Tomas Basham ([@tomasbasham](https://github.com/tomasbasham)), for all your work!
6
+
7
+ #### 🚀 Enhancement
8
+
9
+ - Sign Plugin: Parameterise distribution directory [#175](https://github.com/grafana/plugin-tools/pull/175) ([@tomasbasham](https://github.com/tomasbasham))
10
+
11
+ #### Authors: 1
12
+
13
+ - Tomas Basham ([@tomasbasham](https://github.com/tomasbasham))
14
+
15
+ ---
16
+
1
17
  # v0.0.3 (Thu Jan 26 2023)
2
18
 
3
19
  #### 🐛 Bug Fix
package/README.md CHANGED
@@ -33,6 +33,13 @@ export GRAFANA_API_KEY=<YOUR_API_KEY>
33
33
  npx @grafana/sign-plugin
34
34
  ```
35
35
 
36
+ If the plugin distribution directory differs from the default `dist`, specify the path to use with the `--distDir` flag.
37
+
38
+ ```bash
39
+ export GRAFANA_API_KEY=<YOUR_API_KEY>
40
+ npx @grafana/sign-plugin --distDir path/to/directory
41
+ ```
42
+
36
43
  ### Sign a private plugin
37
44
 
38
45
  In your plugin directory, run the following to create a MANIFEST.txt file in the dist directory of your plugin.
@@ -46,24 +46,25 @@ var pluginValidation_1 = require("../utils/pluginValidation");
46
46
  var manifest_1 = require("../utils/manifest");
47
47
  var getVersion_1 = require("../utils/getVersion");
48
48
  var sign = function (argv) { return __awaiter(void 0, void 0, void 0, function () {
49
- var pluginDistDir, signatureType, rootUrls, manifest, signedManifest, err_1;
50
- var _a, _b;
51
- return __generator(this, function (_c) {
52
- switch (_c.label) {
49
+ var distDir, pluginDistDir, signatureType, rootUrls, manifest, signedManifest, err_1;
50
+ var _a, _b, _c;
51
+ return __generator(this, function (_d) {
52
+ switch (_d.label) {
53
53
  case 0:
54
- pluginDistDir = path_1["default"].resolve('dist');
54
+ distDir = (_a = argv.distDir) !== null && _a !== void 0 ? _a : 'dist';
55
+ pluginDistDir = path_1["default"].resolve(distDir);
55
56
  signatureType = argv.signatureType;
56
- rootUrls = (_b = (_a = argv.rootUrls) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
57
+ rootUrls = (_c = (_b = argv.rootUrls) === null || _b === void 0 ? void 0 : _b.split(',')) !== null && _c !== void 0 ? _c : [];
57
58
  if (!(0, fs_1.existsSync)(pluginDistDir)) {
58
- throw new Error('Plugin `dist` directory is missing. Did you build the plugin before attempting to sign?');
59
+ throw new Error("Plugin `".concat(distDir, "` directory is missing. Did you build the plugin before attempting to sign?"));
59
60
  }
60
- _c.label = 1;
61
+ _d.label = 1;
61
62
  case 1:
62
- _c.trys.push([1, 4, , 5]);
63
+ _d.trys.push([1, 4, , 5]);
63
64
  console.log('Building manifest...');
64
65
  return [4, (0, manifest_1.buildManifest)(pluginDistDir)];
65
66
  case 2:
66
- manifest = _c.sent();
67
+ manifest = _d.sent();
67
68
  console.log('Signing manifest...');
68
69
  if (signatureType) {
69
70
  manifest.signatureType = signatureType;
@@ -75,13 +76,13 @@ var sign = function (argv) { return __awaiter(void 0, void 0, void 0, function (
75
76
  manifest.signPlugin = { version: (0, getVersion_1.getVersion)() };
76
77
  return [4, (0, manifest_1.signManifest)(manifest)];
77
78
  case 3:
78
- signedManifest = _c.sent();
79
+ signedManifest = _d.sent();
79
80
  console.log('Saving signed manifest...');
80
81
  (0, manifest_1.saveManifest)(pluginDistDir, signedManifest);
81
82
  console.log('Signed successfully');
82
83
  return [3, 5];
83
84
  case 4:
84
- err_1 = _c.sent();
85
+ err_1 = _d.sent();
85
86
  console.warn(err_1);
86
87
  process.exitCode = 1;
87
88
  return [3, 5];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/sign-plugin",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "directory": "packages/sign-plugin",
@@ -41,5 +41,5 @@
41
41
  "engines": {
42
42
  "node": ">=16"
43
43
  },
44
- "gitHead": "41684a27f4c1f15ebe72e9b67edbb4eb030e9b20"
44
+ "gitHead": "f27f1333941079ea7e39799f8e6c8ca3e0c6cea3"
45
45
  }
@@ -6,12 +6,13 @@ import { buildManifest, signManifest, saveManifest } from '../utils/manifest';
6
6
  import { getVersion } from '../utils/getVersion';
7
7
 
8
8
  export const sign = async (argv: minimist.ParsedArgs) => {
9
- const pluginDistDir = path.resolve('dist');
9
+ const distDir = argv.distDir ?? 'dist';
10
+ const pluginDistDir = path.resolve(distDir);
10
11
  const signatureType: string = argv.signatureType;
11
12
  const rootUrls: string[] = argv.rootUrls?.split(',') ?? [];
12
13
 
13
14
  if (!existsSync(pluginDistDir)) {
14
- throw new Error('Plugin `dist` directory is missing. Did you build the plugin before attempting to sign?');
15
+ throw new Error(`Plugin \`${distDir}\` directory is missing. Did you build the plugin before attempting to sign?`);
15
16
  }
16
17
 
17
18
  try {