repl: reset events when start and add types to inquirer prompt
This commit is contained in:
@@ -21,7 +21,8 @@ function getCode(): string {
|
|||||||
start();
|
start();
|
||||||
|
|
||||||
async function start() {
|
async function start() {
|
||||||
const { url } = await inquirer.prompt([
|
events = [];
|
||||||
|
const { url } = await inquirer.prompt<{ url: string }>([
|
||||||
{
|
{
|
||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'url',
|
name: 'url',
|
||||||
@@ -34,7 +35,7 @@ function getCode(): string {
|
|||||||
await record(url);
|
await record(url);
|
||||||
console.log('Ready to record. You can do any interaction on the page.');
|
console.log('Ready to record. You can do any interaction on the page.');
|
||||||
|
|
||||||
const { shouldReplay } = await inquirer.prompt([
|
const { shouldReplay } = await inquirer.prompt<{ shouldReplay: boolean }>([
|
||||||
{
|
{
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
name: 'shouldReplay',
|
name: 'shouldReplay',
|
||||||
@@ -44,7 +45,7 @@ function getCode(): string {
|
|||||||
|
|
||||||
emitter.emit('done', shouldReplay);
|
emitter.emit('done', shouldReplay);
|
||||||
|
|
||||||
const { shouldStore } = await inquirer.prompt([
|
const { shouldStore } = await inquirer.prompt<{ shouldStore: boolean }>([
|
||||||
{
|
{
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
name: 'shouldStore',
|
name: 'shouldStore',
|
||||||
@@ -56,7 +57,9 @@ function getCode(): string {
|
|||||||
saveEvents();
|
saveEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
const { shouldRecordAnother } = await inquirer.prompt([
|
const { shouldRecordAnother } = await inquirer.prompt<{
|
||||||
|
shouldRecordAnother: boolean;
|
||||||
|
}>([
|
||||||
{
|
{
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
name: 'shouldRecordAnother',
|
name: 'shouldRecordAnother',
|
||||||
|
|||||||
Reference in New Issue
Block a user