Skip to content

Commit

Permalink
feat: better reporting for algolia index name
Browse files Browse the repository at this point in the history
  • Loading branch information
field123 committed Sep 26, 2023
1 parent 21bc6d1 commit e92dbb8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,26 @@ export function createD2CCommandHandler(
])

if (configureAlgolia) {
await createAlgoliaIntegrationCommandHandler(ctx)({
const result = await createAlgoliaIntegrationCommandHandler(ctx)({
algoliaApplicationId: gatheredOptions.algoliaApplicationId,
algoliaAdminApiKey: gatheredOptions.algoliaAdminApiKey,
...args,
})

if (result.success) {
logger.info(
boxen(
`Don't forget to add your Algolia index name to .env.local ${colors.bold.green(
`NEXT_PUBLIC_ALGOLIA_INDEX_NAME=${result.data.indexName}` ??
"",
)}`,
{
padding: 1,
margin: 1,
},
),
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@ export function createAlgoliaIntegrationCommandHandler(

return {
success: true,
data: {},
data: {
indexName: algoliaIndexName,
},
}
} catch (e) {
spinner.fail(`Failed to setup Algolia integration`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { IntegrationCommandArguments } from "../integration.types"

export type AlgoliaIntegrationCommandData = {}
export type AlgoliaIntegrationCommandData = {
indexName?: string
}

export type AlgoliaIntegrationCommandError = {
code: string
Expand Down
1 change: 0 additions & 1 deletion packages/composable-cli/src/composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export async function main({
.example("$0 logout", "logout of the CLI")
.strictCommands()
.demandCommand(1)
.fail(false)
.help("h").argv

return 0
Expand Down

0 comments on commit e92dbb8

Please sign in to comment.