From f1a42eb6ab28995044b7a10c86eeb1fdb6a23509 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sat, 3 Jun 2017 17:02:29 +0200 Subject: [PATCH] =?UTF-8?q?Update=20prettier=20to=20the=20latest=20version?= =?UTF-8?q?=20=F0=9F=9A=80=20(#626)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(package): update prettier to version 1.4.1 * Prettified everything * Fixed linting --- bin/domains/buy.js | 8 ++- bin/now-alias.js | 84 +++++++++++++++++++------ bin/now-billing-add.js | 15 ++++- bin/now-billing.js | 40 +++++++++--- bin/now-certs.js | 70 ++++++++++++++++----- bin/now-deploy.js | 101 ++++++++++++++++++++++-------- bin/now-dns.js | 56 +++++++++++++---- bin/now-domains.js | 98 +++++++++++++++++++++-------- bin/now-list.js | 22 +++++-- bin/now-logout.js | 4 +- bin/now-logs.js | 24 ++++++-- bin/now-remove.js | 28 ++++++--- bin/now-scale.js | 24 ++++++-- bin/now-secrets.js | 54 ++++++++++++---- bin/now-teams.js | 12 +++- bin/now-upgrade.js | 28 ++++++--- bin/now-whoami.js | 8 ++- bin/now.js | 8 ++- bin/teams/add.js | 11 +++- bin/teams/invite.js | 4 +- lib/alias.js | 109 +++++++++++++++++++++++++-------- lib/domains.js | 4 +- lib/errors.js | 24 ++++++-- lib/git.js | 3 +- lib/index.js | 24 ++++++-- lib/login.js | 4 +- lib/re-alias.js | 5 +- lib/scale-info.js | 17 +++-- lib/utils/input/prompt-bool.js | 4 +- package.json | 2 +- 30 files changed, 677 insertions(+), 218 deletions(-) diff --git a/bin/domains/buy.js b/bin/domains/buy.js index 75c96fb..40fd247 100644 --- a/bin/domains/buy.js +++ b/bin/domains/buy.js @@ -46,7 +46,9 @@ module.exports = async function({ domains, args, currentTeam, user }) { } const periodMsg = `${period}yr${period > 1 ? 's' : ''}` info( - `The domain ${nameParam} is ${italic('available')} to buy under ${bold((currentTeam && currentTeam.slug) || user.username || user.email)}! ${elapsed()}` + `The domain ${nameParam} is ${italic('available')} to buy under ${bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}! ${elapsed()}` ) const confirmation = await promptBool( `Buy now for ${bold(`$${price}`)} (${periodMsg})?` @@ -71,6 +73,8 @@ module.exports = async function({ domains, args, currentTeam, user }) { success(`Domain purchased and created ${uid(domain.uid)} ${elapsed()}`) info( - `You may now use your domain as an alias to your deployments. Run ${cmd('now alias --help')}` + `You may now use your domain as an alias to your deployments. Run ${cmd( + 'now alias --help' + )}` ) } diff --git a/bin/now-alias.js b/bin/now-alias.js index 352af87..90e6c0e 100755 --- a/bin/now-alias.js +++ b/bin/now-alias.js @@ -48,10 +48,16 @@ const help = () => { ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file - -r ${chalk.bold.underline('RULES_FILE')}, --rules=${chalk.bold.underline('RULES_FILE')} Rules file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file + -r ${chalk.bold.underline('RULES_FILE')}, --rules=${chalk.bold.underline( + 'RULES_FILE' + )} Rules file -d, --debug Debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token ${chalk.dim('Examples:')} @@ -61,7 +67,11 @@ const help = () => { ${chalk.gray('–')} Adds a new alias to ${chalk.underline('my-api.now.sh')}: - ${chalk.cyan(`$ now alias set ${chalk.underline('api-ownv3nc9f8.now.sh')} ${chalk.underline('my-api.now.sh')}`)} + ${chalk.cyan( + `$ now alias set ${chalk.underline( + 'api-ownv3nc9f8.now.sh' + )} ${chalk.underline('my-api.now.sh')}` + )} The ${chalk.dim('`.now.sh`')} suffix can be ommited: @@ -73,18 +83,34 @@ const help = () => { Custom domains work as alias targets: - ${chalk.cyan(`$ now alias set ${chalk.underline('api-ownv3nc9f8.now.sh')} ${chalk.underline('my-api.com')}`)} - - ${chalk.dim('–')} The subcommand ${chalk.dim('`set`')} is the default and can be skipped. - ${chalk.dim('–')} ${chalk.dim('`http(s)://`')} in the URLs is unneeded / ignored. - - ${chalk.gray('–')} Add and modify path based aliases for ${chalk.underline('zeit.ninja')}: - - ${chalk.cyan(`$ now alias ${chalk.underline('zeit.ninja')} -r ${chalk.underline('rules.json')}`)} + ${chalk.cyan( + `$ now alias set ${chalk.underline( + 'api-ownv3nc9f8.now.sh' + )} ${chalk.underline('my-api.com')}` + )} + + ${chalk.dim('–')} The subcommand ${chalk.dim( + '`set`' + )} is the default and can be skipped. + ${chalk.dim('–')} ${chalk.dim( + '`http(s)://`' + )} in the URLs is unneeded / ignored. + + ${chalk.gray('–')} Add and modify path based aliases for ${chalk.underline( + 'zeit.ninja' + )}: + + ${chalk.cyan( + `$ now alias ${chalk.underline('zeit.ninja')} -r ${chalk.underline( + 'rules.json' + )}` + )} Export effective routing rules: - ${chalk.cyan(`$ now alias ls aliasId --json > ${chalk.underline('rules.json')}`)} + ${chalk.cyan( + `$ now alias ls aliasId --json > ${chalk.underline('rules.json')}` + )} ${chalk.cyan(`$ now alias ls zeit.ninja`)} @@ -207,7 +233,11 @@ async function run({ token, config: { currentTeam, user } }) { }, 0) + 8 const elapsed_ = ms(new Date() - start_) console.log( - `> ${aliases.length} alias${aliases.length === 1 ? '' : 'es'} found ${chalk.gray(`[${elapsed_}]`)} under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}` + `> ${aliases.length} alias${aliases.length === 1 + ? '' + : 'es'} found ${chalk.gray(`[${elapsed_}]`)} under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` ) console.log() @@ -254,7 +284,9 @@ async function run({ token, config: { currentTeam, user } }) { } } else if (_alias.rules) { _sourceUrl = chalk.gray( - `[${_alias.rules.length} custom rule${_alias.rules.length > 1 ? 's' : ''}]` + `[${_alias.rules.length} custom rule${_alias.rules.length > 1 + ? 's' + : ''}]` ) if (supportsColor) { urlSpec += underlineWidth @@ -286,7 +318,9 @@ async function run({ token, config: { currentTeam, user } }) { if (args.length !== 1) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now alias rm `')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now alias rm `' + )}` ) return exit(1) } @@ -296,7 +330,9 @@ async function run({ token, config: { currentTeam, user } }) { if (!_alias) { const err = new Error( - `Alias not found by "${_target}" under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}. Run ${chalk.dim('`now alias ls`')} to see your aliases.` + `Alias not found by "${_target}" under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}. Run ${chalk.dim('`now alias ls`')} to see your aliases.` ) err.userError = true throw err @@ -313,7 +349,9 @@ async function run({ token, config: { currentTeam, user } }) { await alias.rm(_alias) const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Alias ${chalk.bold(_alias.uid)} removed [${elapsed}]` + `${chalk.cyan('> Success!')} Alias ${chalk.bold( + _alias.uid + )} removed [${elapsed}]` ) } catch (err) { error(err) @@ -330,7 +368,9 @@ async function run({ token, config: { currentTeam, user } }) { } if (args.length !== 2) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now alias set `')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now alias set `' + )}` ) return exit(1) } @@ -475,7 +515,11 @@ async function updatePathAlias(alias, aliasName, rules, domains) { throw err } else { console.log( - `${chalk.cyan('> Success!')} ${res.ruleCount} rules configured for ${chalk.underline(res.alias)} [${elapsed}]` + `${chalk.cyan( + '> Success!' + )} ${res.ruleCount} rules configured for ${chalk.underline( + res.alias + )} [${elapsed}]` ) } } diff --git a/bin/now-billing-add.js b/bin/now-billing-add.js index 554559e..2725887 100644 --- a/bin/now-billing-add.js +++ b/bin/now-billing-add.js @@ -22,7 +22,11 @@ function expDateMiddleware(data) { module.exports = function({ creditCards, currentTeam, user }) { const state = { error: undefined, - cardGroupLabel: `> ${chalk.bold(`Enter your card details for ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}`)}`, + cardGroupLabel: `> ${chalk.bold( + `Enter your card details for ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` + )}`, name: { label: rightPad('Full Name', 12), @@ -195,13 +199,18 @@ module.exports = function({ creditCards, currentTeam, user }) { }) stopSpinner() success( - `${state.cardNumber.brand} ending in ${res.last4} was added to ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}` + `${state.cardNumber + .brand} ending in ${res.last4} was added to ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` ) } catch (err) { stopSpinner() const linesToClear = state.error ? 13 : 12 process.stdout.write(ansiEscapes.eraseLines(linesToClear)) - state.error = `${chalk.red('> Error!')} ${err.message} Please make sure the info is correct` + state.error = `${chalk.red( + '> Error!' + )} ${err.message} Please make sure the info is correct` await render() } } diff --git a/bin/now-billing.js b/bin/now-billing.js index 0454481..3aab0da 100644 --- a/bin/now-billing.js +++ b/bin/now-billing.js @@ -40,9 +40,13 @@ const help = () => { ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token ${chalk.dim('Examples:')} @@ -153,7 +157,9 @@ async function run({ token, config: { currentTeam, user } }) { const _default = card.id === cards.defaultCardId ? ' ' + chalk.bold('(default)') : '' - const id = `${chalk.gray('-')} ${chalk.cyan(`ID: ${card.id}`)}${_default}` + const id = `${chalk.gray('-')} ${chalk.cyan( + `ID: ${card.id}` + )}${_default}` const number = `${chalk.gray('#### ').repeat(3)}${card.last4}` let address = card.address_line1 @@ -184,7 +190,11 @@ async function run({ token, config: { currentTeam, user } }) { const elapsed = ms(new Date() - start) console.log( - `> ${cards.cards.length} card${cards.cards.length === 1 ? '' : 's'} found under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)} ${chalk.gray(`[${elapsed}]`)}` + `> ${cards.cards.length} card${cards.cards.length === 1 + ? '' + : 's'} found under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )} ${chalk.gray(`[${elapsed}]`)}` ) if (text) { console.log(`\n${text}\n`) @@ -218,7 +228,9 @@ async function run({ token, config: { currentTeam, user } }) { if (cardId === undefined) { const elapsed = ms(new Date() - start) - const message = `Selecting a new default payment card for ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)} ${chalk.gray(`[${elapsed}]`)}` + const message = `Selecting a new default payment card for ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )} ${chalk.gray(`[${elapsed}]`)}` const choices = buildInquirerChoices(cards) cardId = await listInput({ @@ -246,7 +258,9 @@ async function run({ token, config: { currentTeam, user } }) { const card = cards.cards.find(card => card.id === cardId) const elapsed = ms(new Date() - start) success( - `${card.brand} ending in ${card.last4} is now the default ${chalk.gray(`[${elapsed}]`)}` + `${card.brand} ending in ${card.last4} is now the default ${chalk.gray( + `[${elapsed}]` + )}` ) } else { console.log('No changes made') @@ -273,7 +287,9 @@ async function run({ token, config: { currentTeam, user } }) { if (cards.cards.length === 0) { error( - `You have no credit cards to choose from to delete under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}` + `You have no credit cards to choose from to delete under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` ) return exit(0) } @@ -282,7 +298,11 @@ async function run({ token, config: { currentTeam, user } }) { if (cardId === undefined) { const elapsed = ms(new Date() - start) - const message = `Selecting a card to ${chalk.underline('remove')} under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)} ${chalk.gray(`[${elapsed}]`)}` + const message = `Selecting a card to ${chalk.underline( + 'remove' + )} under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )} ${chalk.gray(`[${elapsed}]`)}` const choices = buildInquirerChoices(cards) cardId = await listInput({ @@ -322,7 +342,9 @@ async function run({ token, config: { currentTeam, user } }) { card => card.id === cards.defaultCardId ) - text += `\n${newDefaultCard.brand} ending in ${newDefaultCard.last4} in now default for ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}` + text += `\n${newDefaultCard.brand} ending in ${newDefaultCard.last4} in now default for ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` } } diff --git a/bin/now-certs.js b/bin/now-certs.js index d0b5708..2c03644 100755 --- a/bin/now-certs.js +++ b/bin/now-certs.js @@ -36,14 +36,20 @@ const help = () => { ${chalk.dim('Note:')} - This command is intended for advanced use only, normally ${chalk.bold('now')} manages your certificates automatically. + This command is intended for advanced use only, normally ${chalk.bold( + 'now' + )} manages your certificates automatically. ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token --crt ${chalk.bold.underline('FILE')} Certificate file --key ${chalk.bold.underline('FILE')} Certificate key file --ca ${chalk.bold.underline('FILE')} CA certificate chain file @@ -58,13 +64,19 @@ const help = () => { ${chalk.cyan('$ now certs create domain.com')} - ${chalk.gray('–')} Renewing an existing certificate issued with ${chalk.bold('now')}: + ${chalk.gray('–')} Renewing an existing certificate issued with ${chalk.bold( + 'now' + )}: ${chalk.cyan('$ now certs renew domain.com')} - ${chalk.gray('–')} Replacing an existing certificate with a user-supplied certificate: + ${chalk.gray( + '–' + )} Replacing an existing certificate with a user-supplied certificate: - ${chalk.cyan('$ now certs replace --crt domain.crt --key domain.key --ca ca_chain.crt domain.com')} + ${chalk.cyan( + '$ now certs replace --crt domain.crt --key domain.key --ca ca_chain.crt domain.com' + )} `) } @@ -124,7 +136,11 @@ async function run({ token, config: { currentTeam, user } }) { const elapsed = ms(new Date() - start) console.log( - `> ${list.length} certificate${list.length === 1 ? '' : 's'} found ${chalk.gray(`[${elapsed}]`)} under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}` + `> ${list.length} certificate${list.length === 1 + ? '' + : 's'} found ${chalk.gray(`[${elapsed}]`)} under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` ) if (list.length > 0) { @@ -167,7 +183,9 @@ async function run({ token, config: { currentTeam, user } }) { } else if (subcommand === 'create') { if (args.length !== 1) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now certs create `')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now certs create `' + )}` ) return exit(1) } @@ -178,7 +196,9 @@ async function run({ token, config: { currentTeam, user } }) { // Issue a custom certificate if (!argv.crt || !argv.key) { error( - `Missing required arguments for a custom certificate entry. Usage: ${chalk.cyan('`now certs create --crt DOMAIN.CRT --key DOMAIN.KEY [--ca CA.CRT] `')}` + `Missing required arguments for a custom certificate entry. Usage: ${chalk.cyan( + '`now certs create --crt DOMAIN.CRT --key DOMAIN.KEY [--ca CA.CRT] `' + )}` ) return exit(1) } @@ -198,12 +218,16 @@ async function run({ token, config: { currentTeam, user } }) { } const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Certificate entry ${chalk.bold(cn)} ${chalk.gray(`(${cert.uid})`)} created ${chalk.gray(`[${elapsed}]`)}` + `${chalk.cyan('> Success!')} Certificate entry ${chalk.bold( + cn + )} ${chalk.gray(`(${cert.uid})`)} created ${chalk.gray(`[${elapsed}]`)}` ) } else if (subcommand === 'renew') { if (args.length !== 1) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now certs renew `')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now certs renew `' + )}` ) return exit(1) } @@ -225,12 +249,16 @@ async function run({ token, config: { currentTeam, user } }) { await certs.renew(cert.cn) const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Certificate ${chalk.bold(cert.cn)} ${chalk.gray(`(${cert.uid})`)} renewed ${chalk.gray(`[${elapsed}]`)}` + `${chalk.cyan('> Success!')} Certificate ${chalk.bold( + cert.cn + )} ${chalk.gray(`(${cert.uid})`)} renewed ${chalk.gray(`[${elapsed}]`)}` ) } else if (subcommand === 'replace') { if (!argv.crt || !argv.key) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now certs replace --crt DOMAIN.CRT --key DOMAIN.KEY [--ca CA.CRT] `')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now certs replace --crt DOMAIN.CRT --key DOMAIN.KEY [--ca CA.CRT] `' + )}` ) return exit(1) } @@ -255,12 +283,16 @@ async function run({ token, config: { currentTeam, user } }) { await certs.put(cert.cn, crt, key, ca) const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Certificate ${chalk.bold(cert.cn)} ${chalk.gray(`(${cert.uid})`)} replaced ${chalk.gray(`[${elapsed}]`)}` + `${chalk.cyan('> Success!')} Certificate ${chalk.bold( + cert.cn + )} ${chalk.gray(`(${cert.uid})`)} replaced ${chalk.gray(`[${elapsed}]`)}` ) } else if (subcommand === 'rm' || subcommand === 'remove') { if (args.length !== 1) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now certs rm `')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now certs rm `' + )}` ) return exit(1) } @@ -281,7 +313,9 @@ async function run({ token, config: { currentTeam, user } }) { await certs.delete(cert.cn) const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Certificate ${chalk.bold(cert.cn)} ${chalk.gray(`(${cert.uid})`)} removed ${chalk.gray(`[${elapsed}]`)}` + `${chalk.cyan('> Success!')} Certificate ${chalk.bold( + cert.cn + )} ${chalk.gray(`(${cert.uid})`)} removed ${chalk.gray(`[${elapsed}]`)}` ) } else { error( @@ -334,7 +368,9 @@ async function getCertIdCn(certs, idOrCn, currentTeam, user) { if (!thecert) { error( - `No certificate found by id or cn "${idOrCn}" under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}` + `No certificate found by id or cn "${idOrCn}" under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` ) return null } diff --git a/bin/now-deploy.js b/bin/now-deploy.js index c5b363c..c5ddcc4 100755 --- a/bin/now-deploy.js +++ b/bin/now-deploy.js @@ -81,7 +81,9 @@ const help = () => { ${chalk.dim('Cloud')} - deploy [path] Performs a deployment ${chalk.bold('(default)')} + deploy [path] Performs a deployment ${chalk.bold( + '(default)' + )} ls | list [app] List deployments rm | remove [id] Remove a deployment ln | alias [id] [url] Configures aliases for deployments @@ -107,20 +109,32 @@ const help = () => { -h, --help Output usage information -v, --version Output the version number -n, --name Set the name of the deployment - -c ${chalk.underline('FILE')}, --config=${chalk.underline('FILE')} Config file + -c ${chalk.underline('FILE')}, --config=${chalk.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] -f, --force Force a new deployment even if nothing has changed - -t ${chalk.underline('TOKEN')}, --token=${chalk.underline('TOKEN')} Login token + -t ${chalk.underline('TOKEN')}, --token=${chalk.underline( + 'TOKEN' + )} Login token -L, --login Configure login -l, --links Copy symlinks without resolving their target - -p, --public Deployment is public (${chalk.dim('`/_src`')} is exposed) [on for oss, off for premium] - -e, --env Include an env var (e.g.: ${chalk.dim('`-e KEY=value`')}). Can appear many times. - -E ${chalk.underline('FILE')}, --dotenv=${chalk.underline('FILE')} Include env vars from .env file. Defaults to '.env' + -p, --public Deployment is public (${chalk.dim( + '`/_src`' + )} is exposed) [on for oss, off for premium] + -e, --env Include an env var (e.g.: ${chalk.dim( + '`-e KEY=value`' + )}). Can appear many times. + -E ${chalk.underline('FILE')}, --dotenv=${chalk.underline( + 'FILE' + )} Include env vars from .env file. Defaults to '.env' -C, --no-clipboard Do not attempt to copy URL to clipboard -N, --forward-npm Forward login information to install private npm modules --session-affinity Session affinity, \`ip\` (default) or \`random\` to control session affinity. - ${chalk.dim('Enforcable Types (when both package.json and Dockerfile exist):')} + ${chalk.dim( + 'Enforcable Types (when both package.json and Dockerfile exist):' + )} --npm Node.js application --docker Docker container @@ -146,9 +160,13 @@ const help = () => { ${chalk.gray('–')} Deploys with ENV vars - ${chalk.cyan('$ now -e NODE_ENV=production -e MYSQL_PASSWORD=@mysql-password')} + ${chalk.cyan( + '$ now -e NODE_ENV=production -e MYSQL_PASSWORD=@mysql-password' + )} - ${chalk.gray('–')} Displays comprehensive help for the subcommand ${chalk.dim('`list`')} + ${chalk.gray('–')} Displays comprehensive help for the subcommand ${chalk.dim( + '`list`' + )} ${chalk.cyan('$ now help list')} `) @@ -191,7 +209,9 @@ if (argv.config) { if (Array.isArray(autoAliases)) { console.log( - `${chalk.red('Deprecated!')} The option ${chalk.grey('--alias')} will be removed soon.` + `${chalk.red('Deprecated!')} The option ${chalk.grey( + '--alias' + )} will be removed soon.` ) console.log('Read more about the new way here: http://bit.ly/2l2v5Fg\n') } @@ -235,7 +255,9 @@ async function main() { `> Logged in successfully. Token saved to ${chalk.bold('~/.now.json')}.` ) console.log( - `> Run ${cmd('now')} to deploy the current directory, or ${cmd('now --help')} for usage info.\n` + `> Run ${cmd('now')} to deploy the current directory, or ${cmd( + 'now --help' + )} for usage info.\n` ) return exit(0) } @@ -300,7 +322,9 @@ async function sync({ token, config: { currentTeam, user } }) { } else if (isValidRepo) { const gitRef = gitRepo.ref ? `with "${chalk.bold(gitRepo.ref)}" ` : '' stopDeployment( - `There's no repository named "${chalk.bold(gitRepo.main)}" ${gitRef}on ${gitRepo.type}` + `There's no repository named "${chalk.bold( + gitRepo.main + )}" ${gitRef}on ${gitRepo.type}` ) } else { stopDeployment(`Could not read directory ${chalk.bold(path)}`) @@ -319,11 +343,17 @@ async function sync({ token, config: { currentTeam, user } }) { if (gitRepo.main) { const gitRef = gitRepo.ref ? ` at "${chalk.bold(gitRepo.ref)}" ` : '' console.log( - `> Deploying ${gitRepo.type} repository "${chalk.bold(gitRepo.main)}" ${gitRef} under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}` + `> Deploying ${gitRepo.type} repository "${chalk.bold( + gitRepo.main + )}" ${gitRef} under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` ) } else { console.log( - `> Deploying ${chalk.bold(toHumanPath(path))} under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}` + `> Deploying ${chalk.bold(toHumanPath(path))} under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` ) } } @@ -420,7 +450,9 @@ async function sync({ token, config: { currentTeam, user } }) { if (/[^A-z0-9_]/i.test(key)) { error( - `Invalid ${chalk.dim('-e')} key ${chalk.bold(`"${chalk.bold(key)}"`)}. Only letters, digits and underscores are allowed.` + `Invalid ${chalk.dim('-e')} key ${chalk.bold( + `"${chalk.bold(key)}"` + )}. Only letters, digits and underscores are allowed.` ) return process.exit(1) } @@ -433,13 +465,17 @@ async function sync({ token, config: { currentTeam, user } }) { if (val === undefined) { if (key in process.env) { console.log( - `> Reading ${chalk.bold(`"${chalk.bold(key)}"`)} from your env (as no value was specified)` + `> Reading ${chalk.bold( + `"${chalk.bold(key)}"` + )} from your env (as no value was specified)` ) // Escape value if it begins with @ val = process.env[key].replace(/^@/, '\\@') } else { error( - `No value specified for env ${chalk.bold(`"${chalk.bold(key)}"`)} and it was not found in your env.` + `No value specified for env ${chalk.bold( + `"${chalk.bold(key)}"` + )} and it was not found in your env.` ) return process.exit(1) } @@ -451,7 +487,9 @@ async function sync({ token, config: { currentTeam, user } }) { if (secrets.length === 0) { if (uidOrName === '') { error( - `Empty reference provided for env key ${chalk.bold(`"${chalk.bold(key)}"`)}` + `Empty reference provided for env key ${chalk.bold( + `"${chalk.bold(key)}"` + )}` ) } else { error( @@ -461,7 +499,9 @@ async function sync({ token, config: { currentTeam, user } }) { return process.exit(1) } else if (secrets.length > 1) { error( - `Ambiguous secret ${chalk.bold(`"${uidOrName}"`)} (matches ${chalk.bold(secrets.length)} secrets)` + `Ambiguous secret ${chalk.bold( + `"${uidOrName}"` + )} (matches ${chalk.bold(secrets.length)} secrets)` ) return process.exit(1) } @@ -515,7 +555,9 @@ async function sync({ token, config: { currentTeam, user } }) { try { await copy(url) console.log( - `${chalk.cyan('> Ready!')} ${chalk.bold(url)} (copied to clipboard) [${elapsed}]` + `${chalk.cyan('> Ready!')} ${chalk.bold( + url + )} (copied to clipboard) [${elapsed}]` ) } catch (err) { console.log(`${chalk.cyan('> Ready!')} ${chalk.bold(url)} [${elapsed}]`) @@ -556,7 +598,12 @@ async function sync({ token, config: { currentTeam, user } }) { if (plan.id === 'oss' && !wantsPublic) { if (isTTY) { info( - `${chalk.bold((currentTeam && `${currentTeam.slug} is`) || `You (${user.username || user.email}) are`)} on the OSS plan. Your code and logs will be made ${chalk.bold('public')}.` + `${chalk.bold( + (currentTeam && `${currentTeam.slug} is`) || + `You (${user.username || user.email}) are` + )} on the OSS plan. Your code and logs will be made ${chalk.bold( + 'public' + )}.` ) const proceed = await promptBool( @@ -589,7 +636,9 @@ async function sync({ token, config: { currentTeam, user } }) { ) } const size = bytes(now.syncAmount) - const syncCount = `${now.syncFileCount} file${now.syncFileCount > 1 ? 's' : ''}` + const syncCount = `${now.syncFileCount} file${now.syncFileCount > 1 + ? 's' + : ''}` const bar = new Progress( `> Upload [:bar] :percent :etas (${size}) [${syncCount}]`, { @@ -680,7 +729,9 @@ async function readMeta(path, deploymentName, deploymentType, sessionAffinity) { } console.log( - `> Two manifests found. Press [${chalk.bold('n')}] to deploy or re-run with --flag` + `> Two manifests found. Press [${chalk.bold( + 'n' + )}] to deploy or re-run with --flag` ) deploymentType = await promptOptions([ @@ -708,7 +759,9 @@ function printLogs(host, token, currentTeam, user) { if (!quiet) { if (err && err.type === 'BUILD_ERROR') { error( - `The build step of your project failed. To retry, run ${cmd('now --force')}.` + `The build step of your project failed. To retry, run ${cmd( + 'now --force' + )}.` ) } else { error('Deployment failed') diff --git a/bin/now-dns.js b/bin/now-dns.js index e49d9aa..252a69a 100755 --- a/bin/now-dns.js +++ b/bin/now-dns.js @@ -33,17 +33,25 @@ const subcommand = argv._[0] const help = () => { console.log(` ${chalk.bold(`${logo} now dns ls`)} [domain] - ${chalk.bold(`${logo} now dns add`)} + ${chalk.bold( + `${logo} now dns add` + )} ${chalk.bold(`${logo} now dns add`)} MX - ${chalk.bold(`${logo} now dns add`)} SRV + ${chalk.bold( + `${logo} now dns add` + )} SRV ${chalk.bold(`${logo} now dns rm`)} ${chalk.dim('Options:')} -h, --help output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} config file -d, --debug debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} login token ${chalk.dim('Examples:')} @@ -53,12 +61,16 @@ const help = () => { ${chalk.gray('–')} Add an A record for a subdomain - ${chalk.cyan('$ now dns add A ')} + ${chalk.cyan( + '$ now dns add A ' + )} ${chalk.cyan('$ now dns add zeit.rocks api A 198.51.100.100')} ${chalk.gray('–')} Add an MX record (@ as a name refers to the domain) - ${chalk.cyan('$ now dns add @ MX ')} + ${chalk.cyan( + '$ now dns add @ MX ' + )} ${chalk.cyan('$ now dns add zeit.rocks @ MX mail.zeit.rocks 10')} `) } @@ -102,7 +114,9 @@ async function run({ token, config: { currentTeam, user } }) { if (subcommand === 'ls' || subcommand === 'list') { if (args.length > 1) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now dns ls [domain]`')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now dns ls [domain]`' + )}` ) return exit(1) } @@ -152,21 +166,33 @@ async function run({ token, config: { currentTeam, user } }) { } }) console.log( - `> ${count} record${count === 1 ? '' : 's'} found ${chalk.gray(`[${elapsed}]`)} under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}` + `> ${count} record${count === 1 ? '' : 's'} found ${chalk.gray( + `[${elapsed}]` + )} under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}` ) console.log(text.join('')) } else if (subcommand === 'add') { const param = parseAddArgs(args) if (!param) { error( - `Invalid number of arguments. See: ${chalk.cyan('`now dns --help`')} for usage.` + `Invalid number of arguments. See: ${chalk.cyan( + '`now dns --help`' + )} for usage.` ) return exit(1) } const record = await domainRecords.create(param.domain, param.data) const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} A new DNS record for domain ${chalk.bold(param.domain)} ${chalk.gray(`(${record.uid})`)} created ${chalk.gray(`[${elapsed}]`)} (${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)})` + `${chalk.cyan('> Success!')} A new DNS record for domain ${chalk.bold( + param.domain + )} ${chalk.gray(`(${record.uid})`)} created ${chalk.gray( + `[${elapsed}]` + )} (${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )})` ) } else if (subcommand === 'rm' || subcommand === 'remove') { if (args.length !== 1) { @@ -194,7 +220,9 @@ async function run({ token, config: { currentTeam, user } }) { await domainRecords.delete(record.domain, record.id) const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Record ${chalk.gray(`${record.id}`)} removed ${chalk.gray(`[${elapsed}]`)}` + `${chalk.cyan('> Success!')} Record ${chalk.gray( + `${record.id}` + )} removed ${chalk.gray(`[${elapsed}]`)}` ) } else { error('Please specify a valid subcommand: ls | add | rm') @@ -281,7 +309,11 @@ function readConfirmation(record, msg) { [ record.id, chalk.bold( - `${record.name.length > 0 ? record.name + '.' : ''}${record.domain} ${record.type} ${record.value} ${record.mxPriority ? record.mxPriority : ''}` + `${record.name.length > 0 + ? record.name + '.' + : ''}${record.domain} ${record.type} ${record.value} ${record.mxPriority + ? record.mxPriority + : ''}` ), time ] diff --git a/bin/now-domains.js b/bin/now-domains.js index a4def98..9c639fd 100755 --- a/bin/now-domains.js +++ b/bin/now-domains.js @@ -42,11 +42,15 @@ const help = () => { ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] -e, --external Use external DNS server -f, --force Skip DNS verification - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token ${chalk.dim('Examples:')} @@ -64,19 +68,43 @@ const help = () => { Make sure the domain's DNS nameservers are at least 2 of these: - ${chalk.gray('–')} ${chalk.underline('california.zeit.world')} ${chalk.dim('173.255.215.107')} - ${chalk.gray('–')} ${chalk.underline('london.zeit.world')} ${chalk.dim('178.62.47.76')} - ${chalk.gray('–')} ${chalk.underline('newark.zeit.world')} ${chalk.dim('173.255.231.87')} - ${chalk.gray('–')} ${chalk.underline('amsterdam.zeit.world')} ${chalk.dim('188.226.197.55')} - ${chalk.gray('–')} ${chalk.underline('dallas.zeit.world')} ${chalk.dim('173.192.101.194')} - ${chalk.gray('–')} ${chalk.underline('paris.zeit.world')} ${chalk.dim('37.123.115.172')} - ${chalk.gray('–')} ${chalk.underline('singapore.zeit.world')} ${chalk.dim('119.81.97.170')} - ${chalk.gray('–')} ${chalk.underline('sydney.zeit.world')} ${chalk.dim('52.64.171.200')} - ${chalk.gray('–')} ${chalk.underline('frankfurt.zeit.world')} ${chalk.dim('91.109.245.139')} - ${chalk.gray('–')} ${chalk.underline('iowa.zeit.world')} ${chalk.dim('23.236.59.22')} - - ${chalk.yellow('NOTE:')} running ${chalk.dim('`now alias`')} will automatically register your domain - if it's configured with these nameservers (no need to ${chalk.dim('`domain add`')}). + ${chalk.gray('–')} ${chalk.underline( + 'california.zeit.world' + )} ${chalk.dim('173.255.215.107')} + ${chalk.gray('–')} ${chalk.underline( + 'london.zeit.world' + )} ${chalk.dim('178.62.47.76')} + ${chalk.gray('–')} ${chalk.underline( + 'newark.zeit.world' + )} ${chalk.dim('173.255.231.87')} + ${chalk.gray('–')} ${chalk.underline( + 'amsterdam.zeit.world' + )} ${chalk.dim('188.226.197.55')} + ${chalk.gray('–')} ${chalk.underline( + 'dallas.zeit.world' + )} ${chalk.dim('173.192.101.194')} + ${chalk.gray('–')} ${chalk.underline( + 'paris.zeit.world' + )} ${chalk.dim('37.123.115.172')} + ${chalk.gray('–')} ${chalk.underline( + 'singapore.zeit.world' + )} ${chalk.dim('119.81.97.170')} + ${chalk.gray('–')} ${chalk.underline( + 'sydney.zeit.world' + )} ${chalk.dim('52.64.171.200')} + ${chalk.gray('–')} ${chalk.underline( + 'frankfurt.zeit.world' + )} ${chalk.dim('91.109.245.139')} + ${chalk.gray('–')} ${chalk.underline( + 'iowa.zeit.world' + )} ${chalk.dim('23.236.59.22')} + + ${chalk.yellow('NOTE:')} running ${chalk.dim( + '`now alias`' + )} will automatically register your domain + if it's configured with these nameservers (no need to ${chalk.dim( + '`domain add`' + )}). For more details head to ${chalk.underline('https://zeit.world')}. @@ -90,13 +118,17 @@ const help = () => { To get the list of domain ids, use ${chalk.dim('`now domains ls`')}. - ${chalk.gray('–')} Adding and verifying a domain name using zeit.world nameservers: + ${chalk.gray( + '–' + )} Adding and verifying a domain name using zeit.world nameservers: ${chalk.cyan('$ now domain add my-app.com')} The command will tell you if the domain was verified succesfully. In case the domain was not verified succesfully you should retry adding the domain after some time. - ${chalk.gray('–')} Adding and verifying a domain name using an external nameserver: + ${chalk.gray( + '–' + )} Adding and verifying a domain name using an external nameserver: ${chalk.cyan('$ now domain add -e my-app.com')} @@ -180,7 +212,11 @@ async function run({ token, config: { currentTeam, user } }) { const elapsed_ = ms(new Date() - start_) console.log( - `> ${domains.length} domain${domains.length === 1 ? '' : 's'} found under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)} ${chalk.gray(`[${elapsed_}]`)}` + `> ${domains.length} domain${domains.length === 1 + ? '' + : 's'} found under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )} ${chalk.gray(`[${elapsed_}]`)}` ) if (out) { @@ -208,7 +244,9 @@ async function run({ token, config: { currentTeam, user } }) { if (!_domain) { const err = new Error( - `Domain not found by "${_target}". Run ${chalk.dim('`now domains ls`')} to see your domains.` + `Domain not found by "${_target}". Run ${chalk.dim( + '`now domains ls`' + )} to see your domains.` ) err.userError = true throw err @@ -229,7 +267,9 @@ async function run({ token, config: { currentTeam, user } }) { await domain.rm(_domain.name) const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Domain ${chalk.bold(_domain.uid)} removed [${elapsed}]` + `${chalk.cyan('> Success!')} Domain ${chalk.bold( + _domain.uid + )} removed [${elapsed}]` ) } catch (err) { error(err) @@ -254,15 +294,21 @@ async function run({ token, config: { currentTeam, user } }) { const elapsed = ms(new Date() - start) if (created) { console.log( - `${chalk.cyan('> Success!')} Domain ${chalk.bold(chalk.underline(name))} ${chalk.dim(`(${uid})`)} added [${elapsed}]` + `${chalk.cyan('> Success!')} Domain ${chalk.bold( + chalk.underline(name) + )} ${chalk.dim(`(${uid})`)} added [${elapsed}]` ) } else if (verified) { console.log( - `${chalk.cyan('> Success!')} Domain ${chalk.bold(chalk.underline(name))} ${chalk.dim(`(${uid})`)} verified [${elapsed}]` + `${chalk.cyan('> Success!')} Domain ${chalk.bold( + chalk.underline(name) + )} ${chalk.dim(`(${uid})`)} verified [${elapsed}]` ) } else if (code === 'not_modified') { console.log( - `${chalk.cyan('> Success!')} Domain ${chalk.bold(chalk.underline(name))} ${chalk.dim(`(${uid})`)} already exists [${elapsed}]` + `${chalk.cyan('> Success!')} Domain ${chalk.bold( + chalk.underline(name) + )} ${chalk.dim(`(${uid})`)} already exists [${elapsed}]` ) } else { console.log( @@ -303,7 +349,11 @@ async function readConfirmation(domain, _domain) { if (_domain.aliases.length > 0) { process.stdout.write( `> ${chalk.yellow('Warning!')} This domain's ` + - `${chalk.bold(_domain.aliases.length + ' alias' + (_domain.aliases.length === 1 ? '' : 'es'))} ` + + `${chalk.bold( + _domain.aliases.length + + ' alias' + + (_domain.aliases.length === 1 ? '' : 'es') + )} ` + `will be removed. Run ${chalk.dim('`now alias ls`')} to list.\n` ) } diff --git a/bin/now-list.js b/bin/now-list.js index ee7f11f..41bd93a 100755 --- a/bin/now-list.js +++ b/bin/now-list.js @@ -34,9 +34,13 @@ const help = () => { ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token ${chalk.dim('Examples:')} @@ -145,7 +149,11 @@ async function list({ token, config: { currentTeam, user } }) { }, 0) + 5 const timeNow = new Date() console.log( - `> ${deployments.length} deployment${deployments.length === 1 ? '' : 's'} found under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)} ${chalk.grey('[' + ms(timeNow - start) + ']')}` + `> ${deployments.length} deployment${deployments.length === 1 + ? '' + : 's'} found under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )} ${chalk.grey('[' + ms(timeNow - start) + ']')}` ) let shouldShowAllInfo = false @@ -161,14 +169,18 @@ async function list({ token, config: { currentTeam, user } }) { } if (!argv.all && shouldShowAllInfo) { console.log( - `> To expand the list and see instances run ${chalk.cyan('`now ls --all [app]`')}` + `> To expand the list and see instances run ${chalk.cyan( + '`now ls --all [app]`' + )}` ) } console.log() sorted.forEach(([name, deps]) => { const listedDeployments = argv.all ? deps : deps.slice(0, 5) console.log( - `${chalk.bold(name)} ${chalk.gray('(' + listedDeployments.length + ' of ' + deps.length + ' total)')}` + `${chalk.bold(name)} ${chalk.gray( + '(' + listedDeployments.length + ' of ' + deps.length + ' total)' + )}` ) const urlSpec = `%-${urlLength}s` console.log( diff --git a/bin/now-logout.js b/bin/now-logout.js index bc233ff..abc598e 100644 --- a/bin/now-logout.js +++ b/bin/now-logout.js @@ -26,7 +26,9 @@ const help = () => { ${chalk.dim('Options:')} -h, --help output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} config file ${chalk.dim('Examples:')} diff --git a/bin/now-logs.js b/bin/now-logs.js index 71487d7..74139b8 100644 --- a/bin/now-logs.js +++ b/bin/now-logs.js @@ -36,18 +36,30 @@ const help = () => { -h, --help output usage information -a, --all include access logs - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} config file -d, --debug debug mode [off] -f wait for additional data [off] -n ${chalk.bold.underline('NUMBER')} number of logs [1000] - -q ${chalk.bold.underline('QUERY')}, --query=${chalk.bold.underline('QUERY')} search query - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} login token - --since=${chalk.bold.underline('SINCE')} only return logs after date (ISO 8601) - --until=${chalk.bold.underline('UNTIL')} only return logs before date (ISO 8601), ignored if the f option is enbled. + -q ${chalk.bold.underline('QUERY')}, --query=${chalk.bold.underline( + 'QUERY' + )} search query + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} login token + --since=${chalk.bold.underline( + 'SINCE' + )} only return logs after date (ISO 8601) + --until=${chalk.bold.underline( + 'UNTIL' + )} only return logs before date (ISO 8601), ignored if the f option is enbled. ${chalk.dim('Examples:')} - ${chalk.gray('–')} Print logs for the deployment ${chalk.dim('`deploymentId`')} + ${chalk.gray('–')} Print logs for the deployment ${chalk.dim( + '`deploymentId`' + )} ${chalk.cyan('$ now logs deploymentId')} `) diff --git a/bin/now-remove.js b/bin/now-remove.js index 3e20c5d..6c74f64 100755 --- a/bin/now-remove.js +++ b/bin/now-remove.js @@ -31,20 +31,28 @@ const ids = argv._ // Options const help = () => { console.log(` - ${chalk.bold(`${logo} now remove`)} deploymentId|deploymentName [...deploymentId|deploymentName] + ${chalk.bold( + `${logo} now remove` + )} deploymentId|deploymentName [...deploymentId|deploymentName] ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token -y, --yes Skip confirmation --safe Skip deployments with an active alias ${chalk.dim('Examples:')} - ${chalk.gray('–')} Remove a deployment identified by ${chalk.dim('`deploymentId`')}: + ${chalk.gray('–')} Remove a deployment identified by ${chalk.dim( + '`deploymentId`' + )}: ${chalk.cyan('$ now rm deploymentId')} @@ -52,7 +60,9 @@ const help = () => { ${chalk.cyan('$ now rm my-app')} - ${chalk.gray('–')} Remove two deployments with IDs ${chalk.dim('`eyWt6zuSdeus`')} and ${chalk.dim('`uWHoA9RQ1d1o`')}: + ${chalk.gray('–')} Remove two deployments with IDs ${chalk.dim( + '`eyWt6zuSdeus`' + )} and ${chalk.dim('`uWHoA9RQ1d1o`')}: ${chalk.cyan('$ now rm eyWt6zuSdeus uWHoA9RQ1d1o')} @@ -97,7 +107,9 @@ Promise.resolve().then(async () => { function readConfirmation(matches) { return new Promise(resolve => { process.stdout.write( - `> The following deployment${matches.length === 1 ? '' : 's'} will be removed permanently:\n` + `> The following deployment${matches.length === 1 + ? '' + : 's'} will be removed permanently:\n` ) const tbl = table( @@ -118,7 +130,9 @@ function readConfirmation(matches) { } process.stdout.write( `> ${chalk.yellow('Warning!')} Deployment ${chalk.bold(depl.uid)} ` + - `is an alias for ${chalk.underline(`https://${alias.alias}`)} and will be removed.\n` + `is an alias for ${chalk.underline( + `https://${alias.alias}` + )} and will be removed.\n` ) } } diff --git a/bin/now-scale.js b/bin/now-scale.js index 31901ec..7ee062a 100755 --- a/bin/now-scale.js +++ b/bin/now-scale.js @@ -40,7 +40,9 @@ const help = () => { ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] ${chalk.dim('Examples:')} @@ -53,15 +55,21 @@ const help = () => { ${chalk.cyan('$ now scale my-deployment-ntahoeato.now.sh 1 5')} - ${chalk.gray('–')} Create an automatically scaling deployment without specifying max: + ${chalk.gray( + '–' + )} Create an automatically scaling deployment without specifying max: ${chalk.cyan('$ now scale my-deployment-ntahoeato.now.sh 1 auto')} - ${chalk.gray('–')} Create an automatically scaling deployment without specifying min or max: + ${chalk.gray( + '–' + )} Create an automatically scaling deployment without specifying min or max: ${chalk.cyan('$ now scale my-deployment-ntahoeato.now.sh auto')} - ${chalk.gray('–')} Create an deployment that is always active and never "sleeps": + ${chalk.gray( + '–' + )} Create an deployment that is always active and never "sleeps": ${chalk.cyan('$ now scale my-deployment-ntahoeato.now.sh 1')} `) @@ -246,7 +254,9 @@ function printScaleingRules(url, currentReplicas, min, max, elapsed) { ) log() log( - `${chalk.bold(url)} (${chalk.gray(currentReplicas)} ${chalk.gray('current')})` + `${chalk.bold(url)} (${chalk.gray(currentReplicas)} ${chalk.gray( + 'current' + )})` ) log(printf('%6s %s', 'min', chalk.bold(min))) log(printf('%6s %s', 'max', chalk.bold(max))) @@ -284,7 +294,9 @@ async function list(scale) { for (const app of sorted) { const depls = argv.all ? app[1] : app[1].slice(0, 5) console.log( - `${chalk.bold(app[0])} ${chalk.gray('(' + depls.length + ' of ' + app[1].length + ' total)')}` + `${chalk.bold(app[0])} ${chalk.gray( + '(' + depls.length + ' of ' + app[1].length + ' total)' + )}` ) console.log() const urlSpec = `%-${urlLength}s` diff --git a/bin/now-secrets.js b/bin/now-secrets.js index 08ad50d..86259cd 100755 --- a/bin/now-secrets.js +++ b/bin/now-secrets.js @@ -38,9 +38,13 @@ const help = () => { -h, --help Output usage information -b, --base64 Treat value as base64-encoded - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token ${chalk.dim('Examples:')} @@ -52,15 +56,21 @@ const help = () => { ${chalk.cyan('$ now secrets add my-secret "my value"')} - ${chalk.gray('–')} Once added, a secret's value can't be retrieved in plaintext anymore - ${chalk.gray('–')} If the secret's value is more than one word, wrap it in quotes + ${chalk.gray( + '–' + )} Once added, a secret's value can't be retrieved in plaintext anymore + ${chalk.gray( + '–' + )} If the secret's value is more than one word, wrap it in quotes ${chalk.gray('–')} Actually, when in doubt, wrap your value in quotes ${chalk.gray('–')} Exposes a secret as an env variable: ${chalk.cyan(`$ now -e MY_SECRET=${chalk.bold('@my-secret')}`)} - Notice the ${chalk.cyan.bold('`@`')} symbol which makes the value a secret reference. + Notice the ${chalk.cyan.bold( + '`@`' + )} symbol which makes the value a secret reference. ${chalk.gray('–')} Renames a secret: @@ -121,7 +131,11 @@ async function run({ token, config: { currentTeam, user } }) { const elapsed = ms(new Date() - start) console.log( - `> ${list.length} secret${list.length === 1 ? '' : 's'} found under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)} ${chalk.gray(`[${elapsed}]`)}` + `> ${list.length} secret${list.length === 1 + ? '' + : 's'} found under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )} ${chalk.gray(`[${elapsed}]`)}` ) if (list.length > 0) { @@ -155,7 +169,9 @@ async function run({ token, config: { currentTeam, user } }) { if (subcommand === 'rm' || subcommand === 'remove') { if (args.length !== 1) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now secret rm `')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now secret rm `' + )}` ) return exit(1) } @@ -178,7 +194,9 @@ async function run({ token, config: { currentTeam, user } }) { const secret = await secrets.rm(args[0]) const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Secret ${chalk.bold(secret.name)} ${chalk.gray(`(${secret.uid})`)} removed ${chalk.gray(`[${elapsed}]`)}` + `${chalk.cyan('> Success!')} Secret ${chalk.bold( + secret.name + )} ${chalk.gray(`(${secret.uid})`)} removed ${chalk.gray(`[${elapsed}]`)}` ) return secrets.close() } @@ -186,14 +204,20 @@ async function run({ token, config: { currentTeam, user } }) { if (subcommand === 'rename') { if (args.length !== 2) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now secret rename `')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now secret rename `' + )}` ) return exit(1) } const secret = await secrets.rename(args[0], args[1]) const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Secret ${chalk.bold(secret.oldName)} ${chalk.gray(`(${secret.uid})`)} renamed to ${chalk.bold(args[1])} ${chalk.gray(`[${elapsed}]`)}` + `${chalk.cyan('> Success!')} Secret ${chalk.bold( + secret.oldName + )} ${chalk.gray(`(${secret.uid})`)} renamed to ${chalk.bold( + args[1] + )} ${chalk.gray(`[${elapsed}]`)}` ) return secrets.close() } @@ -201,7 +225,9 @@ async function run({ token, config: { currentTeam, user } }) { if (subcommand === 'add' || subcommand === 'set') { if (args.length !== 2) { error( - `Invalid number of arguments. Usage: ${chalk.cyan('`now secret add `')}` + `Invalid number of arguments. Usage: ${chalk.cyan( + '`now secret add `' + )}` ) if (args.length > 2) { @@ -227,7 +253,11 @@ async function run({ token, config: { currentTeam, user } }) { const elapsed = ms(new Date() - start) console.log( - `${chalk.cyan('> Success!')} Secret ${chalk.bold(name.toLowerCase())} ${chalk.gray(`(${secret.uid})`)} added (${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}) ${chalk.gray(`[${elapsed}]`)}` + `${chalk.cyan('> Success!')} Secret ${chalk.bold( + name.toLowerCase() + )} ${chalk.gray(`(${secret.uid})`)} added (${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}) ${chalk.gray(`[${elapsed}]`)}` ) return secrets.close() } diff --git a/bin/now-teams.js b/bin/now-teams.js index ec45eb3..cef2ba3 100644 --- a/bin/now-teams.js +++ b/bin/now-teams.js @@ -36,9 +36,13 @@ const help = () => { ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token ${chalk.dim('Examples:')} @@ -52,7 +56,9 @@ const help = () => { ${chalk.gray('–')} If the id is omitted, you can choose interactively - ${chalk.yellow('NOTE:')} When you switch, everything you add, list or remove will be scoped that team! + ${chalk.yellow( + 'NOTE:' + )} When you switch, everything you add, list or remove will be scoped that team! ${chalk.gray('–')} Invite new members (interactively): diff --git a/bin/now-upgrade.js b/bin/now-upgrade.js index b4f05b7..0ad7d45 100644 --- a/bin/now-upgrade.js +++ b/bin/now-upgrade.js @@ -37,9 +37,13 @@ const help = () => { ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token ${chalk.dim('Examples:')} @@ -47,7 +51,9 @@ const help = () => { ${chalk.cyan('$ now upgrade')} - ${chalk.yellow('NOTE:')} ${chalk.gray('Make sure you have a payment method, or add one:')} + ${chalk.yellow('NOTE:')} ${chalk.gray( + 'Make sure you have a payment method, or add one:' + )} ${chalk.cyan(`$ now billing add`)} @@ -187,7 +193,9 @@ async function run({ token, config: { currentTeam, user } }) { message = currentTeam ? `${message}/${currentTeam.slug}/settings/plan` : `${message}/account/plan` - message += `\n> Select a plan for ${bold((currentTeam && currentTeam.slug) || user.username || user.email)} ${chalk.gray(`[${elapsed}]`)}` + message += `\n> Select a plan for ${bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )} ${chalk.gray(`[${elapsed}]`)}` const choices = buildInquirerChoices(currentPlan.id, currentPlan.until) planId = await listInput({ @@ -212,7 +220,9 @@ async function run({ token, config: { currentTeam, user } }) { } catch (err) { if (err.code === 'customer_not_found' || err.code === 'source_not_found') { error( - `You have no payment methods available. Run ${cmd('now billing add')} to add one` + `You have no payment methods available. Run ${cmd( + 'now billing add' + )} to add one` ) } else { error(`An unknow error occured. Please try again later ${err.message}`) @@ -223,11 +233,15 @@ async function run({ token, config: { currentTeam, user } }) { if (currentPlan.until && newPlan.id !== 'oss') { success( - `The cancelation has been undone. You're back on the ${chalk.bold(`${newPlan.name} plan`)}` + `The cancelation has been undone. You're back on the ${chalk.bold( + `${newPlan.name} plan` + )}` ) } else if (newPlan.until) { success( - `Your plan will be switched to ${chalk.bold(newPlan.name)} in ${chalk.bold(newPlan.until)}. Your card will not be charged again` + `Your plan will be switched to ${chalk.bold( + newPlan.name + )} in ${chalk.bold(newPlan.until)}. Your card will not be charged again` ) } else { success(`You're now on the ${chalk.bold(`${newPlan.name} plan`)}`) diff --git a/bin/now-whoami.js b/bin/now-whoami.js index 94497a4..3a6286d 100644 --- a/bin/now-whoami.js +++ b/bin/now-whoami.js @@ -28,9 +28,13 @@ const help = () => { ${chalk.dim('Options:')} -h, --help Output usage information - -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file + -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline( + 'FILE' + )} Config file -d, --debug Debug mode [off] - -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline( + 'TOKEN' + )} Login token ${chalk.dim('Examples:')} diff --git a/bin/now.js b/bin/now.js index a5f847c..9c6d7c2 100755 --- a/bin/now.js +++ b/bin/now.js @@ -31,8 +31,12 @@ if (process.pkg) { const update = notifier.update if (update) { - let message = `Update available! ${chalk.red(update.current)} → ${chalk.green(update.latest)} \n` - message += `${chalk.magenta('Changelog:')} https://github.com/zeit/now-cli/releases/tag/${update.latest}\n` + let message = `Update available! ${chalk.red( + update.current + )} → ${chalk.green(update.latest)} \n` + message += `${chalk.magenta( + 'Changelog:' + )} https://github.com/zeit/now-cli/releases/tag/${update.latest}\n` if (pkg._npmPkg) { message += `Run ${chalk.magenta('npm i -g now')} to update!` diff --git a/bin/teams/add.js b/bin/teams/add.js index cf25050..13cb489 100644 --- a/bin/teams/add.js +++ b/bin/teams/add.js @@ -26,7 +26,9 @@ function validateSlugKeypress(data, value) { function gracefulExit() { console.log() // Blank line note( - `Your team is now active for all ${cmd('now')} commands!\n Run ${cmd('now switch')} to change it in the future.` + `Your team is now active for all ${cmd('now')} commands!\n Run ${cmd( + 'now switch' + )} to change it in the future.` ) return exit() } @@ -122,8 +124,11 @@ module.exports = async function({ teams, token }) { teams, args: [], token, - introMsg: 'Invite your team mates! When done, press enter on an empty field', - noopMsg: `You can invite team mates later by running ${cmd('now teams invite')}` + introMsg: + 'Invite your team mates! When done, press enter on an empty field', + noopMsg: `You can invite team mates later by running ${cmd( + 'now teams invite' + )}` }) gracefulExit() diff --git a/bin/teams/invite.js b/bin/teams/invite.js index 2e1dc40..e0c6908 100644 --- a/bin/teams/invite.js +++ b/bin/teams/invite.js @@ -68,7 +68,9 @@ module.exports = async function( domains.push(user.email.split('@')[1]) if (!currentTeam) { - let err = `You can't run this command under ${param(user.username || user.email)}.\n` + let err = `You can't run this command under ${param( + user.username || user.email + )}.\n` err += `${chalk.gray('>')} Run ${cmd('now switch')} to choose to a team.` return fatalError(err) } diff --git a/lib/alias.js b/lib/alias.js index 63c64a1..6a8343e 100644 --- a/lib/alias.js +++ b/lib/alias.js @@ -41,7 +41,9 @@ module.exports = class Alias extends Now { if (!target) { const err = new Error( - `Aliases not found by "${deployment}". Run ${chalk.dim('`now alias ls`')} to see your aliases.` + `Aliases not found by "${deployment}". Run ${chalk.dim( + '`now alias ls`' + )} to see your aliases.` ) err.userError = true throw err @@ -146,7 +148,9 @@ module.exports = class Alias extends Now { if (code === 'custom_domain_needs_upgrade') { const err = new Error( - `Custom domains are only enabled for premium accounts. Please upgrade by running ${chalk.gray('`')}${chalk.cyan('now upgrade')}${chalk.gray('`')}.` + `Custom domains are only enabled for premium accounts. Please upgrade by running ${chalk.gray( + '`' + )}${chalk.cyan('now upgrade')}${chalk.gray('`')}.` ) err.userError = true return bail(err) @@ -154,7 +158,9 @@ module.exports = class Alias extends Now { if (code === 'alias_in_use') { const err = new Error( - `The alias you are trying to configure (${chalk.underline(chalk.bold(alias))}) is already in use by a different account.` + `The alias you are trying to configure (${chalk.underline( + chalk.bold(alias) + )}) is already in use by a different account.` ) err.userError = true return bail(err) @@ -177,7 +183,9 @@ module.exports = class Alias extends Now { if (code === 'cert_missing') { console.log( - `> Provisioning certificate for ${chalk.underline(chalk.bold(alias))}` + `> Provisioning certificate for ${chalk.underline( + chalk.bold(alias) + )}` ) try { @@ -236,7 +244,9 @@ module.exports = class Alias extends Now { const depl = await this.findDeployment(deployment) if (!depl) { const err = new Error( - `Deployment not found by "${deployment}". Run ${chalk.dim('`now ls`')} to see your deployments.` + `Deployment not found by "${deployment}". Run ${chalk.dim( + '`now ls`' + )} to see your deployments.` ) err.userError = true throw err @@ -247,7 +257,10 @@ module.exports = class Alias extends Now { if (isTTY) { try { const msg = - `> Path alias exists with ${aliasDepl.rules.length} rule${aliasDepl.rules.length > 1 ? 's' : ''}.\n` + + `> Path alias exists with ${aliasDepl.rules.length} rule${aliasDepl + .rules.length > 1 + ? 's' + : ''}.\n` + `> Are you sure you want to update ${alias} to be a normal alias?\n` const confirmation = await promptBool(msg, { @@ -263,7 +276,10 @@ module.exports = class Alias extends Now { } } else { console.log( - `Overwriting path alias with ${aliasDepl.rules.length} rule${aliasDepl.rules.length > 1 ? 's' : ''} to be a normal alias.` + `Overwriting path alias with ${aliasDepl.rules.length} rule${aliasDepl + .rules.length > 1 + ? 's' + : ''} to be a normal alias.` ) } } @@ -282,11 +298,15 @@ module.exports = class Alias extends Now { ) { shouldScaleDown = true console.log( - `> Alias ${alias} points to ${chalk.bold(aliasedDeployment.url)} (${chalk.bold(aliasedDeployment.scale.current + ' instances')})` + `> Alias ${alias} points to ${chalk.bold( + aliasedDeployment.url + )} (${chalk.bold(aliasedDeployment.scale.current + ' instances')})` ) // Test if we need to change the scale or just update the rules console.log( - `> Scaling ${depl.url} to ${chalk.bold(aliasedDeployment.scale.current + ' instances')} atomically` + `> Scaling ${depl.url} to ${chalk.bold( + aliasedDeployment.scale.current + ' instances' + )} atomically` ) if (depl.scale.current !== aliasedDeployment.scale.current) { if (depl.scale.max < 1) { @@ -340,12 +360,18 @@ module.exports = class Alias extends Now { const newAlias = await this.createAlias(depl, alias) if (!newAlias) { throw new Error( - `Unexpected error occurred while setting up alias: ${JSON.stringify(newAlias)}` + `Unexpected error occurred while setting up alias: ${JSON.stringify( + newAlias + )}` ) } const { created, uid } = newAlias if (created) { - const output = `${chalk.cyan('> Success!')} ${alias} now points to ${chalk.bold(depl.url)}! ${chalk.grey('[' + ms(Date.now() - aliasTime) + ']')}` + const output = `${chalk.cyan( + '> Success!' + )} ${alias} now points to ${chalk.bold(depl.url)}! ${chalk.grey( + '[' + ms(Date.now() - aliasTime) + ']' + )}` if (isTTY && clipboard) { try { await copy(depl.url) @@ -358,14 +384,20 @@ module.exports = class Alias extends Now { } } else { console.log( - `${chalk.cyan('> Success!')} Alias already exists ${chalk.dim(`(${uid})`)}.` + `${chalk.cyan('> Success!')} Alias already exists ${chalk.dim( + `(${uid})` + )}.` ) } if (aliasedDeployment && shouldScaleDown) { const scaleDown = Date.now() await this.setScale(aliasedDeployment.uid, { min: 0, max: 1 }) console.log( - `> Scaled ${chalk.gray(aliasedDeployment.url)} down to 1 instance ${chalk.gray('[' + ms(Date.now() - scaleDown) + ']')}` + `> Scaled ${chalk.gray( + aliasedDeployment.url + )} down to 1 instance ${chalk.gray( + '[' + ms(Date.now() - scaleDown) + ']' + )}` ) } } @@ -401,7 +433,9 @@ module.exports = class Alias extends Now { if (code === 'custom_domain_needs_upgrade') { const err = new Error( - `Custom domains are only enabled for premium accounts. Please upgrade by running ${chalk.gray('`')}${chalk.cyan('now upgrade')}${chalk.gray('`')}.` + `Custom domains are only enabled for premium accounts. Please upgrade by running ${chalk.gray( + '`' + )}${chalk.cyan('now upgrade')}${chalk.gray('`')}.` ) err.userError = true return bail(err) @@ -409,7 +443,9 @@ module.exports = class Alias extends Now { if (code === 'alias_in_use') { const err = new Error( - `The alias you are trying to configure (${chalk.underline(chalk.bold(alias))}) is already in use by a different account.` + `The alias you are trying to configure (${chalk.underline( + chalk.bold(alias) + )}) is already in use by a different account.` ) err.userError = true return bail(err) @@ -436,7 +472,9 @@ module.exports = class Alias extends Now { if (code === 'cert_missing') { console.log( - `> Provisioning certificate for ${chalk.underline(chalk.bold(alias))}` + `> Provisioning certificate for ${chalk.underline( + chalk.bold(alias) + )}` ) try { @@ -571,7 +609,11 @@ module.exports = class Alias extends Now { if (canBePurchased && price && period) { const periodMsg = `${period}yr${period > 1 ? 's' : ''}` info( - `The domain ${aliasParam} is ${chalk.italic('available')} to buy under ${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)}! ${elapsed()}` + `The domain ${aliasParam} is ${chalk.italic( + 'available' + )} to buy under ${chalk.bold( + (currentTeam && currentTeam.slug) || user.username || user.email + )}! ${elapsed()}` ) const confirmation = await promptBool( `Buy now for ${chalk.bold(`$${price}`)} (${periodMsg})?` @@ -622,7 +664,9 @@ module.exports = class Alias extends Now { } console.log( - `> Verifying the DNS settings for ${chalk.bold(chalk.underline(alias))} (see ${chalk.underline('https://zeit.world')} for help)` + `> Verifying the DNS settings for ${chalk.bold( + chalk.underline(alias) + )} (see ${chalk.underline('https://zeit.world')} for help)` ) const _domain = publicSuffixList.parse(alias).domain @@ -665,7 +709,9 @@ module.exports = class Alias extends Now { throw e } console.log( - `${chalk.cyan('> Success!')} Domain ${chalk.bold(chalk.underline(domain))} verified` + `${chalk.cyan('> Success!')} Domain ${chalk.bold( + chalk.underline(domain) + )} verified` ) } } @@ -682,7 +728,9 @@ module.exports = class Alias extends Now { try { if (usingZeitWorld) { console.log( - `> Detected ${chalk.bold(chalk.underline('zeit.world'))} nameservers! Configuring records.` + `> Detected ${chalk.bold( + chalk.underline('zeit.world') + )} nameservers! Configuring records.` ) const record = alias.substr(0, alias.length - domain.length) @@ -714,12 +762,14 @@ module.exports = class Alias extends Now { } } else { console.log( - `> Resolved IP: ${err.ip ? `${chalk.underline(err.ip)} (unknown)` : chalk.dim('none')}` + `> Resolved IP: ${err.ip + ? `${chalk.underline(err.ip)} (unknown)` + : chalk.dim('none')}` ) console.log( - `> Nameservers: ${nameservers && nameservers.length ? nameservers - .map(ns => chalk.underline(ns)) - .join(', ') : chalk.dim('none')}` + `> Nameservers: ${nameservers && nameservers.length + ? nameservers.map(ns => chalk.underline(ns)).join(', ') + : chalk.dim('none')}` ) throw err } @@ -753,7 +803,9 @@ module.exports = class Alias extends Now { throw e } console.log( - `${chalk.cyan('> Success!')} Domain ${chalk.bold(chalk.underline(domain))} ${chalk.dim(`(${uid})`)} added` + `${chalk.cyan('> Success!')} Domain ${chalk.bold( + chalk.underline(domain) + )} ${chalk.dim(`(${uid})`)} added` ) } @@ -802,8 +854,11 @@ module.exports = class Alias extends Now { for (const ip of ips) { if (targets.indexOf(ip) === -1) { const err = new Error( - `The domain ${domain} has an A record ${chalk.bold(ip)} that doesn't resolve to ${chalk.bold(chalk.underline('alias.zeit.co'))}.\n> ` + - DOMAIN_VERIFICATION_ERROR + `The domain ${domain} has an A record ${chalk.bold( + ip + )} that doesn't resolve to ${chalk.bold( + chalk.underline('alias.zeit.co') + )}.\n> ` + DOMAIN_VERIFICATION_ERROR ) err.ip = ip err.userError = true diff --git a/lib/domains.js b/lib/domains.js index 42af137..52413fa 100644 --- a/lib/domains.js +++ b/lib/domains.js @@ -61,7 +61,9 @@ module.exports = class Domains extends Now { ns = res.nameservers } catch (err) { const err2 = new Error( - `Unable to fetch nameservers for ${chalk.underline(chalk.bold(domain))}.` + `Unable to fetch nameservers for ${chalk.underline( + chalk.bold(domain) + )}.` ) err2.userError = true throw err2 diff --git a/lib/errors.js b/lib/errors.js index 498a662..7d9af29 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -1,16 +1,28 @@ // Packages const chalk = require('chalk') -const DNS_VERIFICATION_ERROR = `Please make sure that your nameservers point to ${chalk.underline('zeit.world')}. +const DNS_VERIFICATION_ERROR = `Please make sure that your nameservers point to ${chalk.underline( + 'zeit.world' +)}. > Examples: (full list at ${chalk.underline('https://zeit.world')}) -> ${chalk.gray('-')} ${chalk.underline('california.zeit.world')} ${chalk.dim('173.255.215.107')} -> ${chalk.gray('-')} ${chalk.underline('newark.zeit.world')} ${chalk.dim('173.255.231.87')} -> ${chalk.gray('-')} ${chalk.underline('london.zeit.world')} ${chalk.dim('178.62.47.76')} -> ${chalk.gray('-')} ${chalk.underline('singapore.zeit.world')} ${chalk.dim('119.81.97.170')}` +> ${chalk.gray('-')} ${chalk.underline('california.zeit.world')} ${chalk.dim( + '173.255.215.107' +)} +> ${chalk.gray('-')} ${chalk.underline('newark.zeit.world')} ${chalk.dim( + '173.255.231.87' +)} +> ${chalk.gray('-')} ${chalk.underline('london.zeit.world')} ${chalk.dim( + '178.62.47.76' +)} +> ${chalk.gray('-')} ${chalk.underline('singapore.zeit.world')} ${chalk.dim( + '119.81.97.170' +)}` const DOMAIN_VERIFICATION_ERROR = DNS_VERIFICATION_ERROR + - `\n> Alternatively, ensure it resolves to ${chalk.underline('alias.zeit.co')} via ${chalk.dim('CNAME')} / ${chalk.dim('ALIAS')}.` + `\n> Alternatively, ensure it resolves to ${chalk.underline( + 'alias.zeit.co' + )} via ${chalk.dim('CNAME')} / ${chalk.dim('ALIAS')}.` module.exports = { DNS_VERIFICATION_ERROR, diff --git a/lib/git.js b/lib/git.js index 5b2e7bd..32c1961 100644 --- a/lib/git.js +++ b/lib/git.js @@ -148,7 +148,8 @@ const downloadRepo = async repoPath => { break } case 'Bitbucket': - url = `https://bitbucket.org/${pathParts.main}/get/${pathParts.ref || 'default'}.zip` + url = `https://bitbucket.org/${pathParts.main}/get/${pathParts.ref || + 'default'}.zip` break default: url = `https://api.github.com/repos/${pathParts.main}/tarball/${pathParts.ref}` diff --git a/lib/index.js b/lib/index.js index 5d95346..432d90d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -186,7 +186,9 @@ module.exports = class Now extends EventEmitter { if (res.status === 429) { let msg = `You reached your 20 deployments limit in the OSS plan.\n` - msg += `${chalk.gray('>')} Please run ${chalk.gray('`')}${chalk.cyan('now upgrade')}${chalk.gray('`')} to proceed` + msg += `${chalk.gray('>')} Please run ${chalk.gray('`')}${chalk.cyan( + 'now upgrade' + )}${chalk.gray('`')} to proceed` const err = new Error(msg) err.status = res.status err.retryAfter = 'never' @@ -232,7 +234,9 @@ module.exports = class Now extends EventEmitter { console.error( `> \u001B[31mWarning!\u001B[39m ${sizeExceeded} of the files ` + 'exceeded the limit for your plan.\n' + - `> Please run ${chalk.gray('`')}${chalk.cyan('now upgrade')}${chalk.gray('`')} to upgrade.` + `> Please run ${chalk.gray('`')}${chalk.cyan( + 'now upgrade' + )}${chalk.gray('`')} to upgrade.` ) } } @@ -245,7 +249,9 @@ module.exports = class Now extends EventEmitter { ) } else { console.log( - `> Using Node.js ${chalk.bold(deployment.nodeVersion)} (requested: ${chalk.dim(`\`${engines.node}\``)})` + `> Using Node.js ${chalk.bold( + deployment.nodeVersion + )} (requested: ${chalk.dim(`\`${engines.node}\``)})` ) } } else { @@ -482,7 +488,9 @@ module.exports = class Now extends EventEmitter { console.time('> [debug] /logs') } - const url = `/now/deployments/${encodeURIComponent(deploymentIdOrURL)}/logs?${q}` + const url = `/now/deployments/${encodeURIComponent( + deploymentIdOrURL + )}/logs?${q}` const res = await this._fetch(url) if (this._debug) { @@ -592,7 +600,9 @@ module.exports = class Now extends EventEmitter { } const res = await this._fetch( - `/whois-ns${fallback ? '-fallback' : ''}?domain=${encodeURIComponent(domain)}` + `/whois-ns${fallback ? '-fallback' : ''}?domain=${encodeURIComponent( + domain + )}` ) if (this._debug) { @@ -663,7 +673,9 @@ module.exports = class Now extends EventEmitter { if (code === 'custom_domain_needs_upgrade') { err = new Error( - `Custom domains are only enabled for premium accounts. Please upgrade at ${chalk.underline('https://zeit.co/account')}.` + `Custom domains are only enabled for premium accounts. Please upgrade at ${chalk.underline( + 'https://zeit.co/account' + )}.` ) } else { err = new Error(`Not authorized to access domain ${name}`) diff --git a/lib/login.js b/lib/login.js index 46e1063..4dd9fd2 100644 --- a/lib/login.js +++ b/lib/login.js @@ -80,7 +80,9 @@ async function register(url, { retryEmail = false } = {}) { if (securityCode) { console.log( - `> Verify that the provided security code in the email matches ${chalk.cyan(chalk.bold(securityCode))}.` + `> Verify that the provided security code in the email matches ${chalk.cyan( + chalk.bold(securityCode) + )}.` ) } diff --git a/lib/re-alias.js b/lib/re-alias.js index 64a7a5f..7992396 100644 --- a/lib/re-alias.js +++ b/lib/re-alias.js @@ -99,8 +99,9 @@ exports.reAlias = async ( if (nowConfig.aliases && Array.isArray(nowConfig.aliases)) { console.log( - `${chalk.red('Deprecated!')} The property ${chalk.grey('aliases')} will be ` + - `removed from the config file soon.` + `${chalk.red('Deprecated!')} The property ${chalk.grey( + 'aliases' + )} will be removed from the config file soon.` ) console.log('Read more about the new way here: http://bit.ly/2l2v5Fg\n') diff --git a/lib/scale-info.js b/lib/scale-info.js index ad977b5..ef57670 100644 --- a/lib/scale-info.js +++ b/lib/scale-info.js @@ -35,8 +35,10 @@ module.exports = async function(now, url) { let barcurr = current const end = Math.max(current, max) linelog( - `${chalk.gray('>')} Scaling to ${chalk.bold(String(targetReplicaCount) + (targetReplicaCount === 1 ? ' instance' : ' instances'))}: ` + - barify(barcurr, end) + `${chalk.gray('>')} Scaling to ${chalk.bold( + String(targetReplicaCount) + + (targetReplicaCount === 1 ? ' instance' : ' instances') + )}: ` + barify(barcurr, end) ) const instances = await retry( @@ -45,14 +47,19 @@ module.exports = async function(now, url) { if (barcurr !== res.length) { barcurr = res.length linelog( - `${chalk.gray('>')} Scaling to ${chalk.bold(String(targetReplicaCount) + (targetReplicaCount === 1 ? ' instance' : ' instances'))}: ` + - barify(barcurr, end) + `${chalk.gray('>')} Scaling to ${chalk.bold( + String(targetReplicaCount) + + (targetReplicaCount === 1 ? ' instance' : ' instances') + )}: ` + barify(barcurr, end) ) if (barcurr === targetReplicaCount) { linelog.clear() linelog( - `> Scaled to ${chalk.bold(String(targetReplicaCount) + (targetReplicaCount === 1 ? ' instance' : ' instances'))}: ${chalk.gray('[' + ms(Date.now() - startTime) + ']')}\n` + `> Scaled to ${chalk.bold( + String(targetReplicaCount) + + (targetReplicaCount === 1 ? ' instance' : ' instances') + )}: ${chalk.gray('[' + ms(Date.now() - startTime) + ']')}\n` ) return res } diff --git a/lib/utils/input/prompt-bool.js b/lib/utils/input/prompt-bool.js index 31e979d..56cda9a 100644 --- a/lib/utils/input/prompt-bool.js +++ b/lib/utils/input/prompt-bool.js @@ -49,8 +49,8 @@ module.exports = ( const defaultText = defaultValue === null ? `[${yesChar}|${noChar}]` : defaultValue - ? `[${chalk.bold(yesChar.toUpperCase())}|${noChar}]` - : `[${yesChar}|${chalk.bold(noChar.toUpperCase())}]` + ? `[${chalk.bold(yesChar.toUpperCase())}|${noChar}]` + : `[${yesChar}|${chalk.bold(noChar.toUpperCase())}]` stdout.write(`${chalk.gray('>')} ${label} ${chalk.gray(defaultText)} `) stdin.on('data', onData) }) diff --git a/package.json b/package.json index 2f4d26d..bf5dde0 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "node-fetch": "1.7.1", "ora": "1.2.0", "pkg": "3.0.6", - "prettier": "1.3.1", + "prettier": "1.4.1", "printf": "0.2.5", "progress": "2.0.0", "psl": "1.1.18",