[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.
/ vs-deploy Public archive

Visual Studio Code extension that provides commands to deploy files of a workspace to a destination.

License

Notifications You must be signed in to change notification settings

mkloubert/vs-deploy

Repository files navigation

vs-deploy

Latest Release Installs Rating

Gitter

Visual Studio Code (VS Code) extension that provides commands to deploy files of a workspace to a destination.

The extension supports the following destination types:

Type Supports download / pull?
Amazon AWS S3 buckets X
Apps / executables / scripts (bash, batch, e.g.)
Azure blob storages X
DropBox X
External Node.js based scripts X
FTP X
HTTP(s)
Local or shared network folders inside a LAN X
Mail (SMTP)
Remote machines like other VS Code instances
REST APIs like vs-rest-api X
SFTP X
Slack
SQL
ZIP files X

There is also build-in support for the following compilers and processors:

... and these languages:

If you would like to add another translation, please read that issue first.

Donate

Table of contents

  1. Demos
  2. Recoded version
  3. Install
  4. How to use

Recoded version []

I have started a new and recoded version of that extension, called vscode-deploy-reloaded, which is still in a preview, but good beta state.

Demos []

Deploying to SFTP []

Demo SFTP

Deploy on change []

Demo Deploy on change

Download / pull from SFTP []

Demo pull from SFTP

Compare files []

Demo compare files

Check for newer files []

Demo check for newer files

Sync when open []

Demo sync when open

Deploy to ZIP file []

Demo ZIP

Deploy to remote Visual Studio Code instance []

Demo Remote

Install []

Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter:

ext install vs-deploy

Or search for things like vs-deploy in your editor:

Screenshot VSCode Extension search

How to use []

Detailed information can be found at the wiki.

Otherwise...

Settings []

Open (or create) your settings.json in your .vscode subfolder of your workspace.

Add a deploy section:

{
    "deploy": {
    }
}

Packages []

A package is a description of files of your workspace that should be deployed.

Add the subsection packages and add one or more entry:

{
    "deploy": {
        "packages": [
            {
                "name": "Version 2.3.4",
                "description": "Package version 2.3.4",
                "files": [
                    "**/*.php",
                    "/*.json"
                ],
                "exclude": [
                    "tests/**"
                ],
                "deployOnSave": true
            }
        ]
    }
}

Look at the wiki to get more information about packages.

Targets []

A target describes where a file or package should be transfered to.

Add the subsection targets and add one or more entry:

{
    "deploy": {
        "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,

                "mappings": [
                    {
                        "source": "dir/of/files/that/should/be/mapped",
                        "target": "dir/on/target"
                    }
                ]
            },
            {
                "type": "ftp",
                "name": "My FTP folder",
                "description": "A FTP folder",
                "dir": "/my_package_files",
                "host": "localhost", "port": 21,
                "user": "anonymous", "password": "",

                "deployed": [
                    {
                        "type": "sql",
                        "engine": "mysql",

                        "queries": [
                            "TRUNCATE TABLE `debug`",
                            "TRUNCATE TABLE `logs`"
                        ]
                    },
                    {
                        "target": "https://github.com/mkloubert"
                    }
                ]
            },
            {
                "type": "local",
                "name": "My local folder",
                "description": "A local folder",
                "dir": "E:/test/my_package_files"
            },
            {
                "type": "local",
                "name": "My network folder",
                "description": "A SMB shared network folder",
                "dir": "\\\\MyServer\\my_package_files"
            },
            {
                "type": "zip",
                "name": "My ZIP file",
                "description": "Create a ZIP file in a target directory",
                "target": "E:/test"
            },
            {
                "type": "mail",
                "name": "My mail server",
                "description": "An email deployer",
                "host": "smtp.example.com", "port": 465,
                "secure": true, "requireTLS": true,
                "user": "mkloubert@example.com", "password": "P@assword123!",
                "from": "mkloubert@example.com",
                "to": "tm@example.com, ys@example.com"
            },
            {
                "type": "script",
                "name": "My script",
                "description": "A deploy script",
                "script": "E:/test/deploy.js",
                "options": {
                    "TM": 5979,
                    "MK": "23979"
                }
            },
            {
                "type": "http",
                "name": "My HTTP service",
                "description": "A HTTP service on a HTTP server, e.g.",
                "url": "https://host.example.com/webdav/?file=${VSDeploy-File}",
                "user": "mkloubert", "password": "P@ssword123!"
            },
            {
                "type": "remote",
                "name": "My remote target",
                "description": "Some remote VS Code instances to deploy to",
                "hosts": ["localhost", "192.168.0.101", "192.168.0.101:5979"]
            },
            {
                "type": "app",
                "name": "My App",
                "description": "An app to call",
                "app": "E:/test/deploy.cmd",
                "arguments": ["a", "b", "c"]
            },
            {
                "type": "batch",
                "name": "My Batch",
                "description": "A batch operation",
                "targets": ["My mail server", "My ZIP file"]
            },
            {
                "type": "azureblob",
                "name": "My Azure blob storage",
                "description": "An container in an Azure blob storage",
                "container": "my-container",
                "account": "my-storage-account",
                "accessKey": "<ACCESS-KEY-FROM-AZURE-PORTAL>"
            },
            {
                "type": "s3bucket",
                "name": "My Amazon Bucket",
                "description": "An Amazon AWS S3 bucket",
                "bucket": "my-bucket"
            },
            {
                "type": "dropbox",
                "name": "My DropBox folder",
                "description": "Deploy to my DropBox folder",

                "token": "<ACCESS-TOKEN>"
            },
            {
                "type": "api",
                "name": "My REST API",
                "description": "Deploys to a vs-rest-api",

                "host": "vscode.example.com",
                "user": "rgrimes", "password": "lori"
            }
        ]
    }
}

Look at the wiki to get more information about targets.

How to execute []

Press F1 to open the list of commands and enter one of the following commands:

Demo How to execute

Name Description Shortcut (CTRL is CMD on Mac)
Deploy: Change switch Changes the options of a switch. This command does not have a default key binding. If you want to setup a shortcut for extension.deploy.changeSwitch, you can update keybindings.json as described here.
Deploy: Compare files Compares a local file with a remote one. CTRL+ALT+P, C
Deploy: Deploy current file / folder Deploys the current opened file. CTRL+ALT+F
Deploy: Deploy workspace Deploys a specific package. CTRL+ALT+W
Deploy: Open example / template Opens a template from one or more offical and/or custom repository. This command does not have a default key binding. If you want to setup a shortcut for extension.deploy.openTemplate, you can update keybindings.json as described here.
Deploy: Pull current file / folder Pulls the current opened file. CTRL+ALT+P, F
Deploy: Pull workspace Pulls a specific package. CTRL+ALT+P, W
Deploy: Select workspace Changes the current workspace, s. Multi-root Workspaces. This command does not have a default key binding. If you want to setup a shortcut for extension.deploy.selectWorkspace, you can update keybindings.json as described here.
Deploy: Start/stop listening for files Start/stop listening for files from a remote machine. CTRL+ALT+L