lumia-plugin 0.2.5 → 0.2.7

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.
@@ -33,7 +33,7 @@ class ShowcasePluginTemplate extends Plugin {
33
33
  const actions = Array.isArray(config.actions) ? config.actions : [];
34
34
  for (const action of actions) {
35
35
  if (action?.type === "trigger_alert") {
36
- await this._triggerSampleAlert(action.data);
36
+ await this._triggerSampleAlert(action.value);
37
37
  }
38
38
  }
39
39
  }
@@ -5,6 +5,6 @@
5
5
  "description": "Internal template illustrating settings, actions, variables, and alerts for Lumia Stream plugins.",
6
6
  "main": "main.js",
7
7
  "dependencies": {
8
- "@lumiastream/plugin": "^0.2.5"
8
+ "@lumiastream/plugin": "^0.2.7"
9
9
  }
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumia-plugin",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Command-line tools for creating, building, and validating Lumia Stream plugins.",
5
5
  "bin": {
6
6
  "lumia-plugin": "scripts/cli.js"
@@ -24,7 +24,7 @@
24
24
  "author": "Lumia Stream",
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "@lumiastream/plugin": "^0.2.5",
27
+ "@lumiastream/plugin": "^0.2.7",
28
28
  "jszip": "3.10.1"
29
29
  }
30
30
  }
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  const path = require("path");
3
3
  const fs = require("fs");
4
+ const { spawnSync } = require("child_process");
4
5
  const {
5
6
  readManifest,
6
7
  validateManifest,
@@ -10,7 +11,7 @@ const {
10
11
 
11
12
  function parseArgs() {
12
13
  const args = process.argv.slice(2);
13
- const options = { dir: process.cwd(), outFile: null };
14
+ const options = { dir: process.cwd(), outFile: null, install: false };
14
15
  while (args.length) {
15
16
  const arg = args.shift();
16
17
  switch (arg) {
@@ -22,6 +23,10 @@ function parseArgs() {
22
23
  case "-o":
23
24
  options.outFile = path.resolve(args.shift() || "");
24
25
  break;
26
+ case "--install":
27
+ case "-i":
28
+ options.install = true;
29
+ break;
25
30
  case "--help":
26
31
  case "-h":
27
32
  printHelp();
@@ -48,6 +53,7 @@ Usage: npx lumia-plugin build [options]
48
53
  Options:
49
54
  --dir, -d Plugin directory (defaults to cwd)
50
55
  --out, -o Output file path (defaults to ./<id>-<version>.lumiaplugin)
56
+ --install, -i Run npm install before packaging
51
57
  --help, -h Show this help message
52
58
  `);
53
59
  }
@@ -64,6 +70,25 @@ async function main() {
64
70
  }
65
71
 
66
72
  try {
73
+ const packageJsonPath = path.join(pluginDir, "package.json");
74
+ if (fs.existsSync(packageJsonPath)) {
75
+ if (options.install) {
76
+ console.log("• Running npm install...");
77
+ const result = spawnSync("npm", ["install"], {
78
+ cwd: pluginDir,
79
+ stdio: "inherit",
80
+ });
81
+ if (result.status !== 0) {
82
+ console.error("✖ npm install failed. Aborting build.");
83
+ process.exit(1);
84
+ }
85
+ } else {
86
+ console.log("• Skipping npm install (use --install to enable).");
87
+ }
88
+ } else {
89
+ console.log("• No package.json found; skipping npm install.");
90
+ }
91
+
67
92
  const { manifest } = await readManifest(pluginDir);
68
93
  const errors = validateManifest(manifest);
69
94
  if (errors.length) {
@@ -72,10 +97,30 @@ async function main() {
72
97
  process.exit(1);
73
98
  }
74
99
 
100
+ const entryFile =
101
+ typeof manifest.main === "string" && manifest.main.trim()
102
+ ? manifest.main.trim()
103
+ : "main.js";
104
+ const entryPath = path.resolve(pluginDir, entryFile);
105
+ if (!fs.existsSync(entryPath)) {
106
+ console.error(`✖ Entry file not found: ${entryFile}`);
107
+ process.exit(1);
108
+ }
109
+
110
+ console.log(`• Running syntax check on ${entryFile}...`);
111
+ const checkResult = spawnSync("node", ["--check", entryPath], {
112
+ cwd: pluginDir,
113
+ stdio: "inherit",
114
+ });
115
+ if (checkResult.status !== 0) {
116
+ console.error("✖ Syntax check failed. Aborting build.");
117
+ process.exit(1);
118
+ }
119
+
75
120
  const files = await collectFiles(pluginDir);
76
121
  if (!files.length) {
77
122
  console.error(
78
- "✖ No files found to package (did you point to the plugin root?)"
123
+ "✖ No files found to package (did you point to the plugin root?)",
79
124
  );
80
125
  process.exit(1);
81
126
  }