term-anywhere 0.1.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.js +53 -0
- package/package.json +31 -0
- package/postinstall.js +15 -0
package/bin.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const { existsSync } = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const PLATFORMS = {
|
|
8
|
+
"darwin-arm64": "term-anywhere-darwin-arm64",
|
|
9
|
+
"darwin-x64": "term-anywhere-darwin-x64",
|
|
10
|
+
"linux-x64": "term-anywhere-linux-x64",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
14
|
+
const pkg = PLATFORMS[platformKey];
|
|
15
|
+
|
|
16
|
+
if (!pkg) {
|
|
17
|
+
console.error(`Unsupported platform: ${platformKey}`);
|
|
18
|
+
console.error(`Supported platforms: ${Object.keys(PLATFORMS).join(", ")}`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Try to find the binary in node_modules
|
|
23
|
+
const binName = process.platform === "win32" ? "term-anywhere.exe" : "term-anywhere";
|
|
24
|
+
const possiblePaths = [
|
|
25
|
+
// When installed as a dependency
|
|
26
|
+
path.join(__dirname, "node_modules", pkg, "bin", binName),
|
|
27
|
+
// When installed globally or in a workspace
|
|
28
|
+
path.join(__dirname, "..", pkg, "bin", binName),
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
let binPath = null;
|
|
32
|
+
for (const p of possiblePaths) {
|
|
33
|
+
if (existsSync(p)) {
|
|
34
|
+
binPath = p;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!binPath) {
|
|
40
|
+
console.error(`Could not find term-anywhere binary for ${platformKey}`);
|
|
41
|
+
console.error("Searched paths:");
|
|
42
|
+
possiblePaths.forEach((p) => console.error(` - ${p}`));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
48
|
+
} catch (err) {
|
|
49
|
+
if (err.status !== undefined) {
|
|
50
|
+
process.exit(err.status);
|
|
51
|
+
}
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "term-anywhere",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Remote terminal access from your mobile device",
|
|
5
|
+
"bin": {
|
|
6
|
+
"term-anywhere": "bin.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node postinstall.js"
|
|
10
|
+
},
|
|
11
|
+
"optionalDependencies": {
|
|
12
|
+
"term-anywhere-darwin-arm64": "0.1.0",
|
|
13
|
+
"term-anywhere-darwin-x64": "0.1.0",
|
|
14
|
+
"term-anywhere-linux-x64": "0.1.0"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/ryanhill4L/term-anywhere"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"terminal",
|
|
22
|
+
"remote",
|
|
23
|
+
"cli",
|
|
24
|
+
"pty"
|
|
25
|
+
],
|
|
26
|
+
"author": "Ryan Hill",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=14"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Verify the correct platform package was installed
|
|
2
|
+
const PLATFORMS = {
|
|
3
|
+
"darwin-arm64": "term-anywhere-darwin-arm64",
|
|
4
|
+
"darwin-x64": "term-anywhere-darwin-x64",
|
|
5
|
+
"linux-x64": "term-anywhere-linux-x64",
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
9
|
+
const pkg = PLATFORMS[platformKey];
|
|
10
|
+
|
|
11
|
+
if (!pkg) {
|
|
12
|
+
console.warn(`\n⚠️ term-anywhere: No pre-built binary for ${platformKey}`);
|
|
13
|
+
console.warn(` Supported platforms: ${Object.keys(PLATFORMS).join(", ")}`);
|
|
14
|
+
console.warn(` You may need to build from source.\n`);
|
|
15
|
+
}
|