mkloubert / vs-deploy

Visual Studio Code extension that provides commands to deploy files of a workspace to a destination.
https://marketplace.visualstudio.com/items?itemName=mkloubert.vs-deploy
MIT License
131 stars 24 forks source link

deployOnChange deploys files twice on change #149

Closed unapieer closed 6 years ago

unapieer commented 6 years ago

When a change is detected, the files changed gets deployed TWICE to the server. Is this normal or do I need to setup my settings.json differently.

{
    "deploy": {
        "packages": [
            {
                "name": "Test",
                "deployOnChange": {
                    "files": [
                        "**/_style/_css/*"
                    ],
                    "useTargetList": true,
                },
                "files": [
                    "**/*.html"
                ],
                "targets": [ "REMOTE" ],
            },
        ],

        "targets": [
            {
                "type": "ftp",
                "name": "REMOTE",
                "description": "REMOTE SERVER",
                "dir": "/dir/to/files",
                "host": "HOST", "port": 21,
                "user": "user", "password": "password"
            }
        ],
    }
}

OUTPUT PRINTOUT

Deploying file '/_style/_css/style.css.map' to '/_style/_css' ('REMOTE')... 
Deploying file '/_style/_css/style.css' to '/_style/_css' ('REMOTE')... 
Deploying file '/_style/_css/style.css.map' to '/_style/_css' ('REMOTE')... 
Deploying file '/_style/_css/style.css' to '/_style/_css' ('REMOTE')... 
[OK]
Finished
[OK]
Finished
[OK]
Finished
[OK]
Finished
unapieer commented 6 years ago

Figure out why, it is on my end. My sass complier is saving it twice when it AutoPrefix the CSS.

On a related note.. Trying to get "timeToWaitBeforeActivateDeployOnChange" to work so it waits 2 second before deploying to let the complier to finish. It always fire right away.

{
    "deploy": {
        "packages": [
            {
                "name": "Test",
                "deployOnChange": {
                    "files": [
                        "**/_style/_css/*"
                    ],
                    "useTargetList": true,
                },
                "files": [
                    "**/*.html"
                ],
                "timeToWaitBeforeActivateDeployOnChange": 2000,
                "targets": [ "REMOTE" ],
            },
        ],

        "targets": [
            {
                "type": "ftp",
                "name": "REMOTE",
                "description": "REMOTE SERVER",
                "dir": "/dir/to/files",
                "host": "HOST", "port": 21,
                "user": "user", "password": "password"
            }
        ],
    }
}
mkloubert commented 6 years ago

@unapieer

timeToWaitBeforeActivateDeployOnChange means that only at the beginning, after config has been (re-)loaded, the "deploy on change" feature will be deactivated for a specific time (in your case for 2000 ms).

This is not for each change event.

mkloubert commented 6 years ago

@unapieer

btw.: I have implemented such a feature, what you had expected, in the new extension vscode-deploy-reloaded.

There you can define a setting, called pauseFilesFor, inside a package, which defines the time to wait before an auto deploy operation can be done for a file again:

In your case, that can look like that:

{
    "deploy.reloaded": {
        "packages": [
            {
                "name": "CSS files",

                "files": [
                    "**/_style/_css/*"
                ],

                "deployOnChange": [ "REMOTE" ],

                "pauseFilesFor": 2000
            }
        ],

        "targets": [
            {
                "type": "ftp",
                "name": "REMOTE",
                "description": "REMOTE SERVER",
                "dir": "/dir/to/files",
                "host": "HOST", "port": 21,
                "user": "user", "password": "password"
            }
        ]
    }
}

Have a look at the new wiki to check how to move migrate your ftp settings to the new extension.