loupedeck-commander 1.2.3 → 1.2.4

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.
@@ -1,47 +1,53 @@
1
- import { exec } from 'child_process'
2
- //import { exec } from 'node:child_process'
3
- import { BaseIf } from './baseif.mjs'
4
-
5
- /**
6
- * Our Special-Handler just used the Default - and adds Vibration after triggers through Button-Releases
7
- */
8
- export class SHELLif extends BaseIf {
9
- async call (cmd, options = {}) {
10
- cmd = super.call(cmd, options)
11
- return await this.sh(cmd)
12
- }
13
-
14
- async stop(){
15
- this.LogInfo("SHELLif: Stopping")
16
- }
17
-
18
- Check(options) {
19
- var res= super.Check(options)
20
- if (res <0)
21
- return res
22
- }
23
-
24
- /**
25
- * Run a Shell command in ASYNC mode
26
- * @param {*} cmd
27
- * @returns
28
- */
29
- async sh (cmd) {
30
- let self = this;
31
- this.LogDebug(`ShellIf: runCmd: ${cmd}\n`)
32
-
33
- return new Promise(function (resolve, reject) {
34
- exec(cmd, (err, stdout, stderr) => {
35
- if (stdout.length>0)
36
- self.LogInfo(`SHELLif Out: ${stdout}`)
37
- if (stderr.length>0)
38
- self.LogError(`SHELLif Err: ${stderr}`)
39
- if (err) {
40
- reject(err)
41
- } else {
42
- resolve({ stdout, stderr })
43
- }
44
- })
45
- })
46
- }
47
- }
1
+ import { exec } from 'child_process'
2
+ //import { exec } from 'node:child_process'
3
+ import { BaseIf } from './baseif.mjs'
4
+
5
+ /**
6
+ * Our Special-Handler just used the Default - and adds Vibration after triggers through Button-Releases
7
+ */
8
+ export class SHELLif extends BaseIf {
9
+ async call (cmd, options = {}) {
10
+ var res = this.Check(options)
11
+ if (res<0){
12
+ return false
13
+ }
14
+ let formattedCmd = super.call(cmd, options)
15
+ return await this.sh(formattedCmd)
16
+ }
17
+
18
+ async stop(){
19
+ this.LogInfo("SHELLif: Stopping")
20
+ }
21
+
22
+ Check(options) {
23
+ var res= super.Check(options)
24
+ if (res <0){
25
+ this.LogError(`SHELLif: mandatory parameter missing\n`)
26
+ return res
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Run a Shell command in ASYNC mode
32
+ * @param {*} cmd
33
+ * @returns
34
+ */
35
+ async sh (cmd) {
36
+ let self = this;
37
+ this.LogDebug(`ShellIf: runCmd: ${cmd}\n`)
38
+
39
+ return new Promise(function (resolve, reject) {
40
+ exec(cmd, (err, stdout, stderr) => {
41
+ if (stdout.length>0)
42
+ self.LogInfo(`SHELLif Out: ${stdout}`)
43
+ if (stderr.length>0)
44
+ self.LogError(`SHELLif Err: ${stderr}`)
45
+ if (err) {
46
+ reject(err)
47
+ } else {
48
+ resolve({ stdout, stderr })
49
+ }
50
+ })
51
+ })
52
+ }
53
+ }
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
- {
2
- "name": "loupedeck-commander",
3
- "version": "1.2.3",
4
- "description": "A system to ease working with LoupeDeck devices using CMD-line, OPC/UA or HTTP-client interfaces",
5
- "main": "index.mjs",
6
- "scripts": {
7
- "test": "node test.mjs",
8
- "start": "node index.mjs"
9
- },
10
- "dependencies": {
11
- "canvas": "^2.11.2",
12
- "loupedeck": "^6.0.1",
13
- "mkdirp": "^3.0.1",
14
- "node-opcua": "^2.138.1",
15
- "string-template": "^1.0.0"
16
- },
17
- "author": "Thomas Schneider",
18
- "license": "MIT",
19
- "repository": {
20
- "type": "git",
21
- "url": "git@gitlab.com:keckxde/loupedeck-commander.git"
22
- },
23
- "bugs": {
24
- "url": "https://gitlab.com/keckxde/loupedeck-commander/-/issues"
25
- },
26
- "devDependencies": {
27
- "eslint": "^9.8.0"
28
- }
29
- }
1
+ {
2
+ "name": "loupedeck-commander",
3
+ "version": "1.2.4",
4
+ "description": "A system to ease working with LoupeDeck devices using CMD-line, OPC/UA or HTTP-client interfaces",
5
+ "main": "index.mjs",
6
+ "scripts": {
7
+ "test": "node test.mjs",
8
+ "start": "node index.mjs"
9
+ },
10
+ "dependencies": {
11
+ "canvas": "^2.11.2",
12
+ "loupedeck": "^6.0.1",
13
+ "mkdirp": "^3.0.1",
14
+ "node-opcua": "^2.138.1",
15
+ "string-template": "^1.0.0"
16
+ },
17
+ "author": "Thomas Schneider",
18
+ "license": "Apache-2.0",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git@gitlab.com:keckxde/loupedeck-commander.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://gitlab.com/keckxde/loupedeck-commander/-/issues"
25
+ },
26
+ "devDependencies": {
27
+ "eslint": "^9.16.0"
28
+ }
29
+ }