From eec50416fb11543acd9936650256108391a67960 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Wed, 21 Feb 2024 10:35:10 +0100 Subject: [PATCH] :monocle_face: Improve inspectTypebot script abort process --- packages/scripts/inspectTypebot.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/scripts/inspectTypebot.ts b/packages/scripts/inspectTypebot.ts index 2776ad87d..39aa54bda 100644 --- a/packages/scripts/inspectTypebot.ts +++ b/packages/scripts/inspectTypebot.ts @@ -1,21 +1,26 @@ import { PrismaClient } from '@typebot.io/prisma' import { promptAndSetEnvironment } from './utils' import * as p from '@clack/prompts' +import { isCancel } from '@clack/prompts' const inspectTypebot = async () => { await promptAndSetEnvironment('production') - const type = (await p.select({ + const type = await p.select({ message: 'Select way', options: [ { label: 'ID', value: 'id' }, { label: 'Public ID', value: 'publicId' }, ], - })) as 'id' | 'publicId' + }) - const val = (await p.text({ + if (!type || isCancel(type)) process.exit() + + const val = await p.text({ message: 'Enter value', - })) as string + }) + + if (!val || isCancel(val)) process.exit() const prisma = new PrismaClient({ log: [{ emit: 'event', level: 'query' }, 'info', 'warn', 'error'],