claude-code-termux 1.0.5 → 1.0.6
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 +1 -1
- package/postinstall.js +38 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-termux",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Claude Code CLI with Termux/Android compatibility fixes - a wrapper that patches issues with Sharp, ripgrep, and path resolution on ARM64 Android",
|
|
5
5
|
"author": "Jimoh Ovbiagele <findingjimoh@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
package/postinstall.js
CHANGED
|
@@ -172,7 +172,7 @@ function setupOAuthStorage() {
|
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
174
|
* Install Sharp WASM for image support on Termux
|
|
175
|
-
*
|
|
175
|
+
* Downloads tarball directly to bypass npm platform restrictions
|
|
176
176
|
*/
|
|
177
177
|
function installSharpWasm() {
|
|
178
178
|
if (!isTermux) {
|
|
@@ -181,25 +181,49 @@ function installSharpWasm() {
|
|
|
181
181
|
|
|
182
182
|
console.log('[claude-code-termux] Installing Sharp WASM for image support...');
|
|
183
183
|
|
|
184
|
+
const nodeModulesDir = path.join(__dirname, 'node_modules', '@img');
|
|
185
|
+
const sharpWasmDir = path.join(nodeModulesDir, 'sharp-wasm32');
|
|
186
|
+
|
|
187
|
+
// Check if already installed
|
|
188
|
+
if (fs.existsSync(path.join(sharpWasmDir, 'package.json'))) {
|
|
189
|
+
console.log('[claude-code-termux] Sharp WASM already installed');
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
184
193
|
try {
|
|
185
|
-
//
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
console.log('[claude-code-termux] Sharp WASM already installed');
|
|
189
|
-
return;
|
|
190
|
-
} catch (e) {
|
|
191
|
-
// Not installed, proceed
|
|
194
|
+
// Create directory structure
|
|
195
|
+
if (!fs.existsSync(nodeModulesDir)) {
|
|
196
|
+
fs.mkdirSync(nodeModulesDir, { recursive: true });
|
|
192
197
|
}
|
|
193
198
|
|
|
194
|
-
//
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
// Download tarball directly (bypasses npm platform checks)
|
|
200
|
+
const tarballUrl = 'https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.5.tgz';
|
|
201
|
+
const tmpTar = path.join(__dirname, 'sharp-wasm32.tgz');
|
|
202
|
+
|
|
203
|
+
console.log('[claude-code-termux] Downloading Sharp WASM from npm registry...');
|
|
204
|
+
execSync(`curl -sL "${tarballUrl}" -o "${tmpTar}"`, { stdio: 'inherit' });
|
|
205
|
+
|
|
206
|
+
// Extract to node_modules/@img/sharp-wasm32
|
|
207
|
+
// npm tarballs have a 'package/' prefix inside
|
|
208
|
+
execSync(`tar -xzf "${tmpTar}" -C "${nodeModulesDir}"`, { stdio: 'inherit' });
|
|
209
|
+
|
|
210
|
+
// Rename 'package' to 'sharp-wasm32'
|
|
211
|
+
const extractedDir = path.join(nodeModulesDir, 'package');
|
|
212
|
+
if (fs.existsSync(extractedDir)) {
|
|
213
|
+
if (fs.existsSync(sharpWasmDir)) {
|
|
214
|
+
fs.rmSync(sharpWasmDir, { recursive: true, force: true });
|
|
215
|
+
}
|
|
216
|
+
fs.renameSync(extractedDir, sharpWasmDir);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Cleanup
|
|
220
|
+
fs.unlinkSync(tmpTar);
|
|
221
|
+
|
|
199
222
|
console.log('[claude-code-termux] Sharp WASM installed successfully');
|
|
200
223
|
} catch (err) {
|
|
201
224
|
console.error('[claude-code-termux] Failed to install Sharp WASM:', err.message);
|
|
202
|
-
console.log('[claude-code-termux]
|
|
225
|
+
console.log('[claude-code-termux] Image reading may not work. You can try manually:');
|
|
226
|
+
console.log(' curl -sL https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.5.tgz | tar -xz -C node_modules/@img/ && mv node_modules/@img/package node_modules/@img/sharp-wasm32');
|
|
203
227
|
}
|
|
204
228
|
}
|
|
205
229
|
|