Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit da0fecf

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
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>
1 parent 76f9f63 commit da0fecf

File tree

5 files changed

+7
-39
lines changed

5 files changed

+7
-39
lines changed

‎arduino-ide-extension/src/browser/contributions/about.ts‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,16 @@ export class About extends Contribution {
4141
}
4242

4343
async showAbout(): Promise<void> {
44-
const {
45-
version,
46-
commit,
47-
status: cliStatus,
48-
} = await this.configService.getVersion();
44+
const version = await this.configService.getVersion();
4945
const buildDate = this.buildDate;
5046
const detail = (showAll: boolean) =>
5147
nls.localize(
5248
'arduino/about/detail',
53-
'Version: {0}\nDate: {1}{2}\nCLI Version: {3}{4} [{5}]\n\n{6}',
49+
'Version: {0}\nDate: {1}{2}\nCLI Version: {3}\n\n{4}',
5450
remote.app.getVersion(),
5551
buildDate ? buildDate : nls.localize('', 'dev build'),
5652
buildDate && showAll ? ` (${this.ago(buildDate)})` : '',
5753
version,
58-
cliStatus ? ` ${cliStatus}` : '',
59-
commit,
6054
nls.localize(
6155
'arduino/about/copyright',
6256
'Copyright © {0} Arduino SA',

‎arduino-ide-extension/src/common/protocol/config-service.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { RecursivePartial } from '@theia/core/lib/common/types';
33
export const ConfigServicePath = '/services/config-service';
44
export const ConfigService = Symbol('ConfigService');
55
export interface ConfigService {
6-
getVersion(): Promise<
7-
Readonly<{ version: string; commit: string; status?: string }>
8-
>;
6+
getVersion(): Promise<Readonly<string>>;
97
getConfiguration(): Promise<ConfigState>;
108
setConfiguration(config: Config): Promise<void>;
119
}

‎arduino-ide-extension/src/node/arduino-daemon-impl.ts‎

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
1515
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
1616
import { ArduinoDaemon, NotificationServiceServer } from '../common/protocol';
1717
import { CLI_CONFIG } from './cli-config';
18-
import { getExecPath,spawnCommand } from './exec-util';
18+
import { getExecPath } from './exec-util';
1919
import { ErrnoException } from './utils/errors';
2020

2121
@injectable()
@@ -126,28 +126,6 @@ export class ArduinoDaemonImpl
126126
return this._execPath;
127127
}
128128

129-
async getVersion(): Promise<
130-
Readonly<{ version: string; commit: string; status?: string }>
131-
> {
132-
const execPath = await this.getExecPath();
133-
const raw = await spawnCommand(
134-
`"${execPath}"`,
135-
['version', '--format', 'json'],
136-
this.onError.bind(this)
137-
);
138-
try {
139-
// The CLI `Info` object: https://github.com/arduino/arduino-cli/blob/17d24eb901b1fdaa5a4ec7da3417e9e460f84007/version/version.go#L31-L34
140-
const { VersionString, Commit, Status } = JSON.parse(raw);
141-
return {
142-
version: VersionString,
143-
commit: Commit,
144-
status: Status,
145-
};
146-
} catch {
147-
return { version: raw, commit: raw };
148-
}
149-
}
150-
151129
protected async getSpawnArgs(): Promise<string[]> {
152130
const [configDirUri, debug] = await Promise.all([
153131
this.envVariablesServer.getConfigDirUri(),

‎arduino-ide-extension/src/node/config-service-impl.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,8 @@ export class ConfigServiceImpl
131131
return this.configChangeEmitter.event;
132132
}
133133

134-
async getVersion(): Promise<
135-
Readonly<{ version: string; commit: string; status?: string }>
136-
> {
137-
return this.daemon.getVersion();
134+
async getVersion(): Promise<string> {
135+
return require('../../package.json').arduino?.cli?.version || '';
138136
}
139137

140138
private async initConfig(): Promise<void> {

‎i18n/en.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"arduino": {
33
"about": {
4-
"detail": "Version: {0}\nDate: {1}{2}\nCLI Version: {3}{4} [{5}]\n\n{6}",
4+
"detail": "Version: {0}\nDate: {1}{2}\nCLI Version: {3}\n\n{4}",
55
"label": "About {0}"
66
},
77
"board": {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /