lumia-plugin 0.1.10 → 0.1.12
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.
|
@@ -18,7 +18,7 @@ your-plugin/
|
|
|
18
18
|
|
|
19
19
|
This file defines your plugin's metadata and capabilities:
|
|
20
20
|
|
|
21
|
-
- **id**: Unique identifier
|
|
21
|
+
- **id**: Unique identifier using letters, numbers, or underscores (e.g., "my_awesome_plugin")
|
|
22
22
|
- **name**: Display name shown to users
|
|
23
23
|
- **description**: Short description for the plugin marketplace
|
|
24
24
|
- **main**: Entry point file (usually "main.js")
|
|
@@ -116,7 +116,7 @@ Variables let other Lumia features access your plugin's data:
|
|
|
116
116
|
{
|
|
117
117
|
"name": "my_variable",
|
|
118
118
|
"key": "myVariable",
|
|
119
|
-
"origin": "
|
|
119
|
+
"origin": "your_plugin_id",
|
|
120
120
|
"type": "string",
|
|
121
121
|
"example": "Sample value"
|
|
122
122
|
}
|
|
@@ -11,7 +11,7 @@ This template demonstrates a handful of common Lumia Stream plugin capabilities:
|
|
|
11
11
|
Use the CLI to copy and customise the template:
|
|
12
12
|
|
|
13
13
|
```
|
|
14
|
-
npx lumia-plugin create
|
|
14
|
+
npx lumia-plugin create my_plugin
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
After scaffolding you can tailor the manifest, code, and README to match your idea.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
2
|
+
"id": "showcase_plugin",
|
|
3
3
|
"name": "Showcase Plugin",
|
|
4
4
|
"version": "1.0.0",
|
|
5
5
|
"author": "LumiaStream",
|
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
"website": "",
|
|
8
8
|
"repository": "",
|
|
9
9
|
"description": "Sample plugin that demonstrates Lumia Stream logging, variables, alerts, and settings.",
|
|
10
|
-
"longDescription": "",
|
|
11
10
|
"license": "MIT",
|
|
12
11
|
"lumiaVersion": "^9.0.0",
|
|
13
|
-
"keywords":
|
|
12
|
+
"keywords": "sample, demo, lumia",
|
|
14
13
|
"category": "examples",
|
|
15
14
|
"icon": "",
|
|
16
|
-
"screenshots": [],
|
|
17
15
|
"changelog": "",
|
|
18
16
|
"config": {
|
|
19
17
|
"settings": [
|
|
@@ -108,7 +106,7 @@
|
|
|
108
106
|
{
|
|
109
107
|
"name": "last_message",
|
|
110
108
|
"system": false,
|
|
111
|
-
"origin": "
|
|
109
|
+
"origin": "showcase_plugin",
|
|
112
110
|
"allowedPlaces": ["automations", "overlays"],
|
|
113
111
|
"description": "Stores the most recent message handled by the plugin.",
|
|
114
112
|
"value": "",
|
|
@@ -117,7 +115,7 @@
|
|
|
117
115
|
{
|
|
118
116
|
"name": "last_alert_color",
|
|
119
117
|
"system": false,
|
|
120
|
-
"origin": "
|
|
118
|
+
"origin": "showcase_plugin",
|
|
121
119
|
"allowedPlaces": ["automations", "overlays"],
|
|
122
120
|
"description": "Tracks the color used by the latest sample alert.",
|
|
123
121
|
"value": "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lumia-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Command-line tools for creating, building, and validating Lumia Stream plugins.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lumia-plugin": "scripts/cli.js"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"author": "Lumia Stream",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@lumiastream/plugin": "^0.1.
|
|
23
|
+
"@lumiastream/plugin": "^0.1.12",
|
|
24
24
|
"jszip": "3.10.1"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/scripts/cli.js
CHANGED
|
@@ -24,9 +24,9 @@ Commands:
|
|
|
24
24
|
validate [file] Validate a .lumiaplugin package
|
|
25
25
|
|
|
26
26
|
Examples:
|
|
27
|
-
lumia-plugin create
|
|
28
|
-
lumia-plugin build ./
|
|
29
|
-
lumia-plugin validate
|
|
27
|
+
lumia-plugin create my_plugin
|
|
28
|
+
lumia-plugin build ./my_plugin
|
|
29
|
+
lumia-plugin validate my_plugin.lumiaplugin
|
|
30
30
|
`);
|
|
31
31
|
process.exit(command ? 1 : 0);
|
|
32
32
|
}
|
package/scripts/create-plugin.js
CHANGED
|
@@ -4,19 +4,19 @@ const fs = require("fs");
|
|
|
4
4
|
|
|
5
5
|
const TEMPLATE_DIR = path.resolve(__dirname, "..", "examples", "base-plugin");
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
function toSafeId(value) {
|
|
8
|
+
const cleaned = value
|
|
9
|
+
.trim()
|
|
10
|
+
.toLowerCase()
|
|
11
|
+
.replace(/[^a-z0-9]+/g, "_")
|
|
12
|
+
.replace(/^_+|_+$/g, "");
|
|
13
|
+
const safe = cleaned.replace(/__+/g, "_");
|
|
14
|
+
return safe || "my_plugin";
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function toDisplayName(id) {
|
|
18
18
|
return id
|
|
19
|
-
.split(
|
|
19
|
+
.split(/[_-]+/)
|
|
20
20
|
.filter(Boolean)
|
|
21
21
|
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
22
22
|
.join(" ");
|
|
@@ -24,7 +24,7 @@ function toDisplayName(id) {
|
|
|
24
24
|
|
|
25
25
|
function printHelp() {
|
|
26
26
|
console.log(
|
|
27
|
-
`Scaffold a new Lumia Stream plugin directory using the showcase template.\n\nUsage: npx lumia-plugin create [target-directory]\n\nExamples:\n npx lumia-plugin create ./plugins/
|
|
27
|
+
`Scaffold a new Lumia Stream plugin directory using the showcase template.\n\nUsage: npx lumia-plugin create [target-directory]\n\nExamples:\n npx lumia-plugin create ./plugins/my_plugin\n npx lumia-plugin create my_awesome_plugin\n`
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -81,18 +81,12 @@ async function updateManifest(manifestPath, pluginId, displayName) {
|
|
|
81
81
|
manifest.description = manifest.description?.trim()
|
|
82
82
|
? manifest.description
|
|
83
83
|
: `Describe what ${displayName} does.`;
|
|
84
|
-
manifest.longDescription = manifest.longDescription || "";
|
|
85
84
|
manifest.repository = manifest.repository || "";
|
|
86
85
|
manifest.website = manifest.website || "";
|
|
87
86
|
manifest.email = manifest.email || "";
|
|
88
87
|
manifest.icon = manifest.icon || "";
|
|
89
|
-
manifest.screenshots = ensureArray(manifest.screenshots);
|
|
90
88
|
manifest.changelog = manifest.changelog || "";
|
|
91
|
-
manifest.keywords =
|
|
92
|
-
|
|
93
|
-
if (!manifest.keywords.includes(pluginId)) {
|
|
94
|
-
manifest.keywords.push(pluginId);
|
|
95
|
-
}
|
|
89
|
+
manifest.keywords = manifest.keywords || "";
|
|
96
90
|
|
|
97
91
|
if (!manifest.main) {
|
|
98
92
|
manifest.main = "main.js";
|
|
@@ -149,7 +143,7 @@ async function updateMain(mainPath, pluginId, className, displayName) {
|
|
|
149
143
|
`Hello from ${displayName}!`
|
|
150
144
|
);
|
|
151
145
|
source = source.replace(/Showcase Plugin/g, displayName);
|
|
152
|
-
source = source.replace(/showcase-plugin/g, pluginId);
|
|
146
|
+
source = source.replace(/showcase[-_]plugin/g, pluginId);
|
|
153
147
|
await fs.promises.writeFile(mainPath, source);
|
|
154
148
|
}
|
|
155
149
|
|
|
@@ -192,8 +186,8 @@ async function main() {
|
|
|
192
186
|
process.exit(1);
|
|
193
187
|
}
|
|
194
188
|
|
|
195
|
-
const targetDir = path.resolve(args[0] || "
|
|
196
|
-
const pluginId =
|
|
189
|
+
const targetDir = path.resolve(args[0] || "my_plugin");
|
|
190
|
+
const pluginId = toSafeId(path.basename(targetDir));
|
|
197
191
|
const displayName = toDisplayName(pluginId) || "My Plugin";
|
|
198
192
|
const className = displayName.replace(/[^a-zA-Z0-9]/g, "") || "MyPlugin";
|
|
199
193
|
|