diff --git a/CHANGELOG.md b/CHANGELOG.md index 684562f7..5583287a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - feat(sourcemaps): Automatically insert Sentry Webpack plugin (#432) - fix(android): Add support for unusual import statements (#440) +- fix(wizard): Sort projects in project-selection step #441 ## 3.11.0 diff --git a/src/utils/clack-utils.ts b/src/utils/clack-utils.ts index c78c7001..16402925 100644 --- a/src/utils/clack-utils.ts +++ b/src/utils/clack-utils.ts @@ -779,14 +779,21 @@ async function askForWizardLogin(options: { async function askForProjectSelection( projects: SentryProjectData[], ): Promise { + 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), }; }), }),