Skip to content

Commit

Permalink
fix(prompts): update messaging 😄
Browse files Browse the repository at this point in the history
  • Loading branch information
jaebradley committed Apr 24, 2018
1 parent f6cca26 commit 06f7176
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"dependencies": {
"@babel/runtime": "^7.0.0-beta.42",
"@octokit/rest": "^15.2.6",
"chalk": "^2.4.0",
"child-process-promise": "^2.2.1",
"commander": "^2.15.1",
"deepmerge": "^2.1.0",
Expand Down
25 changes: 13 additions & 12 deletions src/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import inquirer from 'inquirer';
import emailValidator from 'email-validator';
import validateNpmPackageName from 'validate-npm-package-name';
import isSemver from 'is-semver';
import chalk from 'chalk';

import isGitHubUsernameValid from './isGitHubUsernameValid';
import {
Expand All @@ -13,7 +14,7 @@ const prompts = async () => (
inquirer.prompt([
{
name: 'packageType',
message: 'Select a package type',
message: chalk.bold.magentaBright('📦 Select a package type'),
type: 'list',
choices: [
PACKAGE_TYPES.NODE,
Expand All @@ -22,7 +23,7 @@ const prompts = async () => (
},
{
name: 'packageFeatures',
message: 'Select package Features',
message: chalk.bold.cyanBright('✅ Select package features'),
type: 'checkbox',
choices: [
PACKAGE_FEATURES.COMMITLINT,
Expand All @@ -31,44 +32,44 @@ const prompts = async () => (
},
{
name: 'packageName',
message: 'Input a package name',
message: chalk.bold.greenBright('📛 Input a package name'),
type: 'input',
validate: packageName => validateNpmPackageName(packageName).validForNewPackages || `${packageName} is an invalid package name`,
validate: packageName => validateNpmPackageName(packageName).validForNewPackages || chalk.bold.redBright(`😞 ${packageName} is an invalid package name`),
},
{
name: 'packageDescription',
message: 'Input a package description',
message: chalk.bold.redBright('🏷️ Input a package description'),
type: 'input',
validate: answer => answer && answer.length > 0,
},
{
name: 'packageVersion',
message: 'Input an initial package version',
message: chalk.bold.yellowBright('🌱 Input an initial package version'),
type: 'input',
validate: answer => isSemver(answer) || `${answer} is an invalid package version`,
validate: answer => isSemver(answer) || chalk.bold.redBright(`😞 ${answer} is an invalid package version`),
},
{
name: 'targetDirectory',
message: 'Input the relative package location',
message: chalk.bold.magentaBright('📍 Input the relative package location'),
type: 'input',
validate: answer => answer && answer.length > 0,
},
{
name: 'authorEmailAddress',
message: 'Input your email address',
message: chalk.bold.cyanBright('📥 Input your email address'),
type: 'input',
validate: emailAddress => emailValidator.validate(emailAddress) || `${emailAddress} is an invalid email address`,
validate: emailAddress => emailValidator.validate(emailAddress) || chalk.bold.redBright(`😞 ${emailAddress} is an invalid email address`),
},
{
name: 'gitHubUsername',
message: 'Input your GitHub username',
message: chalk.bold.greenBright('👤 Input your GitHub username'),
type: 'input',
validate: async (username) => {
if (await isGitHubUsernameValid(username)) {
return true;
}

return `${username} is an invalid GitHub username`;
return chalk.bold.redBright(`😞 ${username} is an invalid GitHub username`);
},
},
])
Expand Down

0 comments on commit 06f7176

Please sign in to comment.