mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-27 13:16:43 +00:00
feat: no remote fetch when IDE gets CLI version
the CLI version is retrieved from the `package.json` of the extension: `arduino.cli.version` Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
parent
76f9f635d8
commit
da0fecfd0f
@ -41,22 +41,16 @@ export class About extends Contribution {
|
||||
}
|
||||
|
||||
async showAbout(): Promise<void> {
|
||||
const {
|
||||
version,
|
||||
commit,
|
||||
status: cliStatus,
|
||||
} = await this.configService.getVersion();
|
||||
const version = await this.configService.getVersion();
|
||||
const buildDate = this.buildDate;
|
||||
const detail = (showAll: boolean) =>
|
||||
nls.localize(
|
||||
'arduino/about/detail',
|
||||
'Version: {0}\nDate: {1}{2}\nCLI Version: {3}{4} [{5}]\n\n{6}',
|
||||
'Version: {0}\nDate: {1}{2}\nCLI Version: {3}\n\n{4}',
|
||||
remote.app.getVersion(),
|
||||
buildDate ? buildDate : nls.localize('', 'dev build'),
|
||||
buildDate && showAll ? ` (${this.ago(buildDate)})` : '',
|
||||
version,
|
||||
cliStatus ? ` ${cliStatus}` : '',
|
||||
commit,
|
||||
nls.localize(
|
||||
'arduino/about/copyright',
|
||||
'Copyright © {0} Arduino SA',
|
||||
|
@ -3,9 +3,7 @@ import { RecursivePartial } from '@theia/core/lib/common/types';
|
||||
export const ConfigServicePath = '/services/config-service';
|
||||
export const ConfigService = Symbol('ConfigService');
|
||||
export interface ConfigService {
|
||||
getVersion(): Promise<
|
||||
Readonly<{ version: string; commit: string; status?: string }>
|
||||
>;
|
||||
getVersion(): Promise<Readonly<string>>;
|
||||
getConfiguration(): Promise<ConfigState>;
|
||||
setConfiguration(config: Config): Promise<void>;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
||||
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
|
||||
import { ArduinoDaemon, NotificationServiceServer } from '../common/protocol';
|
||||
import { CLI_CONFIG } from './cli-config';
|
||||
import { getExecPath, spawnCommand } from './exec-util';
|
||||
import { getExecPath } from './exec-util';
|
||||
import { ErrnoException } from './utils/errors';
|
||||
|
||||
@injectable()
|
||||
@ -126,28 +126,6 @@ export class ArduinoDaemonImpl
|
||||
return this._execPath;
|
||||
}
|
||||
|
||||
async getVersion(): Promise<
|
||||
Readonly<{ version: string; commit: string; status?: string }>
|
||||
> {
|
||||
const execPath = await this.getExecPath();
|
||||
const raw = await spawnCommand(
|
||||
`"${execPath}"`,
|
||||
['version', '--format', 'json'],
|
||||
this.onError.bind(this)
|
||||
);
|
||||
try {
|
||||
// The CLI `Info` object: https://github.com/arduino/arduino-cli/blob/17d24eb901b1fdaa5a4ec7da3417e9e460f84007/version/version.go#L31-L34
|
||||
const { VersionString, Commit, Status } = JSON.parse(raw);
|
||||
return {
|
||||
version: VersionString,
|
||||
commit: Commit,
|
||||
status: Status,
|
||||
};
|
||||
} catch {
|
||||
return { version: raw, commit: raw };
|
||||
}
|
||||
}
|
||||
|
||||
protected async getSpawnArgs(): Promise<string[]> {
|
||||
const [configDirUri, debug] = await Promise.all([
|
||||
this.envVariablesServer.getConfigDirUri(),
|
||||
|
@ -131,10 +131,8 @@ export class ConfigServiceImpl
|
||||
return this.configChangeEmitter.event;
|
||||
}
|
||||
|
||||
async getVersion(): Promise<
|
||||
Readonly<{ version: string; commit: string; status?: string }>
|
||||
> {
|
||||
return this.daemon.getVersion();
|
||||
async getVersion(): Promise<string> {
|
||||
return require('../../package.json').arduino?.cli?.version || '';
|
||||
}
|
||||
|
||||
private async initConfig(): Promise<void> {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"arduino": {
|
||||
"about": {
|
||||
"detail": "Version: {0}\nDate: {1}{2}\nCLI Version: {3}{4} [{5}]\n\n{6}",
|
||||
"detail": "Version: {0}\nDate: {1}{2}\nCLI Version: {3}\n\n{4}",
|
||||
"label": "About {0}"
|
||||
},
|
||||
"board": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user