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: use SDK metadata #378

Merged
merged 12 commits into from
Aug 12, 2024
Merged

feat: use SDK metadata #378

merged 12 commits into from
Aug 12, 2024

Conversation

cwaldren-ld
Copy link
Contributor

@cwaldren-ld cwaldren-ld commented Jul 11, 2024

The CLI currently hard-codes certain information about LaunchDarkly SDKs, including example links, display names, and SDK types (server, client, and so on.)

This information must be manually kept up-to-date by the CLI maintainers or SDK engineers.

With the introduction of the sdk-meta Go module, we're able to source this metadata externally.

As background, whenever a LaunchDarkly SDK's metadata is updated (example), the sdk-meta project crawls the changes and generates a new Go module version.


In this PR, I've removed data that is now provided by the sdk-meta module. SDK example links are not yet part of the sdk-meta project, so I transformed those into a simple lookup table.

Finally, I renamed the SDK quickstart instruction files. To retrieve metadata for a particular SDK, you need the SDK's ID. It makes sense to define this as part of the filename.

The effect is that if you add a new quickstart instruction with a particular SDK ID, metadata will be automatically found for it.

Base automatically changed from cw/consistent-go-version to main July 11, 2024 18:11
@cwaldren-ld cwaldren-ld force-pushed the cw/sc-242846/sdk-metadata branch 2 times, most recently from 1572817 to 066e639 Compare August 8, 2024 22:33
@cwaldren-ld cwaldren-ld changed the title feat: use SDK metadata [draft] feat: use SDK metadata Aug 8, 2024
@cwaldren-ld
Copy link
Contributor Author

cwaldren-ld commented Aug 8, 2024

The majority of the changes are vendor updates; do not be intimidated!

@cwaldren-ld cwaldren-ld marked this pull request as ready for review August 8, 2024 22:40
internal/quickstart/choose_sdk.go Show resolved Hide resolved
selectedIndex int
selectedSDK sdkDetail
}

func NewChooseSDKModel(selectedIndex int) tea.Model {
initSDKs()
l := list.New(sdksToItems(), sdkDelegate{}, 30, 9)
sdkDetails := initSDKs()
Copy link
Contributor

Choose a reason for hiding this comment

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

I updated the PR to not use the global var but pass this list around instead. It felt weird to modify it when we could encapsulate it in the model.

}
index := slices.Index(sdkOrder, id)
if index == -1 {
// if we missed an SDK don't add it with an invalid index
Copy link
Contributor

Choose a reason for hiding this comment

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

Without this, there's a panic since it would later try to reference a -1 index. It shouldn't happen unless we change the SDK ID and forget to update the order list.

@cwaldren-ld cwaldren-ld merged commit b0e03ca into main Aug 12, 2024
4 checks passed
@cwaldren-ld cwaldren-ld deleted the cw/sc-242846/sdk-metadata branch August 12, 2024 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants