mqtt-mirror 0.3.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/bin/mqtt-mirror +45 -0
- package/package.json +29 -0
package/bin/mqtt-mirror
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const PLATFORMS = {
|
|
7
|
+
"linux-x64": "@mqtt-mirror/linux-x64",
|
|
8
|
+
"linux-arm64": "@mqtt-mirror/linux-arm64",
|
|
9
|
+
"darwin-x64": "@mqtt-mirror/darwin-x64",
|
|
10
|
+
"darwin-arm64": "@mqtt-mirror/darwin-arm64",
|
|
11
|
+
"win32-x64": "@mqtt-mirror/win32-x64",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
15
|
+
const pkg = PLATFORMS[platformKey];
|
|
16
|
+
|
|
17
|
+
if (!pkg) {
|
|
18
|
+
console.error(
|
|
19
|
+
`mqtt-mirror: unsupported platform ${process.platform} ${process.arch}`
|
|
20
|
+
);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const bin = process.platform === "win32" ? "mqtt-mirror.exe" : "mqtt-mirror";
|
|
25
|
+
|
|
26
|
+
let binPath;
|
|
27
|
+
try {
|
|
28
|
+
binPath = path.join(path.dirname(require.resolve(`${pkg}/package.json`)), bin);
|
|
29
|
+
} catch {
|
|
30
|
+
console.error(
|
|
31
|
+
`mqtt-mirror: could not find package ${pkg}. Make sure optional dependencies are installed.`
|
|
32
|
+
);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const result = execFileSync(binPath, process.argv.slice(2), {
|
|
38
|
+
stdio: "inherit",
|
|
39
|
+
});
|
|
40
|
+
} catch (e) {
|
|
41
|
+
if (e.status !== null) {
|
|
42
|
+
process.exit(e.status);
|
|
43
|
+
}
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mqtt-mirror",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Replicate MQTT traffic from one broker to another",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mqtt-mirror": "bin/mqtt-mirror"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/mqtt-mirror"
|
|
11
|
+
],
|
|
12
|
+
"optionalDependencies": {
|
|
13
|
+
"@mqtt-mirror/linux-x64": "0.3.0",
|
|
14
|
+
"@mqtt-mirror/linux-arm64": "0.3.0",
|
|
15
|
+
"@mqtt-mirror/darwin-x64": "0.3.0",
|
|
16
|
+
"@mqtt-mirror/darwin-arm64": "0.3.0",
|
|
17
|
+
"@mqtt-mirror/win32-x64": "0.3.0"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/4nte/mqtt-mirror"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"mqtt",
|
|
25
|
+
"mirror",
|
|
26
|
+
"broker",
|
|
27
|
+
"replication"
|
|
28
|
+
]
|
|
29
|
+
}
|