Deploying with VS Code: A Comprehensive Guide to the vs-deploy Extension

Jan 20, 2022 | Programming

The vs-deploy extension for Visual Studio Code revolutionizes the way developers manage file deployment. With support for various destination types like Amazon S3, Azure blob storage, FTP, and more, it streamlines the process of deploying files from your workspace to multiple environments.

Table of Contents

Demos

Before we dive into usage, let’s explore a couple of demos to understand the power of vs-deploy better:

  • Deploying to SFTP
  • Demo SFTP
  • Deploy on Change
  • Demo Deploy on change
  • Download / Pull from SFTP
  • Demo pull from SFTP

Install

Installing the vs-deploy extension is simple. Launch VS Code Quick Open by pressing Ctrl+P, then paste the following command:

ext install vs-deploy

You can also search for “vs-deploy” in your editor.

How to Use

To get started, you need to configure your settings:

Settings

Open or create a settings.json file in the .vscode subfolder of your workspace. Here’s how you structure it:

{
  "deploy": {
    "packages": [
      {
        "name": "Version 2.3.4",
        "description": "Package version 2.3.4",
        "files": [
          "**/*.php",
          "*.json"
        ],
        "exclude": [
          "tests/**"
        ],
        "deployOnSave": true
      }
    ],
    "targets": [
      {
        "type": "sftp",
        "name": "My SFTP folder",
        "description": "A SFTP folder",
        "dir": "my_package_files",
        "host": "localhost",
        "port": 22,
        "user": "tester",
        "password": "password",
        "checkBeforeDeploy": true
      },
      {
        "type": "ftp",
        ...
      }
    ]
  }
}

This JSON structure allows you to specify different packages and targets where your files will be deployed.

Packages

A package refers to a specific set of files you intend to deploy. Ensure you define the files included and any exclusions.

Targets

Each target represents a specific destination for your files, such as SFTP, FTP, or cloud storage. This allows you to customize where your deployment goes.

How to Execute

To execute deployment commands, press F1 to open the command palette and choose the desired command. Here are some common commands:

  • Deploy: Deploy current file/folder – Deploys the currently opened file.
  • Deploy: Pull workspace – Pulls files from a specific package.

Troubleshooting Common Issues

If you run into issues while using the vs-deploy extension, here are some quick fixes:

  • Connection Errors: Check your host, port, and credentials for accuracy.
  • File Not Found: Ensure the file paths in your settings are accurate.
  • Deployment Fails: Verify if the target supports the specific deployment method.
  • Network Issues: Make sure your firewall settings allow outbound connections to the target destination.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox