You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
2.9 KiB

#!/usr/bin/env node
// Native
const { resolve } = require('path')
// Packages
const updateNotifier = require('update-notifier')
const chalk = require('chalk')
// Check if the current path exists and throw and error
// if the user is trying to deploy a non-existing path!
// This needs to be done exactly in this place, because
// the utility imports are taking advantage of it
try {
process.cwd()
} catch (err) {
if (err.code === 'ENOENT' && err.syscall === 'uv_cwd') {
console.log(`Current path doesn't exist!`)
} else {
console.log(err)
}
process.exit(1)
}
// Utilities
const pkg = require('../lib/pkg')
if (process.pkg) {
const notifier = updateNotifier({ 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`
if (pkg._npmPkg) {
message += `Run ${chalk.magenta('npm i -g now')} to update!`
} else {
message += `Please download binaries from https://zeit.co/download`
}
notifier.notify({ message })
}
8 years ago
}
8 years ago
// This command will be run if no other sub command is specified
const defaultCommand = 'deploy'
const commands = new Set([
defaultCommand,
'help',
'list',
'ls',
'rm',
'remove',
'alias',
'aliases',
'ln',
'domain',
'domains',
'dns',
'cert',
'certs',
'secret',
'secrets',
'cc',
'billing',
'upgrade',
'downgrade',
Add `logs`, `teams`, `switch`, `scale`, new `ls` and much more (#468) * Feature/teams (#25) * Add the skeleton of `now teams` * Add support for "complex" command aliases This adds the ability to set, for example, `now switch` as an alias for `now teams switch`. Subsequent commands and arguments are taken into account: `now switch zeit --debug` will be parsed to `now teams switch zeit --debug`. * `now switch` => `now teams switch` * Extract `rightPad` * Extract `eraseLines` * Extract `✓` * Text input: add `valid` option * Text input: add `forceLowerCase` option * Add preliminary `now teams add` * Make the linter happy * Extract `> NOTE: ...` * Add missing labels * Fix typos * Add missing parameters * Change the section label after inviting all specified team mates * Call the API after each email submission * Show the elapsed time after each `inviteUser` api call * Handle user aborts * We don't need `args` for `now teams add` * Add missing `await` * Extract regex * `process.exit()` => `exit(1)` * `prompt-bool` is an `input` util, not an `output` one * Add the ability to delete a key from the config file * Add `fatal-error` * Add `now teams invite` * This shouldn't be black * Save the username in `~/.now.json` upon login * Save the token and userId instead of token and email * Fix typo * Save more info about the user to `~/.now.json` upon login * `~/.now.json`: Persist the current time when login in * Add `user` helper * `user.userId` => `user.id` * Tweak code organization * Add caching system to `.now.json` * Automatically switch to a team after its creation * Introduce the concept of `inactive` teams * Use bold for `payment method` * Remove duplicated code * Add line breaks * Auto complete with the first match * Remove placeholder stuff * Add the user's email to the list of suggestions * FIx bad merge * Add `now switch` * Make `now teams invite` more reliable and faster * Shut up XO * Improve autocompletion * Fix TypeError * Make stuff pretty * Not sure how this got overwritten * Feature/domains (#26) * Add the skeleton of `now teams` * Add support for "complex" command aliases This adds the ability to set, for example, `now switch` as an alias for `now teams switch`. Subsequent commands and arguments are taken into account: `now switch zeit --debug` will be parsed to `now teams switch zeit --debug`. * `now switch` => `now teams switch` * Extract `rightPad` * Extract `eraseLines` * Extract `✓` * Text input: add `valid` option * Text input: add `forceLowerCase` option * Add preliminary `now teams add` * Make the linter happy * Extract `> NOTE: ...` * Add missing labels * Fix typos * Add missing parameters * Change the section label after inviting all specified team mates * Call the API after each email submission * Show the elapsed time after each `inviteUser` api call * Handle user aborts * We don't need `args` for `now teams add` * Add missing `await` * Extract regex * `process.exit()` => `exit(1)` * `prompt-bool` is an `input` util, not an `output` one * Add the ability to delete a key from the config file * Add `fatal-error` * Add `now teams invite` * This shouldn't be black * Save the username in `~/.now.json` upon login * Save the token and userId instead of token and email * Fix typo * Save more info about the user to `~/.now.json` upon login * `~/.now.json`: Persist the current time when login in * Add `user` helper * `user.userId` => `user.id` * Tweak code organization * Add caching system to `.now.json` * Automatically switch to a team after its creation * Introduce the concept of `inactive` teams * Use bold for `payment method` * Remove duplicated code * Add line breaks * Auto complete with the first match * Remove placeholder stuff * Add the user's email to the list of suggestions * FIx bad merge * Add `now switch` * Make `now teams invite` more reliable and faster * Shut up XO * Improve autocompletion * Fix TypeError * Make stuff pretty * Not sure how this got overwritten * `prompt-bool` is an `input` util, not an `output` one * Make stuff pretty * Not sure how this got overwritten * Add domains.status, price and buy * Add `now domains buy` * Add the ability to buy a domain when running `now alias` * Logs (#27) * Added `logs` sub command * add missing dependencies * use utils/output/logo * logs: fix wrong reference * logs: fix buffer time * sort build logs (#19) * logs: use lib/logs * lib/logs: fix * logs: resolve url to id * logs: default to follow * logs: don't resolve URL to id * logs: revert to default unfollow * logs: add since option and until option * logs: fix default number of logs * fix logs auth * logs: listen ready event * logs: new endpoint * log: remove v query param * logs: default to not include access logs * fix styles of now-logs * logs: remove relative time * Fix bad merge conflict * Add `now scale` (#28) * Inital drafts fro `now-scale` * More final draft * sketch new `now ls` format * Add sketch for `now ls --all` * Placeholder for `now scale ls` * "Prettify" and improve scale command Signed-off-by: Jarmo Isotalo <jamo@isotalo.fi> * Adopt to now-list api changes * Improve now-list --all colors Signed-off-by: Jarmo Isotalo <jamo@isotalo.fi> * Add now scale ls Signed-off-by: Jarmo Isotalo <jamo@isotalo.fi> * Prettify * Show auto correctly * Add partial match scale for now alias * Make alias to match scale before uptading alias and presumably a bunch of unrelated style changes * Replace spinners with help text * Make the list :nice: * Make now-list great again * Final touches * Allow --all only when app is defined * Add progress tracking to scale * Correctly use --all for > 0 deployments found [1s] and improve scale info ux * Show --all info if we are hiding stuff * Fixes * Refactor scale info and unfreeze * Fixes * Proper progress bar * Fix bad merge * Fix auth for now-scale * logs: fix reading config * Fix reference * Small ux tweaks * Improve now alias ux * Fix a ton of lint errors * Fix scaling up and alias ux * Fix lint errors + prettify * Make `bin/now-scale.js` available via `now scale` * Fix errornous syntax for domains list * And use correct header for domains list * Update now-scale help to match new spec * `await` for `cfg.read()` on `cfg.remove()` * Update scale command * Cleanu p * Fetch the teams from the api on teams.ls() Plus prettier shit * Run prettier hooks manually * Make `now switch` perfect * Rm unused variables * Lint * Ruin ux but lint * Consume `POST /teams` * Consume `PATCH /teams/:id` * Fix/teams support (#29) * Add teams support for lib/index.js * Consume `POST /teams/:id/members` * Make `now teams create` and `now teams invite` perfect * Add a way to not send `?teamId` if necessary * Add `?teamId=${currentTeam.id}` support to all comamnds and subcommands * Display the username only if it's available * Consume the preoduction endpoits for domain purchase * Fix typo * Fix grammar * Fix grammar * Remove useless require * Display the user name/team slug on creation/list commands * Remove use of old, now undefined variable * Show domains in bold on `now domains ls` * `user.userId` => `user.uid` * Remove console.log * Show a better messsage upon unexpected `domains.buy()` error * typo * Consume new `/plan` API and fix plan check * Update `now upgrade` – consume new APIs and expose new plans * Fix `now ugprade` info message * `now cc`: consume new APIs and fix error messages * Add team/user context to `now alias` when buying a domain * Fix wording on `now domains buy` * Add stamp to domain purchase * Improve scale ux * Remove ToS prompt upon login * Fix `prompt-bool` trailing issues * Remove useless `require` * Allow `now switch <username>` * Make `now help` better * This shouldn't be here * Make `now switch` incredible * Remove old stuff from ~/.now.json * Add comments * `now team` => `now teams` * 5.0.0 * Fix linter * Fix DNS * Parse subdomain * FIx lint * drop IDs for certs * Make now ls look nice also when noTTY * Make now list look nice when colors are not supported * Mane certs ls look nice when we have no colers * Now ls --all can also take uniq url as a parameter * Improve now ls --all * Now ls -all takes alias as an argument
8 years ago
'team',
'teams',
'switch',
'log',
'logs',
'scale',
'logout',
'whoami'
])
const aliases = new Map([
['ls', 'list'],
['rm', 'remove'],
['ln', 'alias'],
['aliases', 'alias'],
['domain', 'domains'],
['cert', 'certs'],
['secret', 'secrets'],
['cc', 'billing'],
Add `logs`, `teams`, `switch`, `scale`, new `ls` and much more (#468) * Feature/teams (#25) * Add the skeleton of `now teams` * Add support for "complex" command aliases This adds the ability to set, for example, `now switch` as an alias for `now teams switch`. Subsequent commands and arguments are taken into account: `now switch zeit --debug` will be parsed to `now teams switch zeit --debug`. * `now switch` => `now teams switch` * Extract `rightPad` * Extract `eraseLines` * Extract `✓` * Text input: add `valid` option * Text input: add `forceLowerCase` option * Add preliminary `now teams add` * Make the linter happy * Extract `> NOTE: ...` * Add missing labels * Fix typos * Add missing parameters * Change the section label after inviting all specified team mates * Call the API after each email submission * Show the elapsed time after each `inviteUser` api call * Handle user aborts * We don't need `args` for `now teams add` * Add missing `await` * Extract regex * `process.exit()` => `exit(1)` * `prompt-bool` is an `input` util, not an `output` one * Add the ability to delete a key from the config file * Add `fatal-error` * Add `now teams invite` * This shouldn't be black * Save the username in `~/.now.json` upon login * Save the token and userId instead of token and email * Fix typo * Save more info about the user to `~/.now.json` upon login * `~/.now.json`: Persist the current time when login in * Add `user` helper * `user.userId` => `user.id` * Tweak code organization * Add caching system to `.now.json` * Automatically switch to a team after its creation * Introduce the concept of `inactive` teams * Use bold for `payment method` * Remove duplicated code * Add line breaks * Auto complete with the first match * Remove placeholder stuff * Add the user's email to the list of suggestions * FIx bad merge * Add `now switch` * Make `now teams invite` more reliable and faster * Shut up XO * Improve autocompletion * Fix TypeError * Make stuff pretty * Not sure how this got overwritten * Feature/domains (#26) * Add the skeleton of `now teams` * Add support for "complex" command aliases This adds the ability to set, for example, `now switch` as an alias for `now teams switch`. Subsequent commands and arguments are taken into account: `now switch zeit --debug` will be parsed to `now teams switch zeit --debug`. * `now switch` => `now teams switch` * Extract `rightPad` * Extract `eraseLines` * Extract `✓` * Text input: add `valid` option * Text input: add `forceLowerCase` option * Add preliminary `now teams add` * Make the linter happy * Extract `> NOTE: ...` * Add missing labels * Fix typos * Add missing parameters * Change the section label after inviting all specified team mates * Call the API after each email submission * Show the elapsed time after each `inviteUser` api call * Handle user aborts * We don't need `args` for `now teams add` * Add missing `await` * Extract regex * `process.exit()` => `exit(1)` * `prompt-bool` is an `input` util, not an `output` one * Add the ability to delete a key from the config file * Add `fatal-error` * Add `now teams invite` * This shouldn't be black * Save the username in `~/.now.json` upon login * Save the token and userId instead of token and email * Fix typo * Save more info about the user to `~/.now.json` upon login * `~/.now.json`: Persist the current time when login in * Add `user` helper * `user.userId` => `user.id` * Tweak code organization * Add caching system to `.now.json` * Automatically switch to a team after its creation * Introduce the concept of `inactive` teams * Use bold for `payment method` * Remove duplicated code * Add line breaks * Auto complete with the first match * Remove placeholder stuff * Add the user's email to the list of suggestions * FIx bad merge * Add `now switch` * Make `now teams invite` more reliable and faster * Shut up XO * Improve autocompletion * Fix TypeError * Make stuff pretty * Not sure how this got overwritten * `prompt-bool` is an `input` util, not an `output` one * Make stuff pretty * Not sure how this got overwritten * Add domains.status, price and buy * Add `now domains buy` * Add the ability to buy a domain when running `now alias` * Logs (#27) * Added `logs` sub command * add missing dependencies * use utils/output/logo * logs: fix wrong reference * logs: fix buffer time * sort build logs (#19) * logs: use lib/logs * lib/logs: fix * logs: resolve url to id * logs: default to follow * logs: don't resolve URL to id * logs: revert to default unfollow * logs: add since option and until option * logs: fix default number of logs * fix logs auth * logs: listen ready event * logs: new endpoint * log: remove v query param * logs: default to not include access logs * fix styles of now-logs * logs: remove relative time * Fix bad merge conflict * Add `now scale` (#28) * Inital drafts fro `now-scale` * More final draft * sketch new `now ls` format * Add sketch for `now ls --all` * Placeholder for `now scale ls` * "Prettify" and improve scale command Signed-off-by: Jarmo Isotalo <jamo@isotalo.fi> * Adopt to now-list api changes * Improve now-list --all colors Signed-off-by: Jarmo Isotalo <jamo@isotalo.fi> * Add now scale ls Signed-off-by: Jarmo Isotalo <jamo@isotalo.fi> * Prettify * Show auto correctly * Add partial match scale for now alias * Make alias to match scale before uptading alias and presumably a bunch of unrelated style changes * Replace spinners with help text * Make the list :nice: * Make now-list great again * Final touches * Allow --all only when app is defined * Add progress tracking to scale * Correctly use --all for > 0 deployments found [1s] and improve scale info ux * Show --all info if we are hiding stuff * Fixes * Refactor scale info and unfreeze * Fixes * Proper progress bar * Fix bad merge * Fix auth for now-scale * logs: fix reading config * Fix reference * Small ux tweaks * Improve now alias ux * Fix a ton of lint errors * Fix scaling up and alias ux * Fix lint errors + prettify * Make `bin/now-scale.js` available via `now scale` * Fix errornous syntax for domains list * And use correct header for domains list * Update now-scale help to match new spec * `await` for `cfg.read()` on `cfg.remove()` * Update scale command * Cleanu p * Fetch the teams from the api on teams.ls() Plus prettier shit * Run prettier hooks manually * Make `now switch` perfect * Rm unused variables * Lint * Ruin ux but lint * Consume `POST /teams` * Consume `PATCH /teams/:id` * Fix/teams support (#29) * Add teams support for lib/index.js * Consume `POST /teams/:id/members` * Make `now teams create` and `now teams invite` perfect * Add a way to not send `?teamId` if necessary * Add `?teamId=${currentTeam.id}` support to all comamnds and subcommands * Display the username only if it's available * Consume the preoduction endpoits for domain purchase * Fix typo * Fix grammar * Fix grammar * Remove useless require * Display the user name/team slug on creation/list commands * Remove use of old, now undefined variable * Show domains in bold on `now domains ls` * `user.userId` => `user.uid` * Remove console.log * Show a better messsage upon unexpected `domains.buy()` error * typo * Consume new `/plan` API and fix plan check * Update `now upgrade` – consume new APIs and expose new plans * Fix `now ugprade` info message * `now cc`: consume new APIs and fix error messages * Add team/user context to `now alias` when buying a domain * Fix wording on `now domains buy` * Add stamp to domain purchase * Improve scale ux * Remove ToS prompt upon login * Fix `prompt-bool` trailing issues * Remove useless `require` * Allow `now switch <username>` * Make `now help` better * This shouldn't be here * Make `now switch` incredible * Remove old stuff from ~/.now.json * Add comments * `now team` => `now teams` * 5.0.0 * Fix linter * Fix DNS * Parse subdomain * FIx lint * drop IDs for certs * Make now ls look nice also when noTTY * Make now list look nice when colors are not supported * Mane certs ls look nice when we have no colers * Now ls --all can also take uniq url as a parameter * Improve now ls --all * Now ls -all takes alias as an argument
8 years ago
['downgrade', 'upgrade'],
['team', 'teams'],
['switch', 'teams switch'],
['log', 'logs']
])
let cmd = defaultCommand
let args = process.argv.slice(2)
const index = args.findIndex(a => commands.has(a))
9 years ago
if (index > -1) {
cmd = args[index]
args.splice(index, 1)
if (cmd === 'help') {
if (index < args.length && commands.has(args[index])) {
cmd = args[index]
args.splice(index, 1)
} else {
cmd = defaultCommand
}
args.unshift('--help')
}
9 years ago
cmd = aliases.get(cmd) || cmd
Add `logs`, `teams`, `switch`, `scale`, new `ls` and much more (#468) * Feature/teams (#25) * Add the skeleton of `now teams` * Add support for &#34;complex&#34; command aliases This adds the ability to set, for example, `now switch` as an alias for `now teams switch`. Subsequent commands and arguments are taken into account: `now switch zeit --debug` will be parsed to `now teams switch zeit --debug`. * `now switch` =&gt; `now teams switch` * Extract `rightPad` * Extract `eraseLines` * Extract `✓` * Text input: add `valid` option * Text input: add `forceLowerCase` option * Add preliminary `now teams add` * Make the linter happy * Extract `&gt; NOTE: ...` * Add missing labels * Fix typos * Add missing parameters * Change the section label after inviting all specified team mates * Call the API after each email submission * Show the elapsed time after each `inviteUser` api call * Handle user aborts * We don&#39;t need `args` for `now teams add` * Add missing `await` * Extract regex * `process.exit()` =&gt; `exit(1)` * `prompt-bool` is an `input` util, not an `output` one * Add the ability to delete a key from the config file * Add `fatal-error` * Add `now teams invite` * This shouldn&#39;t be black * Save the username in `~/.now.json` upon login * Save the token and userId instead of token and email * Fix typo * Save more info about the user to `~/.now.json` upon login * `~/.now.json`: Persist the current time when login in * Add `user` helper * `user.userId` =&gt; `user.id` * Tweak code organization * Add caching system to `.now.json` * Automatically switch to a team after its creation * Introduce the concept of `inactive` teams * Use bold for `payment method` * Remove duplicated code * Add line breaks * Auto complete with the first match * Remove placeholder stuff * Add the user&#39;s email to the list of suggestions * FIx bad merge * Add `now switch` * Make `now teams invite` more reliable and faster * Shut up XO * Improve autocompletion * Fix TypeError * Make stuff pretty * Not sure how this got overwritten * Feature/domains (#26) * Add the skeleton of `now teams` * Add support for &#34;complex&#34; command aliases This adds the ability to set, for example, `now switch` as an alias for `now teams switch`. Subsequent commands and arguments are taken into account: `now switch zeit --debug` will be parsed to `now teams switch zeit --debug`. * `now switch` =&gt; `now teams switch` * Extract `rightPad` * Extract `eraseLines` * Extract `✓` * Text input: add `valid` option * Text input: add `forceLowerCase` option * Add preliminary `now teams add` * Make the linter happy * Extract `&gt; NOTE: ...` * Add missing labels * Fix typos * Add missing parameters * Change the section label after inviting all specified team mates * Call the API after each email submission * Show the elapsed time after each `inviteUser` api call * Handle user aborts * We don&#39;t need `args` for `now teams add` * Add missing `await` * Extract regex * `process.exit()` =&gt; `exit(1)` * `prompt-bool` is an `input` util, not an `output` one * Add the ability to delete a key from the config file * Add `fatal-error` * Add `now teams invite` * This shouldn&#39;t be black * Save the username in `~/.now.json` upon login * Save the token and userId instead of token and email * Fix typo * Save more info about the user to `~/.now.json` upon login * `~/.now.json`: Persist the current time when login in * Add `user` helper * `user.userId` =&gt; `user.id` * Tweak code organization * Add caching system to `.now.json` * Automatically switch to a team after its creation * Introduce the concept of `inactive` teams * Use bold for `payment method` * Remove duplicated code * Add line breaks * Auto complete with the first match * Remove placeholder stuff * Add the user&#39;s email to the list of suggestions * FIx bad merge * Add `now switch` * Make `now teams invite` more reliable and faster * Shut up XO * Improve autocompletion * Fix TypeError * Make stuff pretty * Not sure how this got overwritten * `prompt-bool` is an `input` util, not an `output` one * Make stuff pretty * Not sure how this got overwritten * Add domains.status, price and buy * Add `now domains buy` * Add the ability to buy a domain when running `now alias` * Logs (#27) * Added `logs` sub command * add missing dependencies * use utils/output/logo * logs: fix wrong reference * logs: fix buffer time * sort build logs (#19) * logs: use lib/logs * lib/logs: fix * logs: resolve url to id * logs: default to follow * logs: don&#39;t resolve URL to id * logs: revert to default unfollow * logs: add since option and until option * logs: fix default number of logs * fix logs auth * logs: listen ready event * logs: new endpoint * log: remove v query param * logs: default to not include access logs * fix styles of now-logs * logs: remove relative time * Fix bad merge conflict * Add `now scale` (#28) * Inital drafts fro `now-scale` * More final draft * sketch new `now ls` format * Add sketch for `now ls --all` * Placeholder for `now scale ls` * &#34;Prettify&#34; and improve scale command Signed-off-by: Jarmo Isotalo &lt;jamo@isotalo.fi&gt; * Adopt to now-list api changes * Improve now-list --all colors Signed-off-by: Jarmo Isotalo &lt;jamo@isotalo.fi&gt; * Add now scale ls Signed-off-by: Jarmo Isotalo &lt;jamo@isotalo.fi&gt; * Prettify * Show auto correctly * Add partial match scale for now alias * Make alias to match scale before uptading alias and presumably a bunch of unrelated style changes * Replace spinners with help text * Make the list :nice: * Make now-list great again * Final touches * Allow --all only when app is defined * Add progress tracking to scale * Correctly use --all for &gt; 0 deployments found [1s] and improve scale info ux * Show --all info if we are hiding stuff * Fixes * Refactor scale info and unfreeze * Fixes * Proper progress bar * Fix bad merge * Fix auth for now-scale * logs: fix reading config * Fix reference * Small ux tweaks * Improve now alias ux * Fix a ton of lint errors * Fix scaling up and alias ux * Fix lint errors + prettify * Make `bin/now-scale.js` available via `now scale` * Fix errornous syntax for domains list * And use correct header for domains list * Update now-scale help to match new spec * `await` for `cfg.read()` on `cfg.remove()` * Update scale command * Cleanu p * Fetch the teams from the api on teams.ls() Plus prettier shit * Run prettier hooks manually * Make `now switch` perfect * Rm unused variables * Lint * Ruin ux but lint * Consume `POST /teams` * Consume `PATCH /teams/:id` * Fix/teams support (#29) * Add teams support for lib/index.js * Consume `POST /teams/:id/members` * Make `now teams create` and `now teams invite` perfect * Add a way to not send `?teamId` if necessary * Add `?teamId=${currentTeam.id}` support to all comamnds and subcommands * Display the username only if it&#39;s available * Consume the preoduction endpoits for domain purchase * Fix typo * Fix grammar * Fix grammar * Remove useless require * Display the user name/team slug on creation/list commands * Remove use of old, now undefined variable * Show domains in bold on `now domains ls` * `user.userId` =&gt; `user.uid` * Remove console.log * Show a better messsage upon unexpected `domains.buy()` error * typo * Consume new `/plan` API and fix plan check * Update `now upgrade` – consume new APIs and expose new plans * Fix `now ugprade` info message * `now cc`: consume new APIs and fix error messages * Add team/user context to `now alias` when buying a domain * Fix wording on `now domains buy` * Add stamp to domain purchase * Improve scale ux * Remove ToS prompt upon login * Fix `prompt-bool` trailing issues * Remove useless `require` * Allow `now switch &lt;username&gt;` * Make `now help` better * This shouldn&#39;t be here * Make `now switch` incredible * Remove old stuff from ~/.now.json * Add comments * `now team` =&gt; `now teams` * 5.0.0 * Fix linter * Fix DNS * Parse subdomain * FIx lint * drop IDs for certs * Make now ls look nice also when noTTY * Make now list look nice when colors are not supported * Mane certs ls look nice when we have no colers * Now ls --all can also take uniq url as a parameter * Improve now ls --all * Now ls -all takes alias as an argument
8 years ago
if (cmd.includes(' ')) {
const parts = cmd.split(' ')
cmd = parts.shift()
args = [].concat(parts, args)
Add `logs`, `teams`, `switch`, `scale`, new `ls` and much more (#468) * Feature/teams (#25) * Add the skeleton of `now teams` * Add support for &#34;complex&#34; command aliases This adds the ability to set, for example, `now switch` as an alias for `now teams switch`. Subsequent commands and arguments are taken into account: `now switch zeit --debug` will be parsed to `now teams switch zeit --debug`. * `now switch` =&gt; `now teams switch` * Extract `rightPad` * Extract `eraseLines` * Extract `✓` * Text input: add `valid` option * Text input: add `forceLowerCase` option * Add preliminary `now teams add` * Make the linter happy * Extract `&gt; NOTE: ...` * Add missing labels * Fix typos * Add missing parameters * Change the section label after inviting all specified team mates * Call the API after each email submission * Show the elapsed time after each `inviteUser` api call * Handle user aborts * We don&#39;t need `args` for `now teams add` * Add missing `await` * Extract regex * `process.exit()` =&gt; `exit(1)` * `prompt-bool` is an `input` util, not an `output` one * Add the ability to delete a key from the config file * Add `fatal-error` * Add `now teams invite` * This shouldn&#39;t be black * Save the username in `~/.now.json` upon login * Save the token and userId instead of token and email * Fix typo * Save more info about the user to `~/.now.json` upon login * `~/.now.json`: Persist the current time when login in * Add `user` helper * `user.userId` =&gt; `user.id` * Tweak code organization * Add caching system to `.now.json` * Automatically switch to a team after its creation * Introduce the concept of `inactive` teams * Use bold for `payment method` * Remove duplicated code * Add line breaks * Auto complete with the first match * Remove placeholder stuff * Add the user&#39;s email to the list of suggestions * FIx bad merge * Add `now switch` * Make `now teams invite` more reliable and faster * Shut up XO * Improve autocompletion * Fix TypeError * Make stuff pretty * Not sure how this got overwritten * Feature/domains (#26) * Add the skeleton of `now teams` * Add support for &#34;complex&#34; command aliases This adds the ability to set, for example, `now switch` as an alias for `now teams switch`. Subsequent commands and arguments are taken into account: `now switch zeit --debug` will be parsed to `now teams switch zeit --debug`. * `now switch` =&gt; `now teams switch` * Extract `rightPad` * Extract `eraseLines` * Extract `✓` * Text input: add `valid` option * Text input: add `forceLowerCase` option * Add preliminary `now teams add` * Make the linter happy * Extract `&gt; NOTE: ...` * Add missing labels * Fix typos * Add missing parameters * Change the section label after inviting all specified team mates * Call the API after each email submission * Show the elapsed time after each `inviteUser` api call * Handle user aborts * We don&#39;t need `args` for `now teams add` * Add missing `await` * Extract regex * `process.exit()` =&gt; `exit(1)` * `prompt-bool` is an `input` util, not an `output` one * Add the ability to delete a key from the config file * Add `fatal-error` * Add `now teams invite` * This shouldn&#39;t be black * Save the username in `~/.now.json` upon login * Save the token and userId instead of token and email * Fix typo * Save more info about the user to `~/.now.json` upon login * `~/.now.json`: Persist the current time when login in * Add `user` helper * `user.userId` =&gt; `user.id` * Tweak code organization * Add caching system to `.now.json` * Automatically switch to a team after its creation * Introduce the concept of `inactive` teams * Use bold for `payment method` * Remove duplicated code * Add line breaks * Auto complete with the first match * Remove placeholder stuff * Add the user&#39;s email to the list of suggestions * FIx bad merge * Add `now switch` * Make `now teams invite` more reliable and faster * Shut up XO * Improve autocompletion * Fix TypeError * Make stuff pretty * Not sure how this got overwritten * `prompt-bool` is an `input` util, not an `output` one * Make stuff pretty * Not sure how this got overwritten * Add domains.status, price and buy * Add `now domains buy` * Add the ability to buy a domain when running `now alias` * Logs (#27) * Added `logs` sub command * add missing dependencies * use utils/output/logo * logs: fix wrong reference * logs: fix buffer time * sort build logs (#19) * logs: use lib/logs * lib/logs: fix * logs: resolve url to id * logs: default to follow * logs: don&#39;t resolve URL to id * logs: revert to default unfollow * logs: add since option and until option * logs: fix default number of logs * fix logs auth * logs: listen ready event * logs: new endpoint * log: remove v query param * logs: default to not include access logs * fix styles of now-logs * logs: remove relative time * Fix bad merge conflict * Add `now scale` (#28) * Inital drafts fro `now-scale` * More final draft * sketch new `now ls` format * Add sketch for `now ls --all` * Placeholder for `now scale ls` * &#34;Prettify&#34; and improve scale command Signed-off-by: Jarmo Isotalo &lt;jamo@isotalo.fi&gt; * Adopt to now-list api changes * Improve now-list --all colors Signed-off-by: Jarmo Isotalo &lt;jamo@isotalo.fi&gt; * Add now scale ls Signed-off-by: Jarmo Isotalo &lt;jamo@isotalo.fi&gt; * Prettify * Show auto correctly * Add partial match scale for now alias * Make alias to match scale before uptading alias and presumably a bunch of unrelated style changes * Replace spinners with help text * Make the list :nice: * Make now-list great again * Final touches * Allow --all only when app is defined * Add progress tracking to scale * Correctly use --all for &gt; 0 deployments found [1s] and improve scale info ux * Show --all info if we are hiding stuff * Fixes * Refactor scale info and unfreeze * Fixes * Proper progress bar * Fix bad merge * Fix auth for now-scale * logs: fix reading config * Fix reference * Small ux tweaks * Improve now alias ux * Fix a ton of lint errors * Fix scaling up and alias ux * Fix lint errors + prettify * Make `bin/now-scale.js` available via `now scale` * Fix errornous syntax for domains list * And use correct header for domains list * Update now-scale help to match new spec * `await` for `cfg.read()` on `cfg.remove()` * Update scale command * Cleanu p * Fetch the teams from the api on teams.ls() Plus prettier shit * Run prettier hooks manually * Make `now switch` perfect * Rm unused variables * Lint * Ruin ux but lint * Consume `POST /teams` * Consume `PATCH /teams/:id` * Fix/teams support (#29) * Add teams support for lib/index.js * Consume `POST /teams/:id/members` * Make `now teams create` and `now teams invite` perfect * Add a way to not send `?teamId` if necessary * Add `?teamId=${currentTeam.id}` support to all comamnds and subcommands * Display the username only if it&#39;s available * Consume the preoduction endpoits for domain purchase * Fix typo * Fix grammar * Fix grammar * Remove useless require * Display the user name/team slug on creation/list commands * Remove use of old, now undefined variable * Show domains in bold on `now domains ls` * `user.userId` =&gt; `user.uid` * Remove console.log * Show a better messsage upon unexpected `domains.buy()` error * typo * Consume new `/plan` API and fix plan check * Update `now upgrade` – consume new APIs and expose new plans * Fix `now ugprade` info message * `now cc`: consume new APIs and fix error messages * Add team/user context to `now alias` when buying a domain * Fix wording on `now domains buy` * Add stamp to domain purchase * Improve scale ux * Remove ToS prompt upon login * Fix `prompt-bool` trailing issues * Remove useless `require` * Allow `now switch &lt;username&gt;` * Make `now help` better * This shouldn&#39;t be here * Make `now switch` incredible * Remove old stuff from ~/.now.json * Add comments * `now team` =&gt; `now teams` * 5.0.0 * Fix linter * Fix DNS * Parse subdomain * FIx lint * drop IDs for certs * Make now ls look nice also when noTTY * Make now list look nice when colors are not supported * Mane certs ls look nice when we have no colers * Now ls --all can also take uniq url as a parameter * Improve now ls --all * Now ls -all takes alias as an argument
8 years ago
}
9 years ago
}
// Don't throw a useless error message when running `now help help`
// rather show the general help and be useful
if (cmd === 'help') {
cmd = 'deploy'
} else if (cmd === defaultCommand && args[0] === 'login') {
args[0] = '--login'
}
const bin = resolve(__dirname, 'now-' + cmd + '.js')
// Prepare process.argv for subcommand
process.argv = process.argv.slice(0, 2).concat(args)
8 years ago
// Load sub command
// With custom parameter to make "pkg" happy
require(bin, 'may-exclude')