pty-wrap 1.0.0 → 1.0.1
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/package.json +4 -2
- package/scripts/postinstall.js +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pty-wrap",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "PTY wrapper for capturing terminal sessions via MQTT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
+
"scripts",
|
|
12
13
|
"README.md",
|
|
13
14
|
"LICENSE"
|
|
14
15
|
],
|
|
@@ -16,7 +17,8 @@
|
|
|
16
17
|
"start": "node --loader ts-node/esm src/index.ts",
|
|
17
18
|
"build": "tsc",
|
|
18
19
|
"dev": "node --loader ts-node/esm --watch src/index.ts",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
20
|
+
"prepublishOnly": "npm run build",
|
|
21
|
+
"postinstall": "node scripts/postinstall.js"
|
|
20
22
|
},
|
|
21
23
|
"keywords": ["pty", "terminal", "session", "capture", "mqtt", "cli"],
|
|
22
24
|
"license": "MIT",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { chmod, access, constants } from 'fs/promises';
|
|
3
|
+
import { join, dirname } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { platform, arch } from 'os';
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
async function fixSpawnHelperPermissions() {
|
|
10
|
+
const os = platform();
|
|
11
|
+
const cpu = arch();
|
|
12
|
+
|
|
13
|
+
if (os !== 'darwin' && os !== 'linux') return;
|
|
14
|
+
|
|
15
|
+
const platformDir = `${os}-${cpu}`;
|
|
16
|
+
const spawnHelper = join(__dirname, '..', 'node_modules', 'node-pty', 'prebuilds', platformDir, 'spawn-helper');
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
await access(spawnHelper, constants.F_OK);
|
|
20
|
+
await chmod(spawnHelper, 0o755);
|
|
21
|
+
} catch {}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fixSpawnHelperPermissions();
|