mkloubert / vscode-deploy-reloaded

Recoded version of Visual Studio Code extension 'vs-deploy', which provides commands to deploy files to one or more destinations.
https://marketplace.visualstudio.com/items?itemName=mkloubert.vscode-deploy-reloaded
GNU Lesser General Public License v3.0
163 stars 39 forks source link

Subdirectories not deployed #40

Open AlbertoBonfiglio opened 6 years ago

AlbertoBonfiglio commented 6 years ago

Hello, for some reason deploying to ftp does not include subdirectories. I have included my script. It should deploy all files except the subdirectory data in dist/assets. There are other subdirectories (images, brand, etc) in dist/assets as well. When I run the deploy package it deploys everything including the files in dist/ assets but it won't create any of the subdirectories od dist/assets.

Is it a bug or it's me not quite getting the globbing syntax?

`{ "deploy.reloaded": {

    "showPopupOnSuccess": true,
    "packages": [
        {
            "name": "Version 0.0.0",
            "description": "WebApp Package version 0.0.0",
            "files": [
                "dist/**"
            ],
            "exclude": [
                "dist/assets/data/**"
            ],               
            "deployOnSave": false,

            "button": {
                "text": "Deploy to 'test WebApp Dev'",
                "tooltip": "Click here to deploy to the target...",
                "targets": [ "test WebApp Dev" ],
                "showPrompt": true,
                "enabled":false
            }
        },
    ],

    "targets": [
        {
            "type": "prompt",
            "name": "FTP Server",
            "prompts": [
                {
                    "placeHolder": "Please enter the password",
                    "isPassword": true,
                    "properties": [ "password" ]                    
                }
            ],
            "targets": ["test WebApp Dev" ]
        },

        {
            "type": "ftp",
            "name": "test WebApp Dev",
            "description": "test WebApp Dev",

            "dir": "/development",
            "host": "ftp.dev.xxxxxxx.com", "port": 21,
            "user": "user",
            "password": "", 
            "debug": true,
            "mappings": {
                "/dist/**/*": "/"
            }

        }
    ]
}

}`

mkloubert commented 6 years ago

@AlbertoBonfiglio

Unfortunately, I could not reproduce the issue in my test scenario.

I created the following directory structure:

image

When I deploy the package to FTP Server target, I get the following response:

Start deploying files to 'FTP Server' ...

Deploying file 'd:\Eigene Dateien\Desktop\vscode-deploy-reloaded\dist\brand\small.mp4' to '[test WebApp Dev] /brand (FTP Server)' ... [OK]
Deploying file 'd:\Eigene Dateien\Desktop\vscode-deploy-reloaded\dist\css\test.css' to '[test WebApp Dev] /css (FTP Server)' ... [OK]
Deploying file 'd:\Eigene Dateien\Desktop\vscode-deploy-reloaded\dist\images\test.png' to '[test WebApp Dev] /images (FTP Server)' ... [OK]
Deploying file 'd:\Eigene Dateien\Desktop\vscode-deploy-reloaded\dist\index.php' to '[test WebApp Dev] / (FTP Server)' ... [OK]
Deploying files to 'FTP Server' has been finished.

Can you try the following settings for the Version 0.0.0 package (replace ** with **/*)?

    "packages": [
        {
            "name": "Version 0.0.0",
            "description": "WebApp Package version 0.0.0",
            "files": [

                "dist/**/*"

            ],
            "exclude": [

                "dist/assets/data/**/*"

            ],               

            // ...
        },
    ]

I am running on Windows 10.

Btw.: If you would like to use the package button, you should target to FTP server prompt instead of test WebApp Dev:

            "button": {
                "text": "Deploy to 'FTP server'",
                "tooltip": "Click here to deploy to the target...",

                "targets": [ "FTP server" ],

                "showPrompt": true,
                "enabled": true
            }
AlbertoBonfiglio commented 6 years ago

Thanks for the heads up on the button. For the directories try having multiple subdirs in the assets folder (e.g. assets/data, assets/scripts, assets/logos etc.). Ideally it should copy them all except assets/data. What I found is that there must be an error in the logic when it creates the sus sub folders because if I run the script twice it works as expected.

mkloubert commented 6 years ago

@AlbertoBonfiglio

Is that right, that it might happen, that, at the beginning, especially the sub folders are empty, because the files are generated while the deployment?

AlbertoBonfiglio commented 6 years ago

@mkloubert Not sure what you're asking. The files are generated when i run the build. Once that task is complete I run the deployment script. The target directory is supposed to be empty.

mkloubert commented 6 years ago

@AlbertoBonfiglio

OK, the deployment always starts after the build process, what means you have all your files inside the dist folder. Or can it happen, that deployment starts, when build process has not been finished yet?

AlbertoBonfiglio commented 6 years ago

@mkloubert deployment always start after the build.

davidmcl commented 6 years ago

I too am encountering this issue - but in a very simple scenario; there is no build process - it's just a straight SFTP package deploy from a LinuxMint 18.3 (Ubuntu 16.04) desktop VSCode 1.23.1 to a CentOS 7 server.

The scenario is this... If the sub-directory is empty, it doesn't get created on the deploy - if it has a file with content, it does get created. Simple as that. Also, if a sub-folder is deleted, the content is removed, but the sub-folder remains on the target system.

FYI, an interesting additional scenario found when testing is that if an empty file is created, it also is not deployed when it is created - although if one or more characters are entered or a deploy is requested - it will deploy the file, even empty. I suspect this may be VS Code related if you are using its events to drive your actions as the vscode explorer icon doesn't indicate a "changed" file either until some content is entered in the new created file.

Thanks, David

csears123 commented 6 years ago

I am seeing the same behavior as @davidmcl where I simply have empty folders that are not getting created when deploy executes. Files will eventually be generated into these folders as the application runs on the server, but the initial deploy does not create the empty folders and the application will fail unless I manually create them.