@volumio/plugin-sdk 0.0.0-stage → 0.3.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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -2
  3. package/bin/volumio-plugin.js +190 -0
  4. package/package.json +31 -4
  5. package/registry/functions.json +93 -0
  6. package/registry/g2-baseline.json +485 -0
  7. package/schema/manifest.schema.json +95 -0
  8. package/src/audit.js +46 -0
  9. package/src/check.js +114 -0
  10. package/src/deploy.js +183 -0
  11. package/src/fromV1.js +54 -0
  12. package/src/g2/baseline.js +31 -0
  13. package/src/g2/gitleaks.toml +4 -0
  14. package/src/g2/index.js +18 -0
  15. package/src/g2/js.js +63 -0
  16. package/src/g2/rule.js +94 -0
  17. package/src/g2/secrets.js +85 -0
  18. package/src/g2/shell.js +145 -0
  19. package/src/index.js +3 -0
  20. package/src/init.js +60 -0
  21. package/src/licence.js +88 -0
  22. package/src/manifest.js +36 -0
  23. package/src/package.js +170 -0
  24. package/src/sign.js +59 -0
  25. package/src/socketio.js +76 -0
  26. package/templates/generic/AGENTS.md +60 -0
  27. package/templates/generic/CLAUDE.md +2 -0
  28. package/templates/generic/LICENSE +21 -0
  29. package/templates/generic/README.md +13 -0
  30. package/templates/generic/UIConfig.json +23 -0
  31. package/templates/generic/VOLUMIO_API.md +91 -0
  32. package/templates/generic/config.json +3 -0
  33. package/templates/generic/gitignore +2 -0
  34. package/templates/generic/i18n/strings_en.json +8 -0
  35. package/templates/generic/index.js +81 -0
  36. package/templates/generic/install.sh +4 -0
  37. package/templates/generic/package.json +17 -0
  38. package/templates/generic/test/plugin.test.js +24 -0
  39. package/templates/generic/test/volumio.js +29 -0
  40. package/templates/generic/uninstall.sh +4 -0
  41. package/templates/generic/volumio-plugin.json +13 -0
  42. package/templates/music_service/UIConfig.json +23 -0
  43. package/templates/music_service/catalog.json +4 -0
  44. package/templates/music_service/config.json +3 -0
  45. package/templates/music_service/i18n/strings_en.json +8 -0
  46. package/templates/music_service/index.js +135 -0
  47. package/templates/music_service/test/music.test.js +52 -0
  48. package/templates/music_service/test/plugin.test.js +29 -0
  49. package/templates/music_service/volumio-plugin.json +13 -0
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ // Runs the plugin as Volumio does, with a fake Volumio around it: `npm test`.
4
+ const { test } = require('node:test');
5
+ const assert = require('node:assert/strict');
6
+ const Plugin = require('..');
7
+ const { fakeVolumio, isKew } = require('./volumio');
8
+ const { PLUGIN_NAME } = require('../i18n/strings_en.json');
9
+
10
+ test('every lifecycle method returns a kew promise', () => {
11
+ const plugin = new Plugin(fakeVolumio().context);
12
+ for (const method of ['onVolumioStart', 'onStart', 'onStop']) assert.ok(isKew(plugin[method]()), method);
13
+ });
14
+
15
+ test('the settings page shows the name in Browse, and Save renames the entry', async () => {
16
+ const volumio = fakeVolumio();
17
+ const plugin = new Plugin(volumio.context);
18
+ plugin.onVolumioStart();
19
+ plugin.onStart();
20
+ assert.equal((await plugin.getUIConfig()).sections[0].content[0].value, PLUGIN_NAME);
21
+ assert.equal(volumio.browseSources[0].name, PLUGIN_NAME);
22
+
23
+ assert.ok(isKew(plugin.saveSettings({ browse_name: ' My music ' })));
24
+ assert.deepEqual(volumio.browseSources.map((s) => s.name), ['My music']);
25
+ assert.equal(volumio.toasts[0].type, 'success');
26
+
27
+ plugin.saveSettings({ browse_name: '' });
28
+ assert.deepEqual(volumio.browseSources.map((s) => s.name), [PLUGIN_NAME]);
29
+ });
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "{{id}}",
3
+ "version": "0.1.0",
4
+ "type": "{{type}}",
5
+ "function": "{{function}}",
6
+ "title": "{{title}}",
7
+ "description": "{{description}}",
8
+ "icon": "fa-puzzle-piece",
9
+ "engines": { "volumio": ">=4.0.0 <5.0.0", "api": "1" },
10
+ "arch": ["armhf", "amd64"],
11
+ "permissions": ["ui:toast", "browse-source", "playback"],
12
+ "license": "MIT"
13
+ }