termweb 0.9.6 → 0.9.7

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/termweb.js CHANGED
@@ -27,11 +27,11 @@ if (!platformName || !archName) {
27
27
  }
28
28
 
29
29
  const binaryName = `termweb-${platformName}-${archName}`;
30
- const binaryPath = path.join(__dirname, '..', 'binaries', binaryName);
30
+ const binaryPath = path.join(__dirname, '..', 'native', binaryName);
31
31
 
32
32
  if (!fs.existsSync(binaryPath)) {
33
33
  console.error(`Binary not found: ${binaryPath}`);
34
- console.error('Run `npm run postinstall` to download the binary.');
34
+ console.error('Please reinstall: npm install termweb');
35
35
  process.exit(1);
36
36
  }
37
37
 
package/lib/index.js CHANGED
@@ -15,12 +15,10 @@ const arch = process.arch === 'arm64' ? 'aarch64' : 'x86_64';
15
15
 
16
16
  // Try multiple locations for native module
17
17
  const searchPaths = [
18
+ // Bundled: native/termweb-{platform}-{arch}.node
19
+ path.join(__dirname, '..', 'native', `termweb-${platform}-${arch}.node`),
18
20
  // Development: zig-out/lib/termweb.node
19
21
  path.join(__dirname, '..', 'zig-out', 'lib', 'termweb.node'),
20
- // Installed: native/termweb-{platform}-{arch}.node
21
- path.join(__dirname, '..', 'native', `termweb-${platform}-${arch}.node`),
22
- // Fallback: native/termweb.node
23
- path.join(__dirname, '..', 'native', 'termweb.node'),
24
22
  ];
25
23
 
26
24
  let native = null;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,19 +1,18 @@
1
1
  {
2
2
  "name": "termweb",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "Web browser in your terminal using Kitty graphics protocol. SDK for building terminal apps with web technologies.",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
7
7
  "termweb": "bin/termweb.js"
8
8
  },
9
9
  "scripts": {
10
- "postinstall": "node scripts/install.js",
11
10
  "build:all": "bash scripts/build-all.sh"
12
11
  },
13
12
  "files": [
14
13
  "bin/",
15
14
  "lib/",
16
- "scripts/install.js",
15
+ "native/",
17
16
  "README.md"
18
17
  ],
19
18
  "keywords": [
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const https = require('https');
4
- const fs = require('fs');
5
- const path = require('path');
6
- const { execSync } = require('child_process');
7
-
8
- const VERSION = require('../package.json').version;
9
- const REPO = 'teamchong/termweb';
10
-
11
- const platform = process.platform;
12
- const arch = process.arch;
13
-
14
- const platformMap = {
15
- darwin: 'macos',
16
- linux: 'linux',
17
- };
18
-
19
- const archMap = {
20
- x64: 'x86_64',
21
- arm64: 'aarch64',
22
- };
23
-
24
- const platformName = platformMap[platform];
25
- const archName = archMap[arch];
26
-
27
- if (!platformName || !archName) {
28
- console.error(`Unsupported platform: ${platform}-${arch}`);
29
- console.error('termweb only supports macOS and Linux on x64 and arm64.');
30
- process.exit(1);
31
- }
32
-
33
- const binaryName = `termweb-${platformName}-${archName}`;
34
- const binariesDir = path.join(__dirname, '..', 'binaries');
35
- const binaryPath = path.join(binariesDir, binaryName);
36
-
37
- // Create binaries directory
38
- if (!fs.existsSync(binariesDir)) {
39
- fs.mkdirSync(binariesDir, { recursive: true });
40
- }
41
-
42
- // Check if binary already exists
43
- if (fs.existsSync(binaryPath)) {
44
- console.log(`termweb binary already installed at ${binaryPath}`);
45
- process.exit(0);
46
- }
47
-
48
- // Download URL from GitHub releases
49
- const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
50
-
51
- console.log(`Downloading termweb for ${platformName}-${archName}...`);
52
- console.log(`URL: ${downloadUrl}`);
53
-
54
- function download(url, dest) {
55
- return new Promise((resolve, reject) => {
56
- const file = fs.createWriteStream(dest);
57
-
58
- const request = https.get(url, (response) => {
59
- // Handle redirects
60
- if (response.statusCode === 301 || response.statusCode === 302) {
61
- file.close();
62
- fs.unlinkSync(dest);
63
- return download(response.headers.location, dest).then(resolve).catch(reject);
64
- }
65
-
66
- if (response.statusCode !== 200) {
67
- file.close();
68
- fs.unlinkSync(dest);
69
- reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
70
- return;
71
- }
72
-
73
- response.pipe(file);
74
-
75
- file.on('finish', () => {
76
- file.close();
77
- resolve();
78
- });
79
- });
80
-
81
- request.on('error', (err) => {
82
- file.close();
83
- fs.unlink(dest, () => {}); // Delete partial file
84
- reject(err);
85
- });
86
-
87
- file.on('error', (err) => {
88
- file.close();
89
- fs.unlink(dest, () => {});
90
- reject(err);
91
- });
92
- });
93
- }
94
-
95
- async function main() {
96
- try {
97
- await download(downloadUrl, binaryPath);
98
-
99
- // Make executable
100
- fs.chmodSync(binaryPath, 0o755);
101
-
102
- console.log(`Successfully installed termweb to ${binaryPath}`);
103
- } catch (err) {
104
- console.error(`Failed to download termweb: ${err.message}`);
105
- console.error('');
106
- console.error('You can manually build from source:');
107
- console.error(' git clone https://github.com/' + REPO);
108
- console.error(' cd termweb && zig build');
109
- process.exit(1);
110
- }
111
- }
112
-
113
- main();