npm

Share private packages across your team with npm Orgs, now with simplified billing via the aws marketplace!Learn more »

now-client

5.1.3 • Public • Published

now client

Build Status Join the community on Spectrum

The official Node.js client for deploying to Now. It supports v1 and v2 deployments.

Usage

Firstly, install the package:

npm install now-client
# or 
yarn add now-client

Next, load it:

// v2
const { createDeployment } = require('now-client');
// v1
const { createLegacyDeployment } = require('now-client');

Then call inside a for...of loop to follow the progress with the following arguments:

  • <path> - a directory path / file path / array of file paths (must be on the same level)
  • <options> - An object containing token, an optional teamId and any now.json-valid fields
async function deploy() {
  let deployment;
 
  for await (const event of createDeployment(
    '/Users/zeit-user/projects/front',
    { token: process.env.TOKEN }
  )) {
    if (event.type === 'ready') {
      deployment = event.payload;
      break;
    }
  }
 
  return deployment;
}

Full list of events:

[
  // File events (receive relevant data as payload)
  'hashes-calculated',
  'file-uploaded',
  'all-files-uploaded',
  // Deployment events (receive deployment object as payload)
  'created',
  'ready',
  'error',
  // Build events (receive build object as payload)
  'build-state-changed'
];

You can also get the events set programmatically:

import { EVENTS } from 'now-client';

Keywords

none

install

npm i now-client

Downloadsweekly downloads

771

version

5.1.3

license

MIT

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability