Socket
Socket
Sign inDemoInstall

now-client

Package Overview
Dependencies
49
Maintainers
56
Versions
148
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    now-client

[![Join the community on GitHub Discussions](https://badgen.net/badge/join%20the%20discussion/on%20github/black?icon=github)](https://github.com/vercel/vercel/discussions)


Version published
Weekly downloads
639
decreased by-35.52%
Maintainers
56
Install size
2.91 MB
Created
Weekly downloads
 

Readme

Source

@vercel/client

Join the community on GitHub Discussions

The official Node.js client for deploying to Vercel.

Usage

Firstly, install the package:

npm install @vercel/client
# or
yarn add @vercel/client

Next, load it:

// v2
const { createDeployment } = require('@vercel/client');
// v1
const { createLegacyDeployment } = require('@vercel/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 vercel.json-valid fields
async function deploy() {
  let deployment;

  for await (const event of createDeployment({
    token: process.env.TOKEN,
    path: '/Users/vercel-user/projects/front',
  })) {
    if (event.type === 'ready') {
      deployment = event.payload;
      break;
    }
  }

  return deployment;
}

Full list of events:

[
  // File events
  'hashes-calculated',
  'file-count',
  'file-uploaded',
  'all-files-uploaded',
  // Deployment events
  'created',
  'building',
  'ready',
  'alias-assigned',
  'warning',
  'error',
];

You can also get the events set programmatically:

import { EVENTS } from '@vercel/client';

FAQs

Last updated on 12 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc