mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-08 17:16:48 -07:00
fix(ui): added volta to auto update check (#27353)
This commit is contained in:
@@ -352,6 +352,30 @@ describe('getInstallationInfo', () => {
|
||||
expect(infoDisabled.updateMessage).toContain('Please run npm install');
|
||||
});
|
||||
|
||||
it('should detect Volta installation (Unix-style)', () => {
|
||||
const voltaPath =
|
||||
'/Users/test/.volta/tools/image/node/20.0.0/lib/node_modules/@google/gemini-cli/dist/index.js';
|
||||
process.argv[1] = voltaPath;
|
||||
mockedRealPathSync.mockReturnValue(voltaPath);
|
||||
|
||||
const info = getInstallationInfo(projectRoot, true);
|
||||
|
||||
expect(info.packageManager).toBe(PackageManager.VOLTA);
|
||||
expect(info.updateCommand).toBe('volta install @google/gemini-cli@latest');
|
||||
});
|
||||
|
||||
it('should detect Volta installation (Windows-style)', () => {
|
||||
const voltaPath =
|
||||
'C:\\Users\\test\\AppData\\Local\\Volta\\tools\\image\\node\\20.0.0\\node_modules\\@google/gemini-cli\\dist\\index.js';
|
||||
process.argv[1] = voltaPath;
|
||||
mockedRealPathSync.mockReturnValue(voltaPath);
|
||||
|
||||
const info = getInstallationInfo(projectRoot, true);
|
||||
|
||||
expect(info.packageManager).toBe(PackageManager.VOLTA);
|
||||
expect(info.updateCommand).toBe('volta install @google/gemini-cli@latest');
|
||||
});
|
||||
|
||||
it('should NOT detect Homebrew if gemini-cli is installed in brew but running from npm location', () => {
|
||||
Object.defineProperty(process, 'platform', {
|
||||
value: 'darwin',
|
||||
|
||||
@@ -22,6 +22,7 @@ export enum PackageManager {
|
||||
HOMEBREW = 'homebrew',
|
||||
NPX = 'npx',
|
||||
BINARY = 'binary',
|
||||
VOLTA = 'volta',
|
||||
UNKNOWN = 'unknown',
|
||||
}
|
||||
|
||||
@@ -116,6 +117,19 @@ export function getInstallationInfo(
|
||||
}
|
||||
}
|
||||
|
||||
// Check for Volta
|
||||
if (realPath.includes('/.volta/') || realPath.includes('/Volta/')) {
|
||||
const updateCommand = 'volta install @google/gemini-cli@latest';
|
||||
return {
|
||||
packageManager: PackageManager.VOLTA,
|
||||
isGlobal: true,
|
||||
updateCommand,
|
||||
updateMessage: isAutoUpdateEnabled
|
||||
? 'Installed with Volta. Attempting to automatically update now...'
|
||||
: `Please run ${updateCommand} to update`,
|
||||
};
|
||||
}
|
||||
|
||||
// Check for pnpm
|
||||
if (
|
||||
realPath.includes('/.pnpm/global') ||
|
||||
|
||||
Reference in New Issue
Block a user