@elgato/cli 1.5.0 → 1.6.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/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import chalk6 from "chalk";
|
|
|
10
10
|
|
|
11
11
|
// src/validation/entry.ts
|
|
12
12
|
import chalk from "chalk";
|
|
13
|
-
import { EOL } from "
|
|
13
|
+
import { EOL } from "os";
|
|
14
14
|
var ValidationEntry = class {
|
|
15
15
|
/**
|
|
16
16
|
* Initializes a new instance of the {@link ValidationEntry} class.
|
|
@@ -295,10 +295,10 @@ var ValidationContext = class {
|
|
|
295
295
|
};
|
|
296
296
|
|
|
297
297
|
// src/validation/plugin/plugin.ts
|
|
298
|
-
import { basename, dirname, join, resolve } from "
|
|
298
|
+
import { basename as basename2, dirname, join as join2, resolve as resolve2 } from "path";
|
|
299
299
|
|
|
300
300
|
// src/json/file-context.ts
|
|
301
|
-
import { existsSync, readFileSync } from "
|
|
301
|
+
import { existsSync, readFileSync } from "fs";
|
|
302
302
|
|
|
303
303
|
// src/json/map.ts
|
|
304
304
|
var JsonObjectMap = class {
|
|
@@ -648,7 +648,9 @@ function getComparison(comparison) {
|
|
|
648
648
|
|
|
649
649
|
// src/stream-deck.ts
|
|
650
650
|
import find from "find-process";
|
|
651
|
-
import {
|
|
651
|
+
import { readdirSync, readlinkSync } from "fs";
|
|
652
|
+
import os from "os";
|
|
653
|
+
import { basename, join, resolve } from "path";
|
|
652
654
|
function isPredefinedLayoutLike(value) {
|
|
653
655
|
return value.startsWith("$") === true && !value.endsWith(".json");
|
|
654
656
|
}
|
|
@@ -662,11 +664,11 @@ function isValidPluginId(uuid) {
|
|
|
662
664
|
// src/validation/plugin/plugin.ts
|
|
663
665
|
var directorySuffix = ".sdPlugin";
|
|
664
666
|
async function createContext(path) {
|
|
665
|
-
const id =
|
|
667
|
+
const id = basename2(path).replace(/\.sdPlugin$/, "");
|
|
666
668
|
const { manifest, layout } = await import("@elgato/schemas/streamdeck/plugins/json");
|
|
667
669
|
return {
|
|
668
670
|
hasValidId: isValidPluginId(id),
|
|
669
|
-
manifest: new ManifestJsonFileContext(
|
|
671
|
+
manifest: new ManifestJsonFileContext(join2(path, "manifest.json"), manifest, layout),
|
|
670
672
|
id
|
|
671
673
|
};
|
|
672
674
|
}
|
|
@@ -686,7 +688,7 @@ var ManifestJsonFileContext = class extends JsonFileContext {
|
|
|
686
688
|
const compiledLayoutSchema = new JsonSchema(layoutSchema);
|
|
687
689
|
this.value.Actions?.forEach((action) => {
|
|
688
690
|
if (action.Encoder?.layout !== void 0 && !isPredefinedLayoutLike(action.Encoder?.layout.value)) {
|
|
689
|
-
const filePath =
|
|
691
|
+
const filePath = resolve2(dirname(path), action.Encoder.layout.value);
|
|
690
692
|
this.layoutFiles.push({
|
|
691
693
|
location: action.Encoder.layout.location,
|
|
692
694
|
layout: new JsonFileContext(filePath, compiledLayoutSchema)
|
|
@@ -762,7 +764,7 @@ var layoutItemKeysAreUnique = rule(function(plugin) {
|
|
|
762
764
|
});
|
|
763
765
|
|
|
764
766
|
// src/validation/plugin/rules/layout-schema.ts
|
|
765
|
-
import { existsSync as existsSync2 } from "
|
|
767
|
+
import { existsSync as existsSync2 } from "fs";
|
|
766
768
|
var layoutsExistAndSchemasAreValid = rule(function(plugin) {
|
|
767
769
|
plugin.manifest.layoutFiles.forEach(({ layout, location }) => {
|
|
768
770
|
if (!existsSync2(layout.path)) {
|
|
@@ -807,8 +809,8 @@ var categoryMatchesName = rule(function(plugin) {
|
|
|
807
809
|
});
|
|
808
810
|
|
|
809
811
|
// src/validation/plugin/rules/manifest-files-exist.ts
|
|
810
|
-
import { existsSync as existsSync4 } from "
|
|
811
|
-
import { basename as
|
|
812
|
+
import { existsSync as existsSync4 } from "fs";
|
|
813
|
+
import { basename as basename4, extname, join as join4, resolve as resolve4 } from "path";
|
|
812
814
|
|
|
813
815
|
// src/system/fs.ts
|
|
814
816
|
import ignore from "ignore";
|
|
@@ -819,16 +821,18 @@ import {
|
|
|
819
821
|
existsSync as existsSync3,
|
|
820
822
|
lstatSync,
|
|
821
823
|
mkdirSync,
|
|
822
|
-
readlinkSync,
|
|
824
|
+
readlinkSync as readlinkSync2,
|
|
823
825
|
rmSync
|
|
824
|
-
} from "
|
|
825
|
-
import {
|
|
826
|
-
import {
|
|
826
|
+
} from "fs";
|
|
827
|
+
import { lstat, mkdir, readdir, readFile } from "fs/promises";
|
|
828
|
+
import { platform } from "os";
|
|
829
|
+
import { basename as basename3, join as join3, resolve as resolve3 } from "path";
|
|
830
|
+
import { createInterface } from "readline";
|
|
827
831
|
var streamDeckIgnoreFilename = ".sdignore";
|
|
828
832
|
var defaultIgnorePatterns = [streamDeckIgnoreFilename, ".git", "/.env*", "*.log", "*.js.map"];
|
|
829
833
|
async function getIgnores(path, defaultPatterns = defaultIgnorePatterns) {
|
|
830
834
|
const i = ignore().add(defaultPatterns);
|
|
831
|
-
const file =
|
|
835
|
+
const file = join3(path, streamDeckIgnoreFilename);
|
|
832
836
|
if (existsSync3(file)) {
|
|
833
837
|
const fileStream = createReadStream(file);
|
|
834
838
|
try {
|
|
@@ -850,7 +854,7 @@ async function getIgnores(path, defaultPatterns = defaultIgnorePatterns) {
|
|
|
850
854
|
var manifestFilesExist = rule(async function(plugin) {
|
|
851
855
|
const missingHighRes = /* @__PURE__ */ new Set();
|
|
852
856
|
const ignores = await getIgnores(this.path);
|
|
853
|
-
if (ignores(
|
|
857
|
+
if (ignores(basename4(plugin.manifest.path))) {
|
|
854
858
|
this.addError(plugin.manifest.path, "Manifest file must not be ignored", {
|
|
855
859
|
suggestion: `Review ${streamDeckIgnoreFilename} file`
|
|
856
860
|
});
|
|
@@ -873,7 +877,7 @@ var manifestFilesExist = rule(async function(plugin) {
|
|
|
873
877
|
const possiblePaths = typeof opts === "object" && !opts.includeExtension ? opts.extensions.map((ext) => `${node.value}${ext}`) : [node.value];
|
|
874
878
|
let resolvedPath = void 0;
|
|
875
879
|
for (const possiblePath of possiblePaths) {
|
|
876
|
-
const path =
|
|
880
|
+
const path = resolve4(this.path, possiblePath);
|
|
877
881
|
if (existsSync4(path)) {
|
|
878
882
|
if (resolvedPath !== void 0) {
|
|
879
883
|
this.addWarning(
|
|
@@ -901,11 +905,11 @@ var manifestFilesExist = rule(async function(plugin) {
|
|
|
901
905
|
return;
|
|
902
906
|
}
|
|
903
907
|
if (extname(resolvedPath) === ".png") {
|
|
904
|
-
const fullPath =
|
|
908
|
+
const fullPath = join4(this.path, resolvedPath);
|
|
905
909
|
if (missingHighRes.has(fullPath)) {
|
|
906
910
|
return;
|
|
907
911
|
}
|
|
908
|
-
if (!existsSync4(
|
|
912
|
+
if (!existsSync4(join4(this.path, `${node.value}@2x.png`))) {
|
|
909
913
|
this.addWarning(fullPath, "should have high-resolution (@2x) variant", {
|
|
910
914
|
location: {
|
|
911
915
|
key: node.location.key
|
|
@@ -918,7 +922,7 @@ var manifestFilesExist = rule(async function(plugin) {
|
|
|
918
922
|
});
|
|
919
923
|
|
|
920
924
|
// src/validation/plugin/rules/manifest-schema.ts
|
|
921
|
-
import { existsSync as existsSync5 } from "
|
|
925
|
+
import { existsSync as existsSync5 } from "fs";
|
|
922
926
|
var manifestExistsAndSchemaIsValid = rule(function(plugin) {
|
|
923
927
|
if (!existsSync5(this.path)) {
|
|
924
928
|
return;
|
|
@@ -1006,10 +1010,10 @@ var manifestUuids = rule(async function(plugin) {
|
|
|
1006
1010
|
});
|
|
1007
1011
|
|
|
1008
1012
|
// src/validation/plugin/rules/path-input.ts
|
|
1009
|
-
import { existsSync as existsSync6, lstatSync as lstatSync2 } from "
|
|
1010
|
-
import { basename as
|
|
1013
|
+
import { existsSync as existsSync6, lstatSync as lstatSync2 } from "fs";
|
|
1014
|
+
import { basename as basename5 } from "path";
|
|
1011
1015
|
var pathIsDirectoryAndUuid = rule(function(plugin) {
|
|
1012
|
-
const name =
|
|
1016
|
+
const name = basename5(this.path);
|
|
1013
1017
|
if (!existsSync6(this.path)) {
|
|
1014
1018
|
this.addError(this.path, "Directory not found");
|
|
1015
1019
|
return;
|
package/package.json
CHANGED
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"CodePath": "bin/plugin.js",
|
|
26
26
|
"Description": <%- JSON.stringify(description) %>,
|
|
27
27
|
"Icon": "imgs/plugin/marketplace",
|
|
28
|
-
"SDKVersion":
|
|
28
|
+
"SDKVersion": 3,
|
|
29
29
|
"Software": {
|
|
30
|
-
"MinimumVersion": "6.
|
|
30
|
+
"MinimumVersion": "6.9"
|
|
31
31
|
},
|
|
32
32
|
"OS": [
|
|
33
33
|
{
|
package/template/src/plugin.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import streamDeck
|
|
1
|
+
import streamDeck from "@elgato/streamdeck";
|
|
2
2
|
|
|
3
3
|
import { IncrementCounter } from "./actions/increment-counter";
|
|
4
4
|
|
|
5
5
|
// We can enable "trace" logging so that all messages between the Stream Deck, and the plugin are recorded. When storing sensitive information
|
|
6
|
-
streamDeck.logger.setLevel(
|
|
6
|
+
streamDeck.logger.setLevel("trace");
|
|
7
7
|
|
|
8
8
|
// Register the increment action.
|
|
9
9
|
streamDeck.actions.registerAction(new IncrementCounter());
|