-
-
Notifications
You must be signed in to change notification settings - Fork 406
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: use Arduino CLI 1.0.4 #2457
Conversation
8f03dee
to
540d848
Compare
540d848
to
24296c5
Compare
24296c5
to
7ffd748
Compare
The npm package previously used (`protoc`) is still lacking apple arm32 support, see YePpHa/node-protoc#10
d396032
to
aca5ece
Compare
@@ -182,7 +182,11 @@ export class ConfigServiceImpl | |||
}); | |||
const model = (yaml.safeLoad(content) || {}) as DefaultCliConfig; | |||
this.logger.info(`Loaded CLI configuration: ${JSON.stringify(model)}`); | |||
if (model.directories.data && model.directories.user) { | |||
if ( | |||
model.directories && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If directories
is optional, I propose reflecting it on the type:
directories: Directories; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think directories
can be undefined only on the initial parse of the current config.
We can manipolate the loaded config object to assure the directories are alway defined object returned by loadCliConfig
is always of type DefaultCliConfig
.
That's the current logic:
- Load current cli config as type
CliConfig
(optionaldirectories
). - Check
directories
value:- If defined, return config as
DefaultCliConfig
type - If undefined, call
getFallbackCliConfig
to get default directories, merge them to current config and return the object asDefaultCliConfig
- If defined, return config as
const rawJson = await spawnCommand(cliPath, ['config', 'dump', '--json']); | ||
const config = JSON.parse(rawJson); | ||
|
||
// Since CLI 1.0, the command `config dump` only returns user-modified values and not default ones. | ||
// directories.user and directories.data are required by IDE2 so we get the default value explicitly. | ||
const directoriesRaw = await spawnCommand(cliPath, [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CLI executions do not depend on each other: they can spawn parallel with Promise.all()
const client = createArduinoCoreServiceClient({ port }); | ||
const req = new SettingsSetValueRequest(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a new CLI behavior? I see a client is created before setting each value. Can it be moved outside of the loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes CLI config API's were refactored and they now only exposed methods for retrieving/setting single values, instead of the previous "merge" approach.
I agree the client should be created one time outside the loop. Thanks for the review! 👍
|
||
const cliConfigUri = await this.getCliConfigFileUri(); | ||
const cliConfigPath = FileUri.fsPath(cliConfigUri); | ||
fs.writeFile(cliConfigPath, configRaw, { encoding: 'utf-8' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing await
or return
d78e917
to
15e2a19
Compare
15e2a19
to
92f518d
Compare
Arduino deprecated platforms should have more priority then other deprecated ones
Ref: arduino/arduino-ide#2457 Signed-off-by: dankeboy36 <[email protected]>
* fix: patch for missing `google` proto files in CLI (arduino/arduino-cli#2755) * chore: replace `protoc` with `@pingghost/protoc` (arduino/arduino-ide#2457) * chore(ci): build on Node.js 20.x * fix(doc): refresh docs, update protoc version * chore: update formatter + fix example command --------- Signed-off-by: dankeboy36 <[email protected]>
Motivation
Use Arduino CLI
1.0.0
APIs in IDE2.Change description
Update CLI version to
1.0.0
, bind new APIsOther information
Reviewer checklist