This post contains content about Now 1.0 – Learn about the latest version, Now 2.0.
Now 2.0 - Upgrade Available
Saturday, January 28th 2017 (over 2 years ago)

Customizing Now using `now.json`

Nathan Rajlich (@tootallnate)
Leo Lamprecht (@notquiteleo)

As the CLI for Now grew bigger, many options were introduced for allowing you to customize its behaviour. Because of this, we're now shipping an easy way of keeping track of your configuration.

Starting with v4.3.0 (partially landed silently in v3.1.0 and v4.0.0) of the now CLI, you'll be able to define all of these options in a separate file named now.json:

Properties

Here's a list of all the JSON properties you can use inside the now.json file. If you already have a package.json file inside your project, you can define all of the following properties inside the now property within it instead:

`name` (string)

The prefix for all new deployment instances. The CLI usually generates this field automatically based on the name of the directory. But if you'd like to define it explictly, this is the way to go.

"name": "zeit-chat"

`alias` (string|array)

Aliases which will be assigned to the latest deployment when running now alias (with no arguments).

"alias": "zeit.chat"

"alias": [
"zeit.chat"
]

`env` (object)

A list of environment variables to be set on each new deployment instance.

"env": {
"NODE_ENV": "production"
}

`files` (array)

A list of files and directories to be force-uploaded to the deployment (even if they're ignored by .gitignore).

"files": [
"hello.png",
"dist"
]

`type` (string)

A field for specifying the deployment type ("npm" or "docker") if both package.json and Dockerfile exist. This will prevent now from asking you to choose the type in these cases.

"type": "npm"

`forwardNpm` (boolean)

Automatically forward the npm login information to our servers to install private npm packages.

"forwardNpm": true

`engines` (object)

Allows you to define the version of Node.js you want to run on the server. Choose from this list:

  • 4.7.2
  • 5.11.1
  • 5.12.0
  • 6.9.4
  • 7.0.0 (default)
  • 7.4.0
"engines": {
"node": "7.4.0"
}

How to Get It

Assuming you've installed Now's command line interface using Now Desktop (the app also needs to be running), you should have received the update already.

If that's not the case, we highly recommend you to download it and use it to install the CLI. Afterwards, you're covered!