@just-every/code 0.2.35 → 0.2.36
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 +26 -4
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -186,8 +186,8 @@ async function main() {
|
|
|
186
186
|
const packageJson = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'));
|
|
187
187
|
const version = packageJson.version;
|
|
188
188
|
|
|
189
|
-
//
|
|
190
|
-
const binaries = ['code'
|
|
189
|
+
// Download only the primary binary; we'll create wrappers for legacy names.
|
|
190
|
+
const binaries = ['code'];
|
|
191
191
|
|
|
192
192
|
console.log(`Installing @just-every/code v${version} for ${targetTriple}...`);
|
|
193
193
|
|
|
@@ -283,7 +283,7 @@ async function main() {
|
|
|
283
283
|
// Continue with other binaries even if one fails
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
|
|
286
|
+
|
|
287
287
|
// Create platform-specific symlink/copy for main binary
|
|
288
288
|
const mainBinary = `code-${targetTriple}${binaryExt}`;
|
|
289
289
|
const mainBinaryPath = join(binDir, mainBinary);
|
|
@@ -312,7 +312,7 @@ async function main() {
|
|
|
312
312
|
console.warn('⚠ Main code binary not found. You may need to build from source.');
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
// With bin name = 'code', handle collisions
|
|
315
|
+
// With bin name = 'code', handle collisions (e.g., VS Code) and add legacy wrappers
|
|
316
316
|
try {
|
|
317
317
|
const isTTY = process.stdout && process.stdout.isTTY;
|
|
318
318
|
const isWindows = platform() === 'win32';
|
|
@@ -339,6 +339,28 @@ async function main() {
|
|
|
339
339
|
const codeResolved = resolveOnPath('code');
|
|
340
340
|
const collision = codeResolved && ourShim && codeResolved !== ourShim;
|
|
341
341
|
|
|
342
|
+
const ensureWrapper = (name, args) => {
|
|
343
|
+
if (!globalBin) return;
|
|
344
|
+
try {
|
|
345
|
+
const wrapperPath = join(globalBin, isWindows ? `${name}.cmd` : name);
|
|
346
|
+
if (isWindows) {
|
|
347
|
+
const content = `@echo off\r\n"%~dp0${collision ? 'coder' : 'code'}" ${args} %*\r\n`;
|
|
348
|
+
writeFileSync(wrapperPath, content);
|
|
349
|
+
} else {
|
|
350
|
+
const content = `#!/bin/sh\nexec "$(dirname \"$0\")/${collision ? 'coder' : 'code'}" ${args} "$@"\n`;
|
|
351
|
+
writeFileSync(wrapperPath, content);
|
|
352
|
+
chmodSync(wrapperPath, 0o755);
|
|
353
|
+
}
|
|
354
|
+
console.log(`✓ Created wrapper '${name}' -> ${collision ? 'coder' : 'code'} ${args}`);
|
|
355
|
+
} catch (e) {
|
|
356
|
+
console.log(`⚠ Failed to create '${name}' wrapper: ${e.message}`);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
// Always create legacy wrappers so existing scripts keep working
|
|
361
|
+
ensureWrapper('code-tui', '');
|
|
362
|
+
ensureWrapper('code-exec', 'exec');
|
|
363
|
+
|
|
342
364
|
if (collision) {
|
|
343
365
|
console.log('⚠ Detected an existing `code` command on your PATH (likely VS Code).');
|
|
344
366
|
if (globalBin) {
|