Browse Source

Even better structure for code

master
Leo Lamprecht 8 years ago
parent
commit
b9e7eb1d0b
  1. 24
      src/providers/sh/commands/alias.js
  2. 20
      src/providers/sh/commands/billing.js
  3. 16
      src/providers/sh/commands/billing/add.js
  4. 12
      src/providers/sh/commands/certs.js
  5. 32
      src/providers/sh/commands/deploy.js
  6. 16
      src/providers/sh/commands/dns.js
  7. 18
      src/providers/sh/commands/domains.js
  8. 22
      src/providers/sh/commands/domains/buy.js
  9. 7
      src/providers/sh/commands/lib/ua.js
  10. 12
      src/providers/sh/commands/list.js
  11. 34
      src/providers/sh/commands/login.js
  12. 6
      src/providers/sh/commands/logout.js
  13. 14
      src/providers/sh/commands/logs.js
  14. 12
      src/providers/sh/commands/remove.js
  15. 18
      src/providers/sh/commands/scale.js
  16. 14
      src/providers/sh/commands/secrets.js
  17. 14
      src/providers/sh/commands/teams.js
  18. 28
      src/providers/sh/commands/teams/add.js
  19. 28
      src/providers/sh/commands/teams/invite.js
  20. 12
      src/providers/sh/commands/teams/list.js
  21. 16
      src/providers/sh/commands/teams/switch.js
  22. 22
      src/providers/sh/commands/upgrade.js
  23. 8
      src/providers/sh/commands/whoami.js
  24. 2
      src/providers/sh/index.js
  25. 0
      src/providers/sh/util/agent.js
  26. 22
      src/providers/sh/util/alias.js
  27. 0
      src/providers/sh/util/build-logger.js
  28. 2
      src/providers/sh/util/certs.js
  29. 0
      src/providers/sh/util/cfg.js
  30. 0
      src/providers/sh/util/check-path.js
  31. 2
      src/providers/sh/util/credit-cards.js
  32. 0
      src/providers/sh/util/dns.js
  33. 2
      src/providers/sh/util/domain-records.js
  34. 4
      src/providers/sh/util/domains.js
  35. 4
      src/providers/sh/util/error.js
  36. 0
      src/providers/sh/util/errors.js
  37. 0
      src/providers/sh/util/etc/billing/card-brands.json
  38. 0
      src/providers/sh/util/etc/billing/country-list.json
  39. 0
      src/providers/sh/util/etc/billing/geocode.js
  40. 0
      src/providers/sh/util/etc/check-path.js
  41. 0
      src/providers/sh/util/etc/domains/treat-buy-error.js
  42. 0
      src/providers/sh/util/etc/exit.js
  43. 0
      src/providers/sh/util/etc/fatal-error.js
  44. 0
      src/providers/sh/util/etc/input/list.js
  45. 0
      src/providers/sh/util/etc/input/patch-inquirer.js
  46. 0
      src/providers/sh/util/etc/input/prompt-bool.js
  47. 0
      src/providers/sh/util/etc/input/prompt-options.js
  48. 0
      src/providers/sh/util/etc/input/regexes.js
  49. 0
      src/providers/sh/util/etc/input/text.js
  50. 0
      src/providers/sh/util/etc/output/chars.js
  51. 0
      src/providers/sh/util/etc/output/cmd.js
  52. 0
      src/providers/sh/util/etc/output/code.js
  53. 0
      src/providers/sh/util/etc/output/erase-lines.js
  54. 0
      src/providers/sh/util/etc/output/error.js
  55. 0
      src/providers/sh/util/etc/output/info.js
  56. 0
      src/providers/sh/util/etc/output/logo.js
  57. 0
      src/providers/sh/util/etc/output/note.js
  58. 0
      src/providers/sh/util/etc/output/param.js
  59. 0
      src/providers/sh/util/etc/output/right-pad.js
  60. 0
      src/providers/sh/util/etc/output/stamp.js
  61. 0
      src/providers/sh/util/etc/output/success.js
  62. 0
      src/providers/sh/util/etc/output/table.js
  63. 0
      src/providers/sh/util/etc/output/uid.js
  64. 0
      src/providers/sh/util/etc/output/wait.js
  65. 0
      src/providers/sh/util/etc/to-human-path.js
  66. 0
      src/providers/sh/util/etc/url.js
  67. 0
      src/providers/sh/util/get-files.js
  68. 0
      src/providers/sh/util/git.js
  69. 0
      src/providers/sh/util/hash.js
  70. 0
      src/providers/sh/util/ignored.js
  71. 0
      src/providers/sh/util/indent.js
  72. 2
      src/providers/sh/util/index.js
  73. 0
      src/providers/sh/util/is-zeit-world.js
  74. 0
      src/providers/sh/util/logs.js
  75. 11
      src/providers/sh/util/pkg.js
  76. 2
      src/providers/sh/util/plans.js
  77. 0
      src/providers/sh/util/prompt-options.js
  78. 0
      src/providers/sh/util/re-alias.js
  79. 0
      src/providers/sh/util/read-metadata.js
  80. 0
      src/providers/sh/util/scale-info.js
  81. 2
      src/providers/sh/util/scale.js
  82. 2
      src/providers/sh/util/secrets.js
  83. 0
      src/providers/sh/util/sort-deployments.js
  84. 0
      src/providers/sh/util/strlen.js
  85. 2
      src/providers/sh/util/teams.js
  86. 0
      src/providers/sh/util/test.js
  87. 0
      src/providers/sh/util/to-host.js
  88. 6
      src/providers/sh/util/ua.js
  89. 0
      src/providers/sh/util/user.js

