tova 0.4.2 → 0.4.3
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/tova.js +49 -3
- package/package.json +1 -1
- package/src/version.js +1 -1
package/bin/tova.js
CHANGED
|
@@ -4495,9 +4495,9 @@ async function upgradeCommand() {
|
|
|
4495
4495
|
}
|
|
4496
4496
|
|
|
4497
4497
|
if (!ghTag) {
|
|
4498
|
-
// No newer binary release
|
|
4499
|
-
console.log(` ${color.dim('No binary release for v' + latestVersion + ' yet.
|
|
4500
|
-
await
|
|
4498
|
+
// No newer binary release — install from npm tarball directly
|
|
4499
|
+
console.log(` ${color.dim('No binary release for v' + latestVersion + ' yet. Installing from npm...')}`);
|
|
4500
|
+
await npmTarballUpgrade(latestVersion);
|
|
4501
4501
|
return;
|
|
4502
4502
|
}
|
|
4503
4503
|
|
|
@@ -4587,6 +4587,52 @@ async function npmUpgrade(latestVersion) {
|
|
|
4587
4587
|
}
|
|
4588
4588
|
}
|
|
4589
4589
|
|
|
4590
|
+
async function npmTarballUpgrade(latestVersion) {
|
|
4591
|
+
const installDir = join(process.env.HOME || '', '.tova');
|
|
4592
|
+
const binDir = join(installDir, 'bin');
|
|
4593
|
+
const libDir = join(installDir, 'lib');
|
|
4594
|
+
mkdirSync(libDir, { recursive: true });
|
|
4595
|
+
|
|
4596
|
+
// Download npm tarball
|
|
4597
|
+
const tarballUrl = `https://registry.npmjs.org/tova/-/tova-${latestVersion}.tgz`;
|
|
4598
|
+
const tarballPath = join(installDir, 'tova.tgz');
|
|
4599
|
+
|
|
4600
|
+
const dlResult = await downloadWithProgress(tarballUrl, tarballPath);
|
|
4601
|
+
if (!dlResult) {
|
|
4602
|
+
console.error(color.red(' Failed to download npm package. Try manually: bun add -g tova@latest'));
|
|
4603
|
+
process.exit(1);
|
|
4604
|
+
}
|
|
4605
|
+
|
|
4606
|
+
// Extract tarball into lib dir
|
|
4607
|
+
console.log(' Extracting...');
|
|
4608
|
+
const { spawnSync: spawnTar } = await import('child_process');
|
|
4609
|
+
rmSync(libDir, { recursive: true, force: true });
|
|
4610
|
+
mkdirSync(libDir, { recursive: true });
|
|
4611
|
+
const tarResult = spawnTar('tar', ['-xzf', tarballPath, '-C', libDir, '--strip-components=1'], { stdio: 'pipe' });
|
|
4612
|
+
rmSync(tarballPath, { force: true });
|
|
4613
|
+
if (tarResult.status !== 0) {
|
|
4614
|
+
console.error(color.red(' Failed to extract package. Try manually: bun add -g tova@latest'));
|
|
4615
|
+
process.exit(1);
|
|
4616
|
+
}
|
|
4617
|
+
|
|
4618
|
+
// Create wrapper script at ~/.tova/bin/tova
|
|
4619
|
+
const libBin = join(libDir, 'bin', 'tova.js');
|
|
4620
|
+
const wrapperScript = `#!/bin/sh\nexec bun "${libBin}" "$@"\n`;
|
|
4621
|
+
const binPath = join(binDir, 'tova');
|
|
4622
|
+
writeFileSync(binPath, wrapperScript);
|
|
4623
|
+
chmodSync(binPath, 0o755);
|
|
4624
|
+
|
|
4625
|
+
// Verify
|
|
4626
|
+
console.log(' Verifying...');
|
|
4627
|
+
const verifyProc = spawnTar(binPath, ['--version'], { timeout: 10000 });
|
|
4628
|
+
if (verifyProc.status !== 0) {
|
|
4629
|
+
console.error(color.red(' Verification failed. Try manually: bun add -g tova@latest'));
|
|
4630
|
+
process.exit(1);
|
|
4631
|
+
}
|
|
4632
|
+
|
|
4633
|
+
console.log(`\n ${color.green('✓')} Upgraded: v${VERSION} -> ${color.bold('v' + latestVersion)}\n`);
|
|
4634
|
+
}
|
|
4635
|
+
|
|
4590
4636
|
function detectPackageManager() {
|
|
4591
4637
|
if (typeof Bun !== 'undefined') return 'bun';
|
|
4592
4638
|
const ua = process.env.npm_config_user_agent || '';
|
package/package.json
CHANGED
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by scripts/embed-runtime.js — do not edit
|
|
2
|
-
export const VERSION = "0.4.
|
|
2
|
+
export const VERSION = "0.4.3";
|