From 06f7176c6003511eb9e9069ff0ce1697ffe97fcd Mon Sep 17 00:00:00 2001 From: jaebradley Date: Tue, 24 Apr 2018 19:38:42 -0400 Subject: [PATCH 1/2] =?UTF-8?q?fix(prompts):=20update=20messaging=20?= =?UTF-8?q?=F0=9F=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/prompts.js | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 7cd3775..e1a580c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/prompts.js b/src/prompts.js index 666f25c..4897d53 100644 --- a/src/prompts.js +++ b/src/prompts.js @@ -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 { @@ -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, @@ -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, @@ -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`); }, }, ]) From 885539d1ec4e7f7304485d19b5100797c324eb7a Mon Sep 17 00:00:00 2001 From: jaebradley Date: Wed, 25 Apr 2018 00:16:20 -0400 Subject: [PATCH 2/2] fix(execution-messages): update execution messages --- src/executor.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/executor.js b/src/executor.js index 8c3d8d6..9892078 100644 --- a/src/executor.js +++ b/src/executor.js @@ -4,6 +4,7 @@ import { spawn } from 'child-process-promise'; import normalizePackageData from 'normalize-package-data'; import sortPackageJSON from 'sort-package-json'; import isOnline from 'is-online'; +import chalk from 'chalk'; import { PACKAGE_TYPES, @@ -23,7 +24,7 @@ const executor = async () => { const online = await isOnline(); if (!online) { - console.log("📡 You don't seem to be online 😞"); + console.log(chalk.bold.redBright("⛔ 📡 You don't seem to be online")); return; } @@ -92,16 +93,30 @@ const executor = async () => { normalizePackageData(packageJSON); fse.writeJsonSync(packageJSONLocation, sortPackageJSON(packageJSON), 'utf8'); - console.log('⌛ 🤞 Installing packages'); + console.log(chalk.bold.cyanBright('⌛ 🤞 Installing packages')); await spawn('npm', ['install'], { cwd: destinationDirectory, stdio: 'inherit' }); await spawn('git', ['init'], { cwd: destinationDirectory, stdio: 'inherit' }); - console.log('🥝 🍋 🍐 🍓 🍊 🍍 🍰 Installation complete! 🍒 🍈 🍇 🍉 🍏 🍎 🍌'); - console.log('🔥 "npm run test" runs the jest tests'); - console.log('🏗️ "npm run build" will build your modules'); + console.log(chalk.bold.magentaBright('🥝 🍋 🍐 🍓 🍊 🍍 🍰 Installation complete! 🍒 🍈 🍇 🍉 🍏 🍎 🍌')); + console.log(); + + console.log(`🎭 ${chalk.bold.magentaBright('Run')} ${chalk.bold.blueBright('jest')} ${chalk.bold.magentaBright('tests')}: ${chalk.bold.cyanBright('npm run test')} `); + console.log(`🏗️ ${chalk.bold.magentaBright('Build')} ${chalk.bold.blueBright('rollup.js')} ${chalk.bold.magentaBright('library')}: ${chalk.bold.cyanBright('npm run build')}`); + console.log(`👕 ${chalk.bold.magentaBright('Run')} ${chalk.bold.blueBright('eslint')}: ${chalk.bold.cyanBright('npm run lint')}`); if (isReact) { - console.log('📖 "npm run storybook" starts Storybook!'); + console.log(`📖 ${chalk.bold.magentaBright('Run')} ${chalk.bold.blueBright('Storybook')}: ${chalk.bold.cyanBright('npm run storybook')}`); + } + + console.log(); + console.log(chalk.bold.yellowBright("⚠️ Don't forget to... ⚠️")); + console.log(chalk.bold.cyanBright('✅ Add a license')); + console.log(chalk.bold.cyanBright('✅ Add keywords to package.json')); + console.log(chalk.bold.cyanBright('✅ Create GitHub repository')); + console.log(chalk.bold.cyanBright('✅ Setup Travis CI for repository')); + + if (isSemanticRelease) { + console.log(chalk.bold.cyanBright('✅ Execute semantic-release-cli setup command')); } };