24
src/providers/sh/commands/bin/alias.js → src/providers/sh/commands/alias.js

@ -10,18 +10,18 @@ require('epipebomb')()
const supportsColor = require('supports-color')
// Utilities
const strlen = require('../lib/strlen')
const NowAlias = require('../lib/alias')
const NowDomains = require('../lib/domains')
const { handleError, error } = require('../lib/error')
const toHost = require('../lib/to-host')
const { reAlias } = require('../lib/re-alias')
const exit = require('../lib/utils/exit')
const info = require('../lib/utils/output/info')
const logo = require('../lib/utils/output/logo')
const promptBool = require('../lib/utils/input/prompt-bool')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const strlen = require('../util/strlen')
const NowAlias = require('../util/alias')
const NowDomains = require('../util/domains')
const { handleError, error } = require('../util/error')
const toHost = require('../util/to-host')
const { reAlias } = require('../util/re-alias')
const exit = require('../util/etc/exit')
const info = require('../util/etc/output/info')
const logo = require('../util/etc/output/logo')
const promptBool = require('../util/etc/input/prompt-bool')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const grayWidth = 10
const underlineWidth = 11

20
src/providers/sh/commands/bin/billing.js → src/providers/sh/commands/billing.js

@ -6,17 +6,17 @@ const minimist = require('minimist')
const ms = require('ms')
// Utilities
const { handleError, error } = require('../lib/error')
const NowCreditCards = require('../lib/credit-cards')
const indent = require('../lib/indent')
const listInput = require('../lib/utils/input/list')
const success = require('../lib/utils/output/success')
const promptBool = require('../lib/utils/input/prompt-bool')
const info = require('../lib/utils/output/info')
const logo = require('../lib/utils/output/logo')
const { handleError, error } = require('../util/error')
const NowCreditCards = require('../util/credit-cards')
const indent = require('../util/indent')
const listInput = require('../util/etc/input/list')
const success = require('../util/etc/output/success')
const promptBool = require('../util/etc/input/prompt-bool')
const info = require('../util/etc/output/info')
const logo = require('../util/etc/output/logo')
const addBilling = require('./billing/add')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

16
src/providers/sh/commands/bin/billing/add.js → src/providers/sh/commands/billing/add.js

@ -6,14 +6,14 @@ const chalk = require('chalk')
const ccValidator = require('credit-card')
// Utilities
const textInput = require('../../lib/utils/input/text')
const countries = require('../../lib/utils/billing/country-list')
const cardBrands = require('../../lib/utils/billing/card-brands')
const geocode = require('../../lib/utils/billing/geocode')
const success = require('../../lib/utils/output/success')
const wait = require('../../lib/utils/output/wait')
const { tick } = require('../../lib/utils/output/chars')
const rightPad = require('../../lib/utils/output/right-pad')
const textInput = require('../../util/etc/input/text')
const countries = require('../../util/etc/billing/country-list')
const cardBrands = require('../../util/etc/billing/card-brands')
const geocode = require('../../util/etc/billing/geocode')
const success = require('../../util/etc/output/success')
const wait = require('../../util/etc/output/wait')
const { tick } = require('../../util/etc/output/chars')
const rightPad = require('../../util/etc/output/right-pad')
function expDateMiddleware(data) {
return data

12
src/providers/sh/commands/bin/certs.js → src/providers/sh/commands/certs.js

@ -14,12 +14,12 @@ require('epipebomb')()
const supportsColor = require('supports-color')
// Utilities
const { handleError, error } = require('../lib/error')
const NowCerts = require('../lib/certs')
const exit = require('../lib/utils/exit')
const logo = require('../lib/utils/output/logo')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const { handleError, error } = require('../util/error')
const NowCerts = require('../util/certs')
const exit = require('../util/etc/exit')
const logo = require('../util/etc/output/logo')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

32
src/providers/sh/commands/bin/deploy.js → src/providers/sh/commands/deploy.js

@ -16,21 +16,21 @@ const { write: copy } = require('clipboardy')
const inquirer = require('inquirer')
// Ours
const Logger = require('../lib/build-logger')
const Now = require('../lib')
const toHumanPath = require('../../../../util/humanize-path')
const { handleError, error } = require('../lib/error')
const { fromGit, isRepoPath, gitPathParts } = require('../lib/git')
const readMetaData = require('../lib/read-metadata')
const checkPath = require('../lib/check-path')
const logo = require('../../../../util/output/logo')
const cmd = require('../../../../util/output/cmd')
const info = require('../../../../util/output/info')
const wait = require('../../../../util/output/wait')
const NowPlans = require('../lib/plans')
const promptBool = require('../../../../util/input/prompt-bool')
const promptOptions = require('../lib/prompt-options')
const note = require('../../../../util/output/note')
const Logger = require('../util/build-logger')
const Now = require('../util')
const toHumanPath = require('../../../util/humanize-path')
const { handleError, error } = require('../util/error')
const { fromGit, isRepoPath, gitPathParts } = require('../util/git')
const readMetaData = require('../util/read-metadata')
const checkPath = require('../util/check-path')
const logo = require('../../../util/output/logo')
const cmd = require('../../../util/output/cmd')
const info = require('../../../util/output/info')
const wait = require('../../../util/output/wait')
const NowPlans = require('../util/plans')
const promptBool = require('../../../util/input/prompt-bool')
const promptOptions = require('../util/prompt-options')
const note = require('../../../util/output/note')
const mriOpts = {
string: ['config', 'token', 'name', 'alias', 'session-affinity'],
@ -204,7 +204,7 @@ const envFields = async list => {
}
// eslint-disable-next-line import/no-unassigned-import
require('../../../../util/input/patch-inquirer')
require('../../../util/input/patch-inquirer')
console.log(
info('Please enter the values for the following environment variables:')

16
src/providers/sh/commands/bin/dns.js → src/providers/sh/commands/dns.js

@ -7,14 +7,14 @@ const ms = require('ms')
const table = require('text-table')
// Utilities
const DomainRecords = require('../lib/domain-records')
const indent = require('../lib/indent')
const strlen = require('../lib/strlen')
const { handleError, error } = require('../lib/error')
const exit = require('../lib/utils/exit')
const logo = require('../lib/utils/output/logo')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const DomainRecords = require('../util/domain-records')
const indent = require('../util/indent')
const strlen = require('../util/strlen')
const { handleError, error } = require('../util/error')
const exit = require('../util/etc/exit')
const logo = require('../util/etc/output/logo')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

18
src/providers/sh/commands/bin/domains.js → src/providers/sh/commands/domains.js

@ -8,16 +8,16 @@ const psl = require('psl')
const table = require('text-table')
// Utilities
const NowDomains = require('../lib/domains')
const exit = require('../lib/utils/exit')
const logo = require('../lib/utils/output/logo')
const promptBool = require('../lib/utils/input/prompt-bool')
const strlen = require('../lib/strlen')
const toHost = require('../lib/to-host')
const { handleError, error } = require('../lib/error')
const NowDomains = require('../util/domains')
const exit = require('../util/etc/exit')
const logo = require('../util/etc/output/logo')
const promptBool = require('../util/etc/input/prompt-bool')
const strlen = require('../util/strlen')
const toHost = require('../util/to-host')
const { handleError, error } = require('../util/error')
const buy = require('./domains/buy')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

22
src/providers/sh/commands/bin/domains/buy.js → src/providers/sh/commands/domains/buy.js

@ -2,17 +2,17 @@
const { italic, bold } = require('chalk')
// Utilities
const error = require('../../lib/utils/output/error')
const wait = require('../../lib/utils/output/wait')
const cmd = require('../../lib/utils/output/cmd')
const param = require('../../lib/utils/output/param')
const info = require('../../lib/utils/output/info')
const success = require('../../lib/utils/output/success')
const stamp = require('../../lib/utils/output/stamp')
const promptBool = require('../../lib/utils/input/prompt-bool')
const eraseLines = require('../../lib/utils/output/erase-lines')
const treatBuyError = require('../../lib/utils/domains/treat-buy-error')
const NowCreditCards = require('../../lib/credit-cards')
const error = require('../../util/etc/output/error')
const wait = require('../../util/etc/output/wait')
const cmd = require('../../util/etc/output/cmd')
const param = require('../../util/etc/output/param')
const info = require('../../util/etc/output/info')
const success = require('../../util/etc/output/success')
const stamp = require('../../util/etc/output/stamp')
const promptBool = require('../../util/etc/input/prompt-bool')
const eraseLines = require('../../util/etc/output/erase-lines')
const treatBuyError = require('../../util/etc/domains/treat-buy-error')
const NowCreditCards = require('../../util/credit-cards')
const addBilling = require('../billing/add')
module.exports = async function({ domains, args, currentTeam, user, coupon }) {

7
src/providers/sh/commands/lib/ua.js

@ -1,7 +0,0 @@
// Native
const os = require('os')
// Ours
const {version} = require('../../../../util/pkg')
module.exports = `now ${version} node-${process.version} ${os.platform()} (${os.arch()})`

12
src/providers/sh/commands/bin/list.js → src/providers/sh/commands/list.js

@ -9,12 +9,12 @@ require('epipebomb')()
const supportsColor = require('supports-color')
// Utilities
const Now = require('../lib')
const { handleError, error } = require('../lib/error')
const logo = require('../lib/utils/output/logo')
const sort = require('../lib/sort-deployments')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const Now = require('../util')
const { handleError, error } = require('../util/error')
const logo = require('../util/etc/output/logo')
const sort = require('../util/sort-deployments')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

34
src/providers/sh/commands/bin/login.js → src/providers/sh/commands/login.js

@ -10,26 +10,26 @@ const ms = require('ms')
const { validate: validateEmail } = require('email-validator')
// ours
const { version } = require('../../util/pkg')
const ua = require('../../util/ua')
const error = require('../../../../util/output/error')
const aborted = require('../../../../util/output/aborted')
const wait = require('../../../../util/output/wait')
const highlight = require('../../../../util/output/highlight')
const info = require('../../../../util/output/info')
const ok = require('../../../../util/output/ok')
const cmd = require('../../../../util/output/cmd')
const ready = require('../../../../util/output/ready')
const param = require('../../../../util/output/param')
const eraseLines = require('../../../../util/output/erase-lines')
const sleep = require('../../../../util/sleep')
const getUser = require('../../util/get-user')
const { version } = require('../../../util/pkg')
const ua = require('../util/ua')
const error = require('../../../util/output/error')
const aborted = require('../../../util/output/aborted')
const wait = require('../../../util/output/wait')
const highlight = require('../../../util/output/highlight')
const info = require('../../../util/output/info')
const ok = require('../../../util/output/ok')
const cmd = require('../../../util/output/cmd')
const ready = require('../../../util/output/ready')
const param = require('../../../util/output/param')
const eraseLines = require('../../../util/output/erase-lines')
const sleep = require('../../../util/sleep')
const getUser = require('../util/get-user')
const {
writeToAuthConfigFile,
writeToConfigFile
} = require('../../../../util/config-files')
const getNowDir = require('../../../../get-now-dir')
const hp = require('../../../../util/humanize-path')
} = require('../../../util/config-files')
const getNowDir = require('../../../get-now-dir')
const hp = require('../../../util/humanize-path')
// POSTs to /now/registration – either creates an account or performs a login
// returns {token, securityCode}

6
src/providers/sh/commands/bin/logout.js → src/providers/sh/commands/logout.js

@ -7,14 +7,14 @@ const fetch = require('node-fetch')
const ora = require('ora')
// Utilities
const logo = require('../lib/utils/output/logo')
const { handleError } = require('../lib/error')
const logo = require('../util/etc/output/logo')
const { handleError } = require('../util/error')
const {
readConfigFile,
writeToConfigFile,
readAuthConfigFile,
writeToAuthConfigFile
} = require('../../../../util/config-files')
} = require('../../../util/config-files')
const help = () => {
console.log(`

14
src/providers/sh/commands/bin/logs.js → src/providers/sh/commands/logs.js

@ -10,13 +10,13 @@ const dateformat = require('dateformat')
const io = require('socket.io-client')
// Utilities
const Now = require('../lib')
const { handleError, error } = require('../lib/error')
const logo = require('../lib/utils/output/logo')
const { compare, deserialize } = require('../lib/logs')
const { maybeURL, normalizeURL, parseInstanceURL } = require('../lib/utils/url')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const Now = require('../util')
const { handleError, error } = require('../util/error')
const logo = require('../util/etc/output/logo')
const { compare, deserialize } = require('../util/logs')
const { maybeURL, normalizeURL, parseInstanceURL } = require('../util/etc/url')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

12
src/providers/sh/commands/bin/remove.js → src/providers/sh/commands/remove.js

@ -7,12 +7,12 @@ const ms = require('ms')
const table = require('text-table')
// Utilities
const Now = require('../lib')
const { handleError, error } = require('../lib/error')
const logo = require('../lib/utils/output/logo')
const { normalizeURL } = require('../lib/utils/url')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const Now = require('../util')
const { handleError, error } = require('../util/error')
const logo = require('../util/etc/output/logo')
const { normalizeURL } = require('../util/etc/url')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

18
src/providers/sh/commands/bin/scale.js → src/providers/sh/commands/scale.js

@ -10,15 +10,15 @@ require('epipebomb')()
const supportsColor = require('supports-color')
// Utilities
const { handleError, error } = require('../lib/error')
const NowScale = require('../lib/scale')
const exit = require('../lib/utils/exit')
const logo = require('../lib/utils/output/logo')
const info = require('../lib/scale-info')
const sort = require('../lib/sort-deployments')
const success = require('../lib/utils/output/success')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const { handleError, error } = require('../util/error')
const NowScale = require('../util/scale')
const exit = require('../util/etc/exit')
const logo = require('../util/etc/output/logo')
const info = require('../util/scale-info')
const sort = require('../util/sort-deployments')
const success = require('../util/etc/output/success')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

14
src/providers/sh/commands/bin/secrets.js → src/providers/sh/commands/secrets.js

@ -7,13 +7,13 @@ const minimist = require('minimist')
const ms = require('ms')
// Utilities
const strlen = require('../lib/strlen')
const { handleError, error } = require('../lib/error')
const NowSecrets = require('../lib/secrets')
const exit = require('../lib/utils/exit')
const logo = require('../lib/utils/output/logo')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const strlen = require('../util/strlen')
const { handleError, error } = require('../util/error')
const NowSecrets = require('../util/secrets')
const exit = require('../util/etc/exit')
const logo = require('../util/etc/output/logo')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

14
src/providers/sh/commands/bin/teams.js → src/providers/sh/commands/teams.js

@ -5,17 +5,17 @@ const chalk = require('chalk')
const minimist = require('minimist')
// Utilities
const error = require('../lib/utils/output/error')
const NowTeams = require('../lib/teams')
const logo = require('../lib/utils/output/logo')
const exit = require('../lib/utils/exit')
const { handleError } = require('../lib/error')
const error = require('../util/etc/output/error')
const NowTeams = require('../util/teams')
const logo = require('../util/etc/output/logo')
const exit = require('../util/etc/exit')
const { handleError } = require('../util/error')
const list = require('./teams/list')
const add = require('./teams/add')
const change = require('./teams/switch')
const invite = require('./teams/invite')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

28
src/providers/sh/commands/bin/teams/add.js → src/providers/sh/commands/teams/add.js

@ -2,20 +2,20 @@
const chalk = require('chalk')
// Utilities
const stamp = require('../../lib/utils/output/stamp')
const info = require('../../lib/utils/output/info')
const error = require('../../lib/utils/output/error')
const wait = require('../../lib/utils/output/wait')
const rightPad = require('../../lib/utils/output/right-pad')
const eraseLines = require('../../lib/utils/output/erase-lines')
const { tick } = require('../../lib/utils/output/chars')
const success = require('../../lib/utils/output/success')
const cmd = require('../../lib/utils/output/cmd')
const note = require('../../lib/utils/output/note')
const uid = require('../../lib/utils/output/uid')
const textInput = require('../../lib/utils/input/text')
const exit = require('../../lib/utils/exit')
const cfg = require('../../lib/cfg')
const stamp = require('../../util/etc/output/stamp')
const info = require('../../util/etc/output/info')
const error = require('../../util/etc/output/error')
const wait = require('../../util/etc/output/wait')
const rightPad = require('../../util/etc/output/right-pad')
const eraseLines = require('../../util/etc/output/erase-lines')
const { tick } = require('../../util/etc/output/chars')
const success = require('../../util/etc/output/success')
const cmd = require('../../util/etc/output/cmd')
const note = require('../../util/etc/output/note')
const uid = require('../../util/etc/output/uid')
const textInput = require('../../util/etc/input/text')
const exit = require('../../util/etc/exit')
const cfg = require('../../util/cfg')
const invite = require('./invite')
function validateSlugKeypress(data, value) {

28
src/providers/sh/commands/bin/teams/invite.js → src/providers/sh/commands/teams/invite.js

@ -2,20 +2,20 @@
const chalk = require('chalk')
// Utilities
const regexes = require('../../lib/utils/input/regexes')
const wait = require('../../lib/utils/output/wait')
const cfg = require('../../lib/cfg')
const fatalError = require('../../lib/utils/fatal-error')
const cmd = require('../../lib/utils/output/cmd')
const info = require('../../lib/utils/output/info')
const stamp = require('../../lib/utils/output/stamp')
const param = require('../../lib/utils/output/param')
const { tick } = require('../../lib/utils/output/chars')
const rightPad = require('../../lib/utils/output/right-pad')
const textInput = require('../../lib/utils/input/text')
const eraseLines = require('../../lib/utils/output/erase-lines')
const success = require('../../lib/utils/output/success')
const error = require('../../lib/utils/output/error')
const regexes = require('../../util/etc/input/regexes')
const wait = require('../../util/etc/output/wait')
const cfg = require('../../util/cfg')
const fatalError = require('../../util/etc/fatal-error')
const cmd = require('../../util/etc/output/cmd')
const info = require('../../util/etc/output/info')
const stamp = require('../../util/etc/output/stamp')
const param = require('../../util/etc/output/param')
const { tick } = require('../../util/etc/output/chars')
const rightPad = require('../../util/etc/output/right-pad')
const textInput = require('../../util/etc/input/text')
const eraseLines = require('../../util/etc/output/erase-lines')
const success = require('../../util/etc/output/success')
const error = require('../../util/etc/output/error')
function validateEmail(data) {
return regexes.email.test(data.trim()) || data.length === 0

12
src/providers/sh/commands/bin/teams/list.js → src/providers/sh/commands/teams/list.js

@ -2,12 +2,12 @@
const chalk = require('chalk')
// Utilities
const wait = require('../../lib/utils/output/wait')
const cfg = require('../../lib/cfg')
const info = require('../../lib/utils/output/info')
const error = require('../../lib/utils/output/error')
const { tick: tickChar } = require('../../lib/utils/output/chars')
const table = require('../../lib/utils/output/table')
const wait = require('../../util/etc/output/wait')
const cfg = require('../../util/cfg')
const info = require('../../util/etc/output/info')
const error = require('../../util/etc/output/error')
const { tick: tickChar } = require('../../util/etc/output/chars')
const table = require('../../util/etc/output/table')
module.exports = async function({ teams, token }) {
const stopSpinner = wait('Fetching teams')

16
src/providers/sh/commands/bin/teams/switch.js → src/providers/sh/commands/teams/switch.js

@ -2,14 +2,14 @@
const chalk = require('chalk')
// Utilities
const wait = require('../../lib/utils/output/wait')
const listInput = require('../../lib/utils/input/list')
const cfg = require('../../lib/cfg')
const exit = require('../../lib/utils/exit')
const success = require('../../lib/utils/output/success')
const info = require('../../lib/utils/output/info')
const error = require('../../lib/utils/output/error')
const param = require('../../lib/utils/output/param')
const wait = require('../../util/etc/output/wait')
const listInput = require('../../util/etc/input/list')
const cfg = require('../../util/cfg')
const exit = require('../../util/etc/exit')
const success = require('../../util/etc/output/success')
const info = require('../../util/etc/output/info')
const error = require('../../util/etc/output/error')
const param = require('../../util/etc/output/param')
async function updateCurrentTeam({ cfg, newTeam } = {}) {
delete newTeam.created

22
src/providers/sh/commands/bin/upgrade.js → src/providers/sh/commands/upgrade.js

@ -6,17 +6,17 @@ const minimist = require('minimist')
const ms = require('ms')
// Utilities
const NowPlans = require('../lib/plans')
const indent = require('../lib/indent')
const listInput = require('../lib/utils/input/list')
const code = require('../lib/utils/output/code')
const error = require('../lib/utils/output/error')
const success = require('../lib/utils/output/success')
const cmd = require('../lib/utils/output/cmd')
const logo = require('../lib/utils/output/logo')
const { handleError } = require('../lib/error')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const NowPlans = require('../util/plans')
const indent = require('../util/indent')
const listInput = require('../util/etc/input/list')
const code = require('../util/etc/output/code')
const error = require('../util/etc/output/error')
const success = require('../util/etc/output/success')
const cmd = require('../util/etc/output/cmd')
const logo = require('../util/etc/output/logo')
const { handleError } = require('../util/error')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const { bold } = chalk

8
src/providers/sh/commands/bin/whoami.js → src/providers/sh/commands/whoami.js

@ -5,10 +5,10 @@ const minimist = require('minimist')
const chalk = require('chalk')
// Utilities
const logo = require('../lib/utils/output/logo')
const { handleError } = require('../lib/error')
const getWelcome = require('../../../../get-welcome')
const providers = require('../../../')
const logo = require('../util/etc/output/logo')
const { handleError } = require('../util/error')
const getWelcome = require('../../../get-welcome')
const providers = require('../../')
const help = () => {
console.log(`

2
src/providers/sh/index.js

@ -57,7 +57,7 @@ for (const subcommand of mainCommands) {
for (const handler of handlers) {
Object.defineProperty(details, handler, {
get() {
return require(`./commands/bin/${subcommand}`)
return require(`./commands/${subcommand}`)
}
})
}

0
src/providers/sh/commands/lib/agent.js → src/providers/sh/util/agent.js

22
src/providers/sh/commands/lib/alias.js → src/providers/sh/util/alias.js

@ -7,22 +7,22 @@ const chalk = require('chalk')
const { write: copy } = require('clipboardy')
// Ours
const promptBool = require('../lib/utils/input/prompt-bool')
const info = require('../lib/utils/output/info')
const param = require('../lib/utils/output/param')
const wait = require('../lib/utils/output/wait')
const success = require('../lib/utils/output/success')
const uid = require('../lib/utils/output/uid')
const eraseLines = require('../lib/utils/output/erase-lines')
const stamp = require('../lib/utils/output/stamp')
const error = require('../lib/utils/output/error')
const treatBuyError = require('../lib/utils/domains/treat-buy-error')
const promptBool = require('./etc/input/prompt-bool')
const info = require('./etc/output/info')
const param = require('./etc/output/param')
const wait = require('./etc/output/wait')
const success = require('./etc/output/success')
const uid = require('./etc/output/uid')
const eraseLines = require('./etc/output/erase-lines')
const stamp = require('./etc/output/stamp')
const error = require('./etc/output/error')
const treatBuyError = require('./etc/domains/treat-buy-error')
const scaleInfo = require('./scale-info')
const { DOMAIN_VERIFICATION_ERROR } = require('./errors')
const isZeitWorld = require('./is-zeit-world')
const resolve4 = require('./dns')
const toHost = require('./to-host')
const exit = require('./utils/exit')
const exit = require('./etc/exit')
const Now = require('./')
const argv = minimist(process.argv.slice(2), {

0
src/providers/sh/commands/lib/build-logger.js → src/providers/sh/util/build-logger.js

2
src/providers/sh/commands/lib/certs.js → src/providers/sh/util/certs.js

@ -1,5 +1,5 @@
// Ours
const Now = require('../lib')
const Now = require('.')
module.exports = class Certs extends Now {
ls() {

0
src/providers/sh/commands/lib/cfg.js → src/providers/sh/util/cfg.js

0
src/providers/sh/commands/lib/check-path.js → src/providers/sh/util/check-path.js

2
src/providers/sh/commands/lib/credit-cards.js → src/providers/sh/util/credit-cards.js

@ -1,6 +1,6 @@
const stripe = require('stripe')('pk_live_alyEi3lN0kSwbdevK0nrGwTw')
const Now = require('../lib')
const Now = require('.')
module.exports = class CreditCards extends Now {
async ls() {

0
src/providers/sh/commands/lib/dns.js → src/providers/sh/util/dns.js

2
src/providers/sh/commands/lib/domain-records.js → src/providers/sh/util/domain-records.js

@ -1,5 +1,5 @@
// Ours
const Now = require('../lib')
const Now = require('.')
module.exports = class DomainRecords extends Now {
async getRecord(id) {

4
src/providers/sh/commands/lib/domains.js → src/providers/sh/util/domains.js

@ -5,10 +5,10 @@ const { encode: encodeQuery } = require('querystring')
const chalk = require('chalk')
// Ours
const Now = require('../lib')
const Now = require('.')
const isZeitWorld = require('./is-zeit-world')
const { DNS_VERIFICATION_ERROR } = require('./errors')
const cmd = require('./utils/output/param')
const cmd = require('./etc/output/param')
const domainRegex = /^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}$/

4
src/providers/sh/commands/lib/error.js → src/providers/sh/util/error.js

@ -3,8 +3,8 @@ const ms = require('ms')
const chalk = require('chalk')
// Utilities
const error = require('../../../../util/output/error')
const info = require('../../../../util/output/info')
const error = require('../../../util/output/error')
const info = require('../../../util/output/info')
function handleError(err, { debug = false } = {}) {
// Coerce Strings to Error instances

0
src/providers/sh/commands/lib/errors.js → src/providers/sh/util/errors.js

0
src/providers/sh/commands/lib/utils/billing/card-brands.json → src/providers/sh/util/etc/billing/card-brands.json

0
src/providers/sh/commands/lib/utils/billing/country-list.json → src/providers/sh/util/etc/billing/country-list.json

0
src/providers/sh/commands/lib/utils/billing/geocode.js → src/providers/sh/util/etc/billing/geocode.js

0
src/providers/sh/commands/lib/utils/check-path.js → src/providers/sh/util/etc/check-path.js

0
src/providers/sh/commands/lib/utils/domains/treat-buy-error.js → src/providers/sh/util/etc/domains/treat-buy-error.js

0
src/providers/sh/commands/lib/utils/exit.js → src/providers/sh/util/etc/exit.js

0
src/providers/sh/commands/lib/utils/fatal-error.js → src/providers/sh/util/etc/fatal-error.js

0
src/providers/sh/commands/lib/utils/input/list.js → src/providers/sh/util/etc/input/list.js

0
src/providers/sh/commands/lib/utils/input/patch-inquirer.js → src/providers/sh/util/etc/input/patch-inquirer.js

0
src/providers/sh/commands/lib/utils/input/prompt-bool.js → src/providers/sh/util/etc/input/prompt-bool.js

0
src/providers/sh/commands/lib/prompt-options.js → src/providers/sh/util/etc/input/prompt-options.js

0
src/providers/sh/commands/lib/utils/input/regexes.js → src/providers/sh/util/etc/input/regexes.js

0
src/providers/sh/commands/lib/utils/input/text.js → src/providers/sh/util/etc/input/text.js

0
src/providers/sh/commands/lib/utils/output/chars.js → src/providers/sh/util/etc/output/chars.js

0
src/providers/sh/commands/lib/utils/output/cmd.js → src/providers/sh/util/etc/output/cmd.js

0
src/providers/sh/commands/lib/utils/output/code.js → src/providers/sh/util/etc/output/code.js

0
src/providers/sh/commands/lib/utils/output/erase-lines.js → src/providers/sh/util/etc/output/erase-lines.js

0
src/providers/sh/commands/lib/utils/output/error.js → src/providers/sh/util/etc/output/error.js

0
src/providers/sh/commands/lib/utils/output/info.js → src/providers/sh/util/etc/output/info.js

0
src/providers/sh/commands/lib/utils/output/logo.js → src/providers/sh/util/etc/output/logo.js

0
src/providers/sh/commands/lib/utils/output/note.js → src/providers/sh/util/etc/output/note.js

0
src/providers/sh/commands/lib/utils/output/param.js → src/providers/sh/util/etc/output/param.js

0
src/providers/sh/commands/lib/utils/output/right-pad.js → src/providers/sh/util/etc/output/right-pad.js

0
src/providers/sh/commands/lib/utils/output/stamp.js → src/providers/sh/util/etc/output/stamp.js

0
src/providers/sh/commands/lib/utils/output/success.js → src/providers/sh/util/etc/output/success.js

0
src/providers/sh/commands/lib/utils/output/table.js → src/providers/sh/util/etc/output/table.js

0
src/providers/sh/commands/lib/utils/output/uid.js → src/providers/sh/util/etc/output/uid.js

0
src/providers/sh/commands/lib/utils/output/wait.js → src/providers/sh/util/etc/output/wait.js

0
src/providers/sh/commands/lib/utils/to-human-path.js → src/providers/sh/util/etc/to-human-path.js

0
src/providers/sh/commands/lib/utils/url.js → src/providers/sh/util/etc/url.js

0
src/providers/sh/commands/lib/get-files.js → src/providers/sh/util/get-files.js

0
src/providers/sh/commands/lib/git.js → src/providers/sh/util/git.js

0
src/providers/sh/commands/lib/hash.js → src/providers/sh/util/hash.js

0
src/providers/sh/commands/lib/ignored.js → src/providers/sh/util/ignored.js

0
src/providers/sh/commands/lib/indent.js → src/providers/sh/util/indent.js

2
src/providers/sh/commands/lib/index.js → src/providers/sh/util/index.js

@ -22,7 +22,7 @@ const {
npm: getNpmFiles,
docker: getDockerFiles
} = require('./get-files')
const ua = require('../../util/ua')
const ua = require('./ua')
const hash = require('./hash')
const Agent = require('./agent')
const toHost = require('./to-host')

0
src/providers/sh/commands/lib/is-zeit-world.js → src/providers/sh/util/is-zeit-world.js

0
src/providers/sh/commands/lib/logs.js → src/providers/sh/util/logs.js

11
src/providers/sh/util/pkg.js

@ -1,11 +0,0 @@
const path = require('path')
const pkg = require('../../../../package.json')
try {
const distDir = path.dirname(process.execPath)
pkg._npmPkg = require(path.join(distDir, '../../package.json'))
} catch (err) {
pkg._npmPkg = null
}
module.exports = pkg

2
src/providers/sh/commands/lib/plans.js → src/providers/sh/util/plans.js

@ -1,6 +1,6 @@
const ms = require('ms')
const Now = require('../lib')
const Now = require('.')
async function parsePlan(json) {
const { subscription } = json

0
src/providers/sh/commands/lib/utils/input/prompt-options.js → src/providers/sh/util/prompt-options.js

0
src/providers/sh/commands/lib/re-alias.js → src/providers/sh/util/re-alias.js

0
src/providers/sh/commands/lib/read-metadata.js → src/providers/sh/util/read-metadata.js

0
src/providers/sh/commands/lib/scale-info.js → src/providers/sh/util/scale-info.js

2
src/providers/sh/commands/lib/scale.js → src/providers/sh/util/scale.js

@ -1,5 +1,5 @@
// Ours
const Now = require('../lib')
const Now = require('.')
module.exports = class Scale extends Now {
getInstances(id) {

2
src/providers/sh/commands/lib/secrets.js → src/providers/sh/util/secrets.js

@ -1,5 +1,5 @@
// Ours
const Now = require('../lib')
const Now = require('.')
const isUserError = res => ((res.status / 100) | 0) === 4

0
src/providers/sh/commands/lib/sort-deployments.js → src/providers/sh/util/sort-deployments.js

0
src/providers/sh/commands/lib/strlen.js → src/providers/sh/util/strlen.js

2
src/providers/sh/commands/lib/teams.js → src/providers/sh/util/teams.js

@ -1,4 +1,4 @@
const Now = require('../lib')
const Now = require('.')
module.exports = class Teams extends Now {
async create({ slug }) {

0
src/providers/sh/commands/lib/test.js → src/providers/sh/util/test.js

0
src/providers/sh/commands/lib/to-host.js → src/providers/sh/util/to-host.js

6
src/providers/sh/util/ua.js

@ -1,7 +1,7 @@
// node
// Native
const os = require('os')
// ours
const { version } = require('./pkg')
// Ours
const {version} = require('../../../util/pkg')
module.exports = `now ${version} node-${process.version} ${os.platform()} (${os.arch()})`

0
src/providers/sh/commands/lib/user.js → src/providers/sh/util/user.js

Loading…
Cancel
Save