Skip to content

Commit

Permalink
Make sure unknown storefront types still appear in the list
Browse files Browse the repository at this point in the history
  • Loading branch information
bookernath committed Dec 31, 2024
1 parent 3c451f6 commit a2b801f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/create-catalyst/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,22 @@ async function handleChannelSelection(bc: Https) {
message: 'Which channel would you like to use?',
choices: availableChannels.data
.sort(

Check warning on line 117 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `⏎········`
(a: Channel, b: Channel) =>
channelSortOrder.indexOf(a.platform) - channelSortOrder.indexOf(b.platform),
(a: Channel, b: Channel) => {
const aIndex = channelSortOrder.indexOf(a.platform);

Check warning on line 119 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `··`
const bIndex = channelSortOrder.indexOf(b.platform);

Check warning on line 120 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `··`

Check warning on line 121 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `··········`
// If both platforms are not in the sort order, maintain their original order

Check warning on line 122 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `··`
if (aIndex === -1 && bIndex === -1) {

Check warning on line 123 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `··`
return 0;

Check warning on line 124 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `··`
}

Check warning on line 125 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `··`

Check warning on line 126 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `··········`
// If one platform is not in the sort order, it should go to the end

Check warning on line 127 in packages/create-catalyst/src/commands/create.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, and gql.tada

Delete `··`
if (aIndex === -1) return 1;
if (bIndex === -1) return -1;

// If both platforms are in the sort order, use their relative positions
return aIndex - bIndex;
},
)
.map((ch: Channel) => ({
name: ch.name,
Expand Down

0 comments on commit a2b801f

Please sign in to comment.