(over 3 years ago)

The Now CLI goes open-source!

Guillermo Rauch (@rauchg)

Now 0.25.0 is out with a lot of new features and bug fixes. In addition, we're happy to announce you can now inspect its code, modify it, contribute to it or file issues and suggestions!

Deployment, with a developer API

When we wrote the first version of our command-line client, our API was not publicly available.

One of the most important bits of feedback from our customers was that many solutions they had tried before were lacking in flexibility. They found that Now, however, is an adequate abstraction for composable deploymentand custom workflows.

As such, we have made our mission to make sure we are the consumers of our own publicly-available APIs. When we announced support for ENV and secrets last week, we made sure to document the corresponding API endpoints.

The official Node.js client

We've made available aNode.js client that exposes a dual Promise and callback API, fantastically written by Timo Lins.

You can use it in conjunction with async/await to great effect:

const Now = require('now-client')
const now = new Now('api token')

// fetch all deployments for the user
const deployments = await now.getDeployments()

… or with a Promise API:

.then(data => console.log(data))
.catch(err => console.error(err.stack))

… or callbacks!

now.getDeployments((err, data) => {
if (err) return console.error(err.stack)

The official CLI

We've just open sourced our official command-line client: now.

We encourage the community to submit bug reports, improvements and ideas as issues and pull requests. This effectively immediately supersedes our former issue tracker now-issues.

If you are thinking about adding new functionality, please consider a compositional approach. For example, take a look at the handy now-realias by Remy Sharp, or read on!

New features

We also wanted to take this opportunity to share a few interesting additions we've made to now(1).

Pipe to now

Another great way to compose custom workflows is by using unix pipes. When now is invoked and piped it prints out the deployment URL as soon as it's available. Later, it exits 0 if the deployment is successful or 1 otherwise.

Better lists

All commands that render a list now include the total number of items returned and how long the process took:

Custom token and config

We've introduced two parameters to further customize now:

  • -c, --config to point to a custom config file (defaults to ~/.now.json)
  • -t, --token to specify a custom login token (defaults to the one in the config)

We hope you enjoy these improvements and we are looking forward to continuing our ongoing conversation to make our service better every day. In the words of Peteris Krummins:

> Give me the command line and I shall move the world.