vs-deploy icon indicating copy to clipboard operation
vs-deploy copied to clipboard

Setup deployOnSave and deployOnChange by target

Open fabruex opened this issue 8 years ago • 4 comments

I have two different targets but I would like to have only the first one enabled for deployOnSave and deployOnChange, and manually deploy the second one. Is it possible?

fabruex avatar Oct 30 '17 09:10 fabruex

@fabruex

Yes, you can define both features for one or more specific targets:

{
    "deploy": {
        "packages": [
            {
                "name": "My project",
                
                "deployOnChange": {
                    "files": [
                        "/**/*.css"
                    ],

                    "useTargetList": true
                },

                "files": [
                    "wwwroot/**/*.html"
                ],
                
                "deployOnSave": true,
                "useTargetListForDeployOnSave": true,

                "targets": [ "My 1st test target" ]
            }
        ],

        "targets": [        
            {
                "name": "My 1st test target",
                "type": "test"
            },
            {
                "name": "My 2nd test target",
                "type": "test"
            }
        ]
    }
}

All /**/*.css files will be deployed when you change them. 'Changing' means: You or something else (like a background service / app) does a change in what way ever.

On the other hand all wwwroot/**/*.html will be deployed when you save them explicitly in the editor, by pressing CTRL + S, e.g.

Both will use the My 1st test target target, as defined in the array of the targets property inside the my project package.

mkloubert avatar Oct 30 '17 13:10 mkloubert

Thanks a lot! This is what I was looking for. Just a question: why I can choose between targets only if I run "deploy current file / folder" and not for "deploy workspace"?

fabruex avatar Oct 30 '17 14:10 fabruex

When using two different configurations (one deploy to dev, the other deploy to production - yeah, I know), if the dev config is set to deployOnSave: true, it doesn't matter if production is set to deployOnSave: false, saving a file will cause both to be deployed =(

        "packages": [{
                "name": "dev",
                "deployOnSave": true,
                "button": {
                    "text": "Deploy dev",
                    "targets": ["dev"]
                }
            },
            {
                "name": "prod",
                "deployOnSave": false,
                "button": {
                    "text": "Deploy prod",
                    "targets": ["prod"]
                }
            }
        ]

is this a bug or have I done something wrong?

joaociocca avatar Jan 24 '18 16:01 joaociocca

I set "deployOnSave" equal to "dev" instead of true.

{
    "deploy": {
        "packages": [{
            "name": "Web Files",
            "description": "Web Files",
            "files": [
                "**/*.html",
                "**/*.js",
                "**/*.css"
            ],
            "exclude": [
                ".vscode/**",
                ".git/**"
            ],
            "deployOnSave": "dev"
        }],
        "targets": [{
                "type": "local",
                "name": "dev",
                "description": "Mapped drive",
                "dir": "////devserver//pathtosite"
            },
            {
                "type": "local",
                "name": "prod",
                "description": "Mapped drive",
                "dir": "////productionserver//pathtosite"
            }
        ]
    }
}

I'm still trying to figure out how to create two buttons for dev and prod.

chriscrowley avatar Dec 04 '19 00:12 chriscrowley