Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: no remote fetch when IDE gets CLI version #1802

Merged
merged 1 commit into from
Jan 11, 2023
Merged

feat: no remote fetch when IDE gets CLI version #1802

merged 1 commit into from
Jan 11, 2023

Conversation

kittaakos
Copy link
Contributor

Motivation

To speed up the load time of the About dialog in IDE2. As requested in #1572, IDE2 reads the CLI version from the package.json.

Change description

  • 2.0.3:

    Screen Shot 2023-01-06 at 09 59 43
  • A dev build with the changes:

    Screen Shot 2023-01-06 at 10 06 39
  • Local IDE2 build with the changes:

    Screen Shot 2023-01-06 at 10 24 32

Other information

If the CLI version is a pinned commitish and not a semver, IDE2 will show the commitsh.

Assuming the following pinned CLI version:

diff --git a/arduino-ide-extension/package.json b/arduino-ide-extension/package.json
index 1b7cc2de..ab4414ea 100644
--- a/arduino-ide-extension/package.json
+++ b/arduino-ide-extension/package.json
@@ -159,7 +159,7 @@
   ],
   "arduino": {
     "cli": {
-      "version": "0.29.0"
+      "version": "alma"
     },
     "fwuploader": {
       "version": "2.2.2"

The expected About dialog (with a dev build) is:

Screen Shot 2023-01-06 at 10 07 45

Closes #1572


It should be possible to run arduino-cli version --no-fetch or similar to avoid checking for updates. I have never used a CLI tool before that does a silent remote fetch when getting the only version. If there is a good example, please let me know. CLIs usually warn about the outdated version (brew, npm, yarn, etc.) when users execute a command that requires the Intenet connection. The Arduino CLI ought to warn the user on core index-update or lib install but not on version.

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

the CLI version is retrieved from the `package.json` of the extension:
`arduino.cli.version`

Signed-off-by: Akos Kitta <[email protected]>
@kittaakos kittaakos added type: enhancement Proposed improvement topic: code Related to content of the project itself topic: CLI Related to Arduino CLI labels Jan 6, 2023
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Akos!

Copy link
Contributor

@AlbyIanna AlbyIanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

On a side note though, I have noticed that this change breaks the localized string "arduino/about/detail" when the ide language is one that has that string already translated. That happens because the number of parameters used the localized string changed from 7 to 5.
For example, if you set the language to "Italiano", you get this dialog
Screenshot 2023-01-10 at 14 22 28

Anyway, I won't request changes in this PR because I'm not sure how we should proceed about this kind of localization issues.

@kittaakos kittaakos merged commit da0fecf into main Jan 11, 2023
@kittaakos kittaakos deleted the #1572 branch January 11, 2023 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use more efficient method to get Arduino CLI version
3 participants