From 7db35b646e4d90ec8b430d3e1595e094a369e531 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Wed, 12 Feb 2025 14:29:35 -0500 Subject: [PATCH] fix: work around inquirer `answers` is undefinde There is an issue with `inquirer` where the `answers` argument to the `validation()` function is undefined, according to the docs, that argument should be passed, but it isn't Fixes #396 --- lib/prompts.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/prompts.js b/lib/prompts.js index 01b54a14c..8342f1989 100644 --- a/lib/prompts.js +++ b/lib/prompts.js @@ -24,6 +24,7 @@ function getDefaultRepository(username, answers) { } async function prompts({ username, name, email, website, useOctokitOrg }) { + let currentAnswers = {}; return inquirer.prompt([ { type: "confirm", @@ -49,9 +50,11 @@ async function prompts({ username, name, email, website, useOctokitOrg }) { ? "auth-" : ""; const example = `${scopePrefix}${typePrefix}example`; + currentAnswers = answers; return `What npm package name should the project have? (Example: ${example})`; }, - validate(input, answers) { + validate(input) { + const answers = currentAnswers; if (answers.isPlugin) { const prefix = (useOctokitOrg ? "@octokit/" : "octokit-") + "plugin-"; if (input.startsWith(prefix)) return true;