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;