-
Notifications
You must be signed in to change notification settings - Fork 50
Config builder and CLI config refactor #1367
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
Conversation
| const idx = this.config.envs.findIndex((x) => Uri.equals(x.uri, envUri)); | ||
|
|
||
| if (idx > -1) { | ||
| this.config.envs.splice(idx, 1); | ||
| } |
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.
nit: wouldn't it be easier to just use filter here?
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 this comment can be applied to all the remove* that uses this logic
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.
Haven't written this code, but I suspect it's a bit faster than using filter since the arrays are always unique.
I'm fine with either solution
cc @pileks
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.
In that case, having a Set would be the fastest. I belive the loading will also be easier
packages/test-cases/cases/cli/wasm/build-cmd/assemblyscript/001-sanity/yarn.lock
Outdated
Show resolved
Hide resolved
| const idx = this.config.envs.findIndex((x) => Uri.equals(x.uri, envUri)); | ||
|
|
||
| if (idx > -1) { | ||
| this.config.envs.splice(idx, 1); | ||
| } |
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.
In that case, having a Set would be the fastest. I belive the loading will also be easier
| return this; | ||
| } | ||
|
|
||
| addRedirect(from: Uri | string, to: Uri | string): ClientConfigBuilder { |
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.
What do you think about having redirects as a map instead of a list of from-to?
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.
We talked about making envs a map, but yea, redirects could also make sense. I think the same applies to wrappers and packages.
I'll look into the best way to do that in a follow-up PR
| addInterfaceImplementations( | ||
| interfaceUri: Uri | string, | ||
| implementationUris: Array<Uri | string> | ||
| ): ClientConfigBuilder { | ||
| const interfaceUriSanitized = Uri.from(interfaceUri); | ||
| const implementationUrisSanitized = implementationUris.map(Uri.from); |
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.
This can also represented as map to simplify things
Closes #1378