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

[help-needed] Unnecessary nested folder created #104

Open viT-1 opened 5 years ago

viT-1 commented 5 years ago

Hello!

Description

I have some problem with incorrect deploying files from local computer to remote unix server. The problem is relevant for any files: both located in the project folder, and in subfolders.

Actual behavior

On a remote server, the file is located in the directory /opt/project-name

Expected behavior

On a remote server, the file is located in the directory /opt/project-name/project-name

Steps to reproduce

one variant) Locally edit the file located in the project root, then save the file another variant) From context menu in the explorer area I clicked on same file and choose "Deploy selected file"

Example config

{
    "deploy.reloaded": {
        "packages":[
            {
                "name": "project-name__pack",
                "exclude": [
                    ".git/**",
                    ".vscode/**",
                    ".idea/**",
                ],
                "noNodeModules": true,
                "deployOnSave": true,
                "targets": [
                    "project-name__target"
                ],
            }
        ],
        "targets":[{
            "name": "project-name__target",
            "type": "sftp",
            "dir": "/opt/project-name",
            "mappings": {
                "c:/Users/userName/projects/project-name/**/*": "/",
            },
            "host": "host-name",
            "port": 22,
            "user": "uSer",
            "password": "pAss",
        }]
    }
}

Your environment

viT-1 commented 5 years ago

I resolved this issue by changing parameter "dir" to "/opt", but I don't think this is obvious and correct behaviour, because I have many projects/targets and it turns out that they all will have the same dir "/opt".

viT-1 commented 5 years ago

Another bug about mappings: When i saved any file not matching "mappings" it still deployed to "dir" folder with relative path from my local "projects" folder O_o

mkloubert commented 5 years ago

@viT-1

You should change your configuration to this:

{
    "deploy.reloaded": {
        // ...        

        "targets":[{
            "name": "project-name__target",
            "type": "sftp",
            "dir": "/opt/project-name",
            "mappings": {
                "/**/*": "/",
            },
            "host": "host-name",
            "port": 22,
            "user": "uSer",
            "password": "pAss",
        }]
    }
}

The glob pattern in the mappings on the left side behaves like a .gitignore or .npmignore file. Full paths do not work.

viT-1 commented 5 years ago

Full paths do not work.

How to map local folder with "dir" in this case?