Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function getDefaultRepository(username, answers) {
}

async function prompts({ username, name, email, website, useOctokitOrg }) {
let currentAnswers = {};
return inquirer.prompt([
{
type: "confirm",
Expand All @@ -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;
Expand Down
Loading