vscode-deploy-reloaded
vscode-deploy-reloaded copied to clipboard
Best way to deploy different folders to different targets
/folder-a/
/subfolder-a/
/folder-b/
/subfolder-b/
Is there a way to deploy folder a and subfolders to target a and folder b and subfolders to target b without being asked to which target i want to deploy?
When you make a package, you choose an array of files to include in that package. You can simply make two packages, one for folder A and one for folder B, with different targets. I’m assuming here you want to deploy on save (or change) – I presume it should work if you want to deploy manually as well (though I rarely use that feature, so I’m not a hundred per cent sure there):
"deploy.reloaded": {
"packages": [
{
"name": "Deploy folder A",
"files": [
"folder-a/**/*.*"
],
"deployOnSave": [ "Folder A Target" ]
},
{
"name": "Deploy folder B",
"files": [
"folder-b/**/*.*"
],
"deployOnSave": [ "Folder B Target" ]
}
],
"targets": [
{
"type": "ftp", // or whatever type you want to use
"name": "Folder A Target",
"dir": "/target-a/"
// add rest of target settings here
},
{
"type": "ftp", // or whatever type you want to use
"name": "Folder B Target",
"dir": "/target-b/"
// add rest of target settings here
}
],
}
Doesn't work for me. I tried it for deploying manually. If i deploy a file or folder (via shortcut, button or context menu) it always asks me to which target i want to deploy. I tried that config:
"packages": [
{
"name": "customer1",
"deployOnSave": false,
"files": [
"/customer1folder/**/*"
],
"targets": ["target1"]
},
{
"name": "customer2",
"deployOnSave": false,
"files": [
"/customer2folder/**/*"
],
"targets": ["target2"]
}
],
"targets": [
{
"name": "target1",
"type": "sftp",
"host": "***",
"port": 22,
"user": "***",
"password": "***",
"dir": "/htdocs",
"mappings": {
"/customer1folder/**/*": "/htdocs"
}
},
{
"name": "target2",
"type": "sftp",
"host": "***",
"port": 22,
"user": "***",
"password": "***",
"dir": "/htdocs",
"mappings": {
"/customer2folder/**/*": "/htdocs"
}
}
],
Doesn't work for me. I tried it for deploying manually. If i deploy a file or folder (via shortcut, button or context menu) it always asks me to which target i want to deploy.
I’ve been deploying more files manually recently than I used to, and this is what I find as well. It seems when you manually deploy, it will always ask where to deploy to; the targets you set up in your settings.json are only used when the deploy action is invoked by an event listener.
I don’t see anything on the wiki that looks like it might apply to manual invocation, so it looks like this may not be possible currently.