Commit Graph

313 Commits

Author SHA1 Message Date
Pranay Prakash
381d5993e6 add @zeit/dockerignore (#1373) 2018-05-28 13:16:54 +02:00
Pranay Prakash
33356b3240 Strip quotes from Dockerfile labels (#1351)
* Strip quotes from Dockerfile labels

* remove console.log

* add test

* issue normal cert for nested subdomain (#1344)

* Prefer HTTP challenge for regular certs

* 12.0.0-canary.31

* Update non-existing team test

* 12.0.0-canary.32

* Bumped `update-check` to the latest version (#1354)

* 12.0.0-canary.33

* Strip quotes from Dockerfile labels

* remove console.log

* add test
2018-05-24 22:17:15 +02:00
Javi Velasco
7d19db4686 Update non-existing team test 2018-05-18 09:40:56 +02:00
Javi Velasco
75e493332e Refactor scale and remove old alias and scale (#1321)
* Migrate to arg@2.0.0

* Refactor scale command

* Move alias.js to alias/index.js

* Move alias set to its own file

* Move alias ls to its own file

* Move alias rm to its own file

* Remove old alias and scale files

* Update alias integration test

* Fix scaling to 0

* Read scale params from now.json on deploy
2018-05-15 10:14:06 +02:00
Javi Velasco
c12d2f4226 Migrate to arg@2.0.0 (#1316) 2018-04-18 11:35:11 -07:00
Javi Velasco
0d22fef2a0 Print response in docker test (#1304)
* Print response when failing in docker test file

* Add line

* Parse response text as JSON, print if it fails
2018-04-16 19:36:49 -07:00
Leo Lamprecht
469b1e8989 Improved integration tests (#1257)
* Assert exit code properly

* Don't strip ANSI stuff
2018-04-04 18:46:36 -07:00
Guillermo Rauch
0e9a21a263 Support for globally distributed deployments (#1205)
* Introduce v3 deployment scaling API

* Less retries on setScale()

* now scale cmd v3

* Deployment id fixes

* bump `ecmaVersion` we lint against, to consider object rest spread

* move EPIPE workaround to the main file

* uniform exiting approach

* clean up list command to avoid globals, be simpler to read

* add ability to supply a custom API version to `now.list()` helper

* upgrade babel toolchain

* introduce `arg`, which will incrementally replace `mri`

* global args accepted by all subcommands

* update lock

* fix `>` to be red when rendering errors

* use new output helpers by @tootallnate

* make object spread work

* bump flow webpack plugin

* lock

* revert to ava 0.25.x

* deprecate `now ls help` since an app could be named `help`

* validate number of arguments

* Fixed integration tests to match downgraded AVA

* Trimmed newline

* WIP

* whitespace fix

* add source map support by @timneutkens

* fix source maps paths

* remove sort-deployments util. it only considers `package.json`

* created -> age for consistency

* remove sorting what wasn't working well

* multiple improvements and simplifications

* improve rendering of urls, fix filtering by app

* only attempt to fetch instances if we have a count > 0

* better check for no deployments

* add instance lists if --all is supplied

* prevent the `.map` file from being included by pkg

* Store artifacts in Circle CI

* adapt INITIALIZING display by suggestion of @tootallnate

* Nothing to return

* now scale: Args parsing and remove ls

* various code improvements, error link for deprecation of `now scale ls`

* improve help

* make error more specific to deployment

* use new error output utilities for `now deploy`

* make some requires conditional

* default command style fix

* add reusable dc validation and normalization utilities

* start doing dc / region validation in scale

* refactor deploy to use reusable dc / region utils

* add slug support for warn util

* add success helper

* improve `scale` command

* add `responseErrorMessage` helper

* add `now.fetch()` helper

* remove console.log

* tweak output

* draft of verification step

* better errors

* implement (customizable) verification timeout

* bump now-host api to v3

* finish verification

* improve verification and sanitization

* improve copy

* fix ctrl+c during scale

* fix max scale in the absense of max

* improved rules saving

* fix listing the context you're running `now list` under

* add context name to list commands from slots

* improve --no-verify

* add 'elapsed' utility to print out the elapsed time nicely

* add per-dc timers

* improve debug helper to save date, improve time helper to log eagerly

* log every request, automatically

* tweak

* general tweaks to `now deploy`

* pass additional now config fields

* refactor `now rm`

* begin `inspect` command

* bump fetch-h2

* nearly complete new inspect command

* add `(dev)` to --version while in development

* fix 404 error if app is not matched

* improve scaling

* pass event types to the events endpoint

* fix file uploads

* fix passing a deployment hostname with trailing `/`

* fetch events only for non-static

* include uid in inspect

* finish up events

* reduce one indent by recommendation of @leo

* fix debugging for `now ls`

* Always return and exit at top-level in now.js

* improved scale message

* more elegant way of exiting, allowing for resource cleanup & faster

* flowify

* fix strange error which happens when orderly cleanup is done

* flow

* flow fix

* invoke now.close()

* improve list indentation

* refactor alias

* exit clean

* improve fallthrough entry in path alias

* make scale exit properly

* fix closing agent for inspection

* add type of deployment to ls

* better error handling of 403

* improve list style

* various algorithmic improvements

* Certificates refactor to consume the new API (#1210)

* Adapt cert command to the new api

* Use the new certs api for cert command

* Console log certs table and point to the right endpoint

* Remove unused certs client file

* Refactor certs commands

* Fix access to args

* Always close client

* Refactor alias (#1216)

* remove unnecessary file

* reads events from /deployment/:id/events endpoint (#1219)

* add polling (#1220)

* add polling

* hack to prevent partial json to be unluckily parsed in _flush

* cleanupAndResolveCalled to prevent running twice

* call onOpen only of going to 'log'. also call from cleanup

* callOnOpenOnce, don't reject on stream error, polling to finish

* fix eraseLines, make cleanup routine reject

* remove build-logger.js

* restored printEvent from deleted build-logger.js

* print locations of instance events

* bump api versions

* Switch now logs to events endpoint (#1223)

* move eraseLines to onRetry. show error in onRetry

* move printEvents to 'sh/util/events.js'

* use printEvents in `now logs` command

* pass printEvent to events.js

* make both follow and non-follow modes work

* remove socket.io

* improve logs command

* clarify team context

* Refactor alias

* Use ellapsed util in stamp

* use v3

* Refactor alias (#1224)

* Refactor alias

* Use ellapsed util in stamp

* Improvements

* Fix unit tests

* Ensure body exists when copying error attrs

* Add hook to close socket and wait message on process exit

* More retries when verifying the DNS records in alias

* Remove nowExit event listener on close

* Add remaning DCs message right away on alias

* Consistent timestamp when creating a deployment + scale dcs

* Ignore flow error

* Remove not needed now.close from alias

* Remove not needed now.close from inspect

* Bugfix: bind context to close socket handler

* Better error handling for scale command

* Now logs limit (#1226)

* restored -n LIMIT cli arg

* show date in format usabe for since and until

* pass direction and limit to endpoint

* implement follow mode after backwards slice

* add query, fix linefeeds, strip term commands

* implement head argument

* better logs default

* logs: fix -o raw mode, fix all mode

* Add verification for deploy

* Run integration tests using random email address

* Fix flow errors

* Fix wrong scale check

* Finish deploy on state READY

* Correct URL parsing

* Bumped Node.js to the latest version

* Output node version

* fix url display

* Returned URLs

* Improve messages in scale

* Clear URLs

* Strip ANSI codes

* Better logging messages for deploy

* Print ls to console instead of stderr

* Add create certificate certificate and ensure verification is done for a domain

* Write success in alias to stdout

* clearURL in stdout for alias test

* Update scale integration test

* Use stdout for scale success message

* Write alias rm response to stdout

* Refactor alias rm to use fetch from now client

* Fix tests
2018-04-03 08:14:41 -07:00
Volker Rose
05299eefb0 Added debounced waiting message to now ls (#1178)
* Added debounced waiting message to `list` command

Refs #1167, #1166

* Integrated debouncing directly into wait function

Refs #1167, #1166

* Moved debouncing in `wait` module directly to `wait` function

Refs #1167, #1166

* Added test for `wait`function

Refs #1167, #1166

* Removes oboslete logging from `wait` utitlity

* Removed semis

* Removed semis

* Make sense of it

* Bumped lockfile
2018-03-16 14:05:45 -07:00
Leo Lamprecht
49c470d131 Show better errors messages (#1182)
* Added support for fallback error

* Better errors for uploading files

* Ensure all errors are covered

* Formatted properly

* Added a few tests

* Wrapped up tests
2018-03-10 20:57:26 -08:00
Leo Lamprecht
7b149d0eb7 New integration test suite added (#1173)
* Proper unit tests

* Made integration tests run in CI

* Added packing to integration tests

* Don't lint test fixtures

* Added missing files

* Added command for local testing

* Correct command for local testing

* Compare client version

* Separate file for helper

* Added micro fixture

* Check OSS confirmation message

* Even better

* Deploy a microservice

* Made it run

* Remove deployment properly

* Clean up everything

* Fixed linting

* Added missing fixtures

* Added missing files

* Fixed linking

* Remove only deployments created in session

* Create alias for deployment

* Wrapped up 10 test

* Try scaling the deployment directly

* Wrapped up the 15 tests

* Ensure files are actually equal

* Test docker deployments

* Made sense of all

* Remove right after

* Set redirect URL properly

* Run integration tests on macOS

* Clean up in the end

* Use existing method to clean up

* Revoke the token properly

* Check for team error

* Wrapped up 18 tests

* Try deploying a static directory

* Try running it in user directory

* Auto-generate integration tests

* Removed Yarn lockfile

* Fixed linting

* Run test only if the one before was successful

* Bumped lockfile

* Removed catching

* Removed useless dependency

* Removed line

* Don't kill app and restore config

* Test properly locally

* Fixed linting

* Fixed properly

* Comment added

* Fixed arguments
2018-03-08 14:13:08 -08:00
Nathan Rajlich
2eb736f97d Add new output helper functions (#1146)
* Add "output" helper

* Cleanup and use `output` helper in Now class

* Fixes

* Update `chalk` to v2.3.1

* More logging

* Finish `now deploy` using new output functions

* Remove `.only()`

* Tests are silent

* Prevent double `> >` at the beginning of the user log line
2018-02-28 10:36:50 -08:00
Leo Lamprecht
d8faea8332 Don't upload meta files for static deployments (#1144)
* Don't upload meta files for static deployments

* Updated lockfile

* Ignore dockerfile as well
2018-02-26 17:17:23 -08:00
Robert Koch
3f5d3b3238 Corrected whitelisting mechanism for now.json (#1126)
* Updated how files are retrieved so whitelisted files specified in now.json or package.json are always added to the deployment, even if they are excluded in gitignore or npmignore.

* added new tests to check whitelisting of files in now.json and package.json and fixed/modified old tests to work with new behaviour.

* Ran linter, removed console statements.

* Wrote some documentation, fixed some typos, and removed some comments. Also ran prettier.

* Use spaces

* Use more spaces

* Use more spaces

* Use more spaces

* Use more spaces

* Use more spaces

* Use more spaces

* Use more spaces

* Use more spaces

* Corrected indentation

* Corrected indentation

* Corrected indentation
2018-02-24 21:07:54 -08:00
Seth Holladay
bcce2c5ffc Overhaul JSON reading, parsing, and writing (#899)
* Fix `now alias` for domains without DNS records (#898)

* 8.3.9

* Overhaul JSON loading and parsing

Reading JSON files from disk is now simpler, with clearer error messages.

Fixes #893

* More robust JSON writing

Make directories if needed and write to disk atomically.

* Remove unused import

* Escape @ in MX record example (#900)

* Pinned dependencies
2017-11-23 01:25:38 +01:00
Leo Lamprecht
a5cdaae401 Handle packing differently on CI 2017-09-03 16:56:14 +02:00
Leo Lamprecht
e5cd439383 Fixed tests for packed binary 2017-09-03 16:51:37 +02:00
Leo Lamprecht
aa38e055e7 Made tests for packed binary work 2017-09-02 17:09:39 +02:00
Leo Lamprecht
bd35c4091f Fixed tests 2017-09-02 16:44:52 +02:00
Leo Lamprecht
d0562dd3bf Several tests added 2017-09-02 13:41:32 +02:00
Leo Lamprecht
6f4f252875 Removed everything 2017-09-01 23:36:12 +02:00
Leo Lamprecht
7352306deb Removed build step 2017-05-20 12:52:09 +02:00
Nathan Rajlich
49a2a645c8 refactor the readMetaData() function (#508)
* refactor the `readMetaData()` function

* add a couple new test cases

* test: restore "build" prefix

Fixes Node.js <= v6

* add default values for `npm`/`docker` get files functions

Makes the logic simpler, since we don't have to check for existence.

* throw an error when missing start/now-start or server.js

* pass in entire `readMetaData()` result to Now.create()

This avoids us reading these files from the filesystem again
2017-05-05 14:10:22 -07:00
Leo Lamprecht
b0a88b377c Prettified everything 2017-05-02 12:10:22 +02:00
Nathan Rajlich
5a295017ec Fix failing tests on master branch (#469)
* remove "always-include-main" test case

It was testing for incorrect behavior that has now been fixed.

See: https://github.com/zeit/now-cli/pull/464

* remove "files" array from `main` related test cases

Makes these three tests pass once again.

* always run a test for "pack-now" even when not in CI

Otherwise `ava` fails because the test did not
run any assertions.
2017-05-01 11:39:25 -07:00
Leo Lamprecht
1f85f6d5db Moved back to XO for linting
cc @sindresorhus
2017-03-21 10:31:26 +01:00
Leo Lamprecht
7d19ad2e83 Prettified everything 2017-03-21 09:42:53 +01:00
Igor Klopov
133d0d93da Pkg with node async/await support (#360)
* pkg 3.0.0-beta.28

* use non-transpiled code for packing
2017-02-27 21:26:12 +01:00
Matheus Fernandes
3bf077fe2d Use a triangle that's actually printable on Windows (#348) 2017-02-23 09:37:21 +01:00
Igor Klopov
bc7759786b test packed now binary (#311) 2017-02-14 18:49:48 +01:00
Matheus Fernandes
47a5c69c26 Add now billing and now upgrade (#309)
* Add the skeleton of `now cc`

* Add the `ls` command

* Add `inquirer` dependency

* Add the `set-default` command

* Fix typo

* Show the real number of cards when selecting the default one

* Add the `ls` command

* Fix: Do not throw if there's no cards in the account

* Add `blessed` dependency

* Add the first sketch of `now cc add`

* Add instructions

* Add labels

* Save every element in the `elements` array instead of variables

* Tweaks

* Fix: update the element attribute if it's not a special case

* Add the `name` input; Add moving between inputs; Make the state more reliable

* Auto "detect" if the input is losing focus

* Remove useless stuff

* Add the ability to move between the fields with tab/shift+tab

* Add CCV field

* Make the cycling between the fields "infinite"

* Add expiration date field and allow only numbers in the CCV field

* The form shouldn't have a fixed height

* Add the address box and label

* Add the address fields

* Remove blessed stuff

* Add preliminary input field

* output utils

* add prompt for booleans

* fix @matheuss linting problems

* remove example

* lint

* error and info helpers

* helper for embedded commands

* Remove useless stuff

* Add `trailing` option

* Add `resolveChars` option

* Add `validate` option

* Add `strip-ansi` dependency

* Add `credit-card` dependency

* Add credit card masking

* Add support for expiration date mask

* Make things simpler

* Add auto completion support

* Always show the `card_` id prefix

* Add `@google/maps` dependency

* Always print the initial value if it's available

* Add `stripe` dependency

* Add `add()` method

* Add billing related utils

* Add `now cc add`

* Rename `cc` to `billing`

* Fix: log only one blank line

* Refactor

* Add list input component

* This shouldn't be here

* Add `code` output util

* Add `now upgrade | downgrade`

* add build step

* make it more future-proof

* more reliable build

* remove lock for now

* Hide the CCV

* Print the new line before `Saving card`

* Use the new `success` component

* Add confirmation steps for `cc rm` and `cc set-default`

* Temporarily monket patch Inquirer

* Build before testing

* Run the tests using the built files

* Fix the `prepublish` script and run the `build` one before packaging

* Improve `now help`
2017-02-14 10:35:28 -03:00
Nathan Rajlich
7f92455b2e lint *again* 2017-01-25 15:37:32 -08:00
Nathan Rajlich
73f22bb68e use G's wording for error message 2017-01-25 15:37:32 -08:00
Nathan Rajlich
0b2b39222c lint 2017-01-25 15:37:32 -08:00
Nathan Rajlich
1151830af6 a couple more test cases and fixes for them 2017-01-25 15:37:32 -08:00
Nathan Rajlich
4ad921e958 add first now.json test case
Passing.
2017-01-25 15:37:32 -08:00
Nathan Rajlich
c44284b0b3 remove unused require call 2017-01-25 15:37:32 -08:00
Nathan Rajlich
c11131310c fix lint 2017-01-25 15:37:32 -08:00
Nathan Rajlich
76e4ab5037 support now.files in now.json
Needs a test case still...
2017-01-25 15:37:32 -08:00
Eli Perelman
6e62d874bc Normalize package.json main file for extensionless or directory entries 2017-01-24 14:10:15 +01:00
Guillermo Rauch
244137ae90 Ignore improvements (#234)
* fix non-determinism in tests

* if `.dockerignore` doesn't exist, use `.gitignore`

* add back duplicate dei

* Move comment to appropriate line

* also check for exactly two duplicates
2017-01-21 14:58:31 -08:00
Leo Lamprecht
058c3f63ab Make tests use the correct binary 2017-01-10 21:16:16 +01:00
Jarmo Isotalo
059918e7ee Remove babel as dependecy (#209)
* Remove babel as a dependency
* Migrate from import foo from foo to const foo = require('foo')
* Update module.exports
* Update commander syntax

* Update pkg config and fix stuff

* Make XO happy

* Fix path in tests

* Fix typo

* Fix cleanup

* Debug pkg

* Fix pkg

* Fix process.argv for subcommands

* Run with --harmony-async-await when supported thx igor for help with this trick :D

* Use bash

* Set engines.node in package.json
2017-01-10 11:21:53 +01:00
Guillermo Rauch
8b7d1e60ec Improve ignore semantics. (#200)
* improve ignore semantics

* add files accidentally ignored previously
2017-01-06 10:15:46 +01:00
Leo Lamprecht
ccefece100 Removed duplicated fixture 2016-11-29 19:09:27 +01:00
Cody Zuschlag
50db54fd83 pass flags to subcommands (#98)
* rework args parsing

* test args parsing
2016-11-26 12:12:26 +01:00
Leo Lamprecht
96d93820c6 Added correct path for fixtures 2016-11-23 17:17:31 +01:00
Leo Lamprecht
3979d8472a Fixed even more XO issues 2016-10-22 14:16:22 +02:00
Guillermo Rauch
5bf0cfe897 Fix ignore (#151)
* switch to better ignore module, improve debugging

* add regression test for prefix bug (#142)

* remove old lib
2016-09-08 12:38:19 -07:00
Guillermo Rauch
9c8211caaa improve performance of file retrieval 2016-08-14 15:02:10 -07:00