Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

beforeDeploy not executed , if no files founds #6

Closed
FrColin opened this issue Jan 3, 2018 · 5 comments
Closed

beforeDeploy not executed , if no files founds #6

FrColin opened this issue Jan 3, 2018 · 5 comments

Comments

@FrColin
Copy link

FrColin commented Jan 3, 2018

Description

I go a sftp target , and packages listing files under a dist repositiry
the dist directory is produced by beforeDeploy task.

Actual behavior

deploy does nothing , since no files found because the dist directory did'nt exist yiet.

Expected behavior

the deploy should run the beforeDeploy , event if no files found

Steps to reproduce

remove the dist repository

Example config

{
    "deploy.reloaded": {
           "packages": [
            {
                "name": "TEST",
                "description": "TEST",
                "files": [
                    "dist/**/*.php",
                    "dist/*.js",
                    "dist/*.css",
                    "dist/*.woff",
                    "dist/*.ttf",
                    "dist/*.svg",
                    "dist/*.woff2",
                    "dist/*.eot",
                    "dist/index.html",
                    "dist/assets/**"
                ],
                "exclude": [
                    "tests/**"
                ],
                "deployOnSave": false,
                "button": {
                    "text": "Deploy",
                    "tooltip": "Click here to deploy to the target...",
                    "targets": [ "TEST" ]
                }

            }
        ],
        "targets": [
            {
                "type": "sftp",
                "name": "TEST",
                "description": "A SFTP folder",
                "dir": "/var/www/test",
                "host": "localhost", "port": 22,
                "user": "root", 
                "beforeDeploy": [
                    {
                        "type": "exec",
                        "command": "npm run prod"
                    }
                ],
    }
}

Your environment

  • Operating system: Windows
  • Visual Studio Code version: 1.19.1
  • Extension version: 0.15.0

Additional comments

may be necessary to add some force atribute to the task .

@mkloubert
Copy link
Owner

@FrColin

Since version 0.19.0 you can use the new prepare setting, which executes target operations before beforeDeploy and even if no file is going to be deploy / handeled.

{
    "deploy.reloaded": {
        "targets": [
            {
                "prepare": [
                    {
                        "type": "exec",
                        "command": "npm run prod"
                    }
                ]
            }
        ]
    }
}

@FrColin
Copy link
Author

FrColin commented Jan 4, 2018

Many thanks, it is working , but I can't see any output of the process ,
is it possible to redirect the output to some window , better near the
Running 'prepare' operation 'exec #1'...

@FrColin
Copy link
Author

FrColin commented Jan 4, 2018

In fact , It doesn't reload the file list after the prepare statement.
my first test was done when some files exist in the dist repository , that let me think that the file was correctly uploaded .
after cleanup of the dist repository and regenerate using the prepare task no files was copied.

@mkloubert
Copy link
Owner

@FrColin

Since version 0.20.0 ...

  • prepare operations should now reload file list by default, when deploying a package e.g.
  • exec should now print the standard output by default ... if the output is too big, you should try to play with new maxBuffer setting

@FrColin
Copy link
Author

FrColin commented Jan 5, 2018

Nice , thanks a lot.

@FrColin FrColin closed this as completed Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants