CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-netlify-cli

Netlify command line tool for deploying and managing modern web applications on the Netlify platform

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

deployment.mddocs/

Deployment

Build and deployment functionality for deploying projects to Netlify with support for various contexts, build configurations, and deployment options.

Capabilities

Deploy Command

Deploys your project to Netlify with comprehensive options for different deployment scenarios.

/**
 * Deploy project to Netlify
 * Command: netlify deploy [options]
 */
interface DeployOptions {
  /** Folder to deploy (publish directory) */
  dir?: string;
  /** Functions folder to deploy */
  functions?: string;
  /** Deploy to production */
  prod?: boolean;
  /** Deploy to production if unlocked, draft otherwise */
  prodIfUnlocked?: boolean;
  /** Alias for deployment (max 37 characters) */
  alias?: string;
  /** Deprecated, renamed to --alias */
  branch?: string;
  /** Open project after deploy */
  open?: boolean;
  /** Deploy log message */
  message?: string;
  /** Project name or ID */
  site?: string;
  /** Output deployment information as JSON */
  json?: boolean;
  /** Deployment timeout in seconds */
  timeout?: number;
  /** Trigger build without uploading files */
  trigger?: boolean;
  /** Run build command (default behavior) */
  build?: boolean;
  /** Skip build command */
  noBuild?: boolean;
  /** Deploy context for build environment */
  context?: string;
  /** Force rebundle functions, skip functions cache */
  skipFunctionsCache?: boolean;
  /** Create new site and deploy (optionally with name) */
  createSite?: string | boolean;
  /** Team slug for site creation */
  team?: string;
  /** Upload source zip for edge functions */
  uploadSourceZip?: boolean;
}

Usage Examples:

# Deploy to draft
netlify deploy

# Deploy to production
netlify deploy --prod

# Deploy with custom directory
netlify deploy --dir dist --prod

# Deploy with custom functions directory
netlify deploy --dir build --functions lambda --prod

# Deploy with alias for A/B testing
netlify deploy --alias feature-x

# Deploy with message
netlify deploy --prod --message "Release v2.1.0"

# Deploy and open in browser
netlify deploy --prod --open

# Deploy without running build
netlify deploy --no-build --prod

# Create new site during deployment
netlify deploy --create-site "My New Project"

# Deploy to specific team
netlify deploy --create-site --team my-team-slug

# Deploy with timeout
netlify deploy --prod --timeout 600

# Trigger build without file upload
netlify deploy --trigger --prod

# Get deployment info as JSON
netlify deploy --json

Build and Deploy Integration

The deploy command can integrate with Netlify Build for processing:

/**
 * Build integration options during deployment
 */
interface BuildIntegration {
  /** Run Netlify Build during deployment */
  runBuild: boolean;
  /** Build context (affects environment variables and plugins) */
  context: 'production' | 'deploy-preview' | 'branch-deploy' | string;
  /** Skip functions caching for fresh builds */
  skipFunctionsCache: boolean;
  /** Build command override */
  buildCommand?: string;
  /** Publish directory override */
  publishDir?: string;
  /** Functions directory override */
  functionsDir?: string;
}

Deployment Contexts

Different deployment contexts provide different environments and behaviors:

/**
 * Deployment context configuration
 */
interface DeploymentContext {
  /** Context name */
  context: 'production' | 'deploy-preview' | 'branch-deploy' | 'dev' | `branch:${string}`;
  /** Whether this is a production deployment */
  isProduction: boolean;
  /** Branch being deployed */
  branch: string;
  /** Commit SHA being deployed */
  commitSha: string;
  /** Environment variables for this context */
  environmentVariables: Record<string, string>;
  /** Whether this deployment is locked for editing */
  isLocked: boolean;
}

/**
 * Production deployment context
 */
interface ProductionContext extends DeploymentContext {
  context: 'production';
  isProduction: true;
  /** Production URL */
  url: string;
  /** SSL certificate status */
  sslEnabled: boolean;
}

/**
 * Deploy preview context (for pull requests)
 */
interface DeployPreviewContext extends DeploymentContext {
  context: 'deploy-preview';
  /** Pull request number */
  pullRequestNumber: number;
  /** Preview URL */
  previewUrl: string;
  /** Base branch for comparison */
  baseBranch: string;
}

/**
 * Branch deploy context
 */
interface BranchDeployContext extends DeploymentContext {
  context: 'branch-deploy';
  /** Branch-specific URL */
  branchUrl: string;
  /** Whether branch deploys are enabled */
  branchDeploysEnabled: boolean;
}

Deployment Aliases

Create named deployments for A/B testing and feature previews:

/**
 * Deployment alias configuration
 */
interface DeploymentAlias {
  /** Alias name (max 37 characters) */
  name: string;
  /** Generated alias URL */
  url: string;
  /** Deployment ID */
  deployId: string;
  /** Creation timestamp */
  createdAt: Date;
  /** Expiration timestamp (if temporary) */
  expiresAt?: Date;
}

Usage Examples:

# Create feature branch alias
netlify deploy --alias feature-user-auth

# Create version alias
netlify deploy --alias v2-1-0

# Create testing alias
netlify deploy --alias staging-test

# URLs generated:
# https://feature-user-auth--site-name.netlify.app
# https://v2-1-0--site-name.netlify.app
# https://staging-test--site-name.netlify.app

Site Creation During Deployment

Create new Netlify sites on-the-fly during deployment:

/**
 * Site creation options during deployment
 */
interface CreateSiteOptions {
  /** Site name (max 63 characters, will be part of URL) */
  name?: string;
  /** Team slug for site ownership */
  team?: string;
  /** Custom domain to configure */
  customDomain?: string;
  /** Repository information for CI setup */
  repo?: {
    provider: 'github' | 'gitlab' | 'bitbucket';
    owner: string;
    name: string;
    branch: string;
  };
}

Deployment Status and Monitoring

Track deployment progress and status:

/**
 * Deployment status information
 */
interface DeploymentStatus {
  /** Deployment ID */
  id: string;
  /** Current state */
  state: 'new' | 'building' | 'uploading' | 'processing' | 'ready' | 'error';
  /** Deployment URL */
  url: string;
  /** Admin URL for managing deployment */
  adminUrl: string;
  /** Deployment message */
  title: string;
  /** Error message if deployment failed */
  errorMessage?: string;
  /** Build log URL */
  buildLogUrl?: string;
  /** Functions deployment info */
  functions?: Array<{
    name: string;
    sha: string;
    runtime: string;
  }>;
  /** Upload summary */
  summary: {
    status: string;
    messages: string[];
    uploadedFiles: number;
    totalFiles: number;
  };
}

File Upload and Processing

Handle file uploads and processing during deployment:

/**
 * File upload configuration and status
 */
interface FileUpload {
  /** Files to upload */
  files: Array<{
    path: string;
    sha: string;
    size: number;
  }>;
  /** Upload configuration */
  config: {
    /** Maximum file size in bytes */
    maxFileSize: number;
    /** Concurrent upload limit */
    concurrency: number;
    /** Retry configuration */
    retry: {
      maxAttempts: number;
      backoffMultiplier: number;
    };
  };
  /** Upload progress */
  progress: {
    uploaded: number;
    total: number;
    percentage: number;
    currentFile?: string;
  };
}

Deployment Output Formats

Configure deployment output for different use cases:

/**
 * Deployment output configuration
 */
interface DeploymentOutput {
  /** Output format */
  format: 'human' | 'json';
  /** Include deployment logs */
  includeLogs: boolean;
  /** Include file upload details */
  includeFiles: boolean;
  /** Include function deployment info */
  includeFunctions: boolean;
}

/**
 * JSON deployment output structure
 */
interface JsonDeploymentOutput {
  deployId: string;
  deployUrl: string;
  adminUrl: string;
  logsUrl: string;
  functionsUrl: string;
  state: string;
  name: string;
  url: string;
  branch: string;
  commitSha: string;
  commitUrl: string;
  screenshot?: string;
  uploadedFiles?: number;
  functionsCount?: number;
}

Advanced Deployment Options

Advanced configurations for complex deployment scenarios:

/**
 * Advanced deployment configuration
 */
interface AdvancedDeployOptions {
  /** Skip DNS verification for custom domains */
  skipDnsVerification?: boolean;
  /** Force deployment even if no changes detected */
  force?: boolean;
  /** Enable deployment notifications */
  notifications?: {
    email?: boolean;
    slack?: boolean;
    webhook?: string;
  };
  /** Post-deployment hooks */
  postDeploy?: {
    /** Commands to run after successful deployment */
    commands: string[];
    /** Environment for post-deploy commands */
    environment: Record<string, string>;
  };
  /** Rollback configuration */
  rollback?: {
    /** Enable automatic rollback on failure */
    autoRollback: boolean;
    /** Previous deployment ID to rollback to */
    targetDeployment?: string;
  };
}

docs

authentication-teams.md

blobs-storage.md

build-system.md

deployment.md

environment-variables.md

functions.md

index.md

local-development.md

site-management.md

tile.json