Skip to content

Commit

Permalink
enh(wizard): sort projects in project-selection step
Browse files Browse the repository at this point in the history
  • Loading branch information
markushi committed Sep 12, 2023
1 parent 523b7fa commit b7c9b1e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/utils/clack-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -778,14 +778,21 @@ async function askForWizardLogin(options: {
async function askForProjectSelection(
projects: SentryProjectData[],
): Promise<SentryProjectData> {
const label = (project: SentryProjectData): string => {
return `${project.organization.slug}/${project.slug}`;
};
const sortedProjects = [...projects];
sortedProjects.sort((a: SentryProjectData, b: SentryProjectData) => {
return label(a).localeCompare(label(b));
});
const selection: SentryProjectData | symbol = await abortIfCancelled(
clack.select({
maxItems: 12,
message: 'Select your Sentry project.',
options: projects.map((project) => {
options: sortedProjects.map((project) => {
return {
value: project,
label: `${project.organization.slug}/${project.slug}`,
label: label(project),
};
}),
}),
Expand Down

0 comments on commit b7c9b1e

Please sign in to comment.