Deploy your frontend project quickly and easily.
- Select "Build & Deploy" to build your project and deploy it to a remote server.
- Select "Deploy Only" to deploy your project build dist to the remote server.
Commands in command palette:
Two settings.json samples:
- The FIRST way to use
Select "Build & Deploy" to build project locally and upload dist to the remote server.
{
"easyDeployment.config": {
"configurations": [
{
"name": "dev",
"local": {
"projectPath": ".",
"buildCmd": "yarn build",
"outputDir": "dist"
},
"remote": {
"deploymentPath": "~/nginx/html",
"backupOriginalFiles": true,
"backupTo": "~/backup",
"deleteOriginalFiles": true
},
"ssh": {
"host": "192.168.1.200",
"port": 22,
"username": "pi",
"privateKey": "~/.ssh/id_rsa"
}
}
]
}
}- The SECOND way to use
Select "Deploy Only" to upload the project source code to the remote server and execute a script to build and deploy on the remote server.
{
"easyDeployment.config": {
"configurations": [
{
"name": "dev",
"local": {
"projectPath": ".",
"outputDir": ".",
"exclude": ["**/node_modules/**", "dist/**"]
},
"remote": {
"deploymentPath": "~/web/projects/demo",
"deleteOriginalFiles": true,
"postCmd": "bash ./build_and_deploy.sh"
},
"ssh": {
"host": "192.168.1.200",
"port": 22,
"username": "pi",
"privateKey": "~/.ssh/id_rsa"
}
}
]
}
}Details for each configuration item are as follows:
-
localconfiguration (Configuration of local project):Key Defaults Required Description projectPath. √ Project root path (relative path) buildCmdBuild command for local project outputDirdist √ Compiled product output path. (path relative to the projectPath) exclude[] Files excluded on deployment. (path pattern relative to the outputDir) -
remoteconfiguration (Configuration of remote server):Key Defaults Required Description deploymentPath√ Remote deployment path. (must be an absolute path) backupOriginalFilesfalse Do you need to back up the original files? backupTo~/backup Backup path of the original files. (must be an absolute path) deleteOriginalFilesfalse Do you need to delete the original files? postCmdCommand executed after deployment -
sshconfiguration (SSH configuration for connecting to remote server):Key Defaults Required Description host√ Hostname or IP address of the server port22 √ Port number of the server username√ Username for authentication passwordPassword for password-based user authentication privateKeyPrivate key (absolute path) for either key-based or hostbased user authentication (OpenSSH format) passphraseFor an encrypted private key, this is the passphrase used to decrypt it.
Note:
- Please set it according to your actual needs.
- You can choose between
passwordandprivateKeyin the ssh configuration. - If you use
privateKey, remember to put the local ssh public key into the server'sauthorized_keysfile. - If you use
privateKeyand theprivateKeyis encrypted, fill in thepassphrasefield. - The remote server needs to be a Linux machine.
- There can be multiple configurations in the outer configurations, and the
nameattribute cannot be repeated.
- Install Easy Deployment.
- Configure
easyDeployment.configinsettings.jsonin the workspace. - Right click in Explorer and select
Build & DeployorDeploy Only.
https://github.com/liying2008/easy-deployment
Binary package can be obtained from this link.
MIT © Li Ying

