hexo-deployer-git
hexo-deployer-git copied to clipboard
`extend_dirs` cann't process relative path
Hello,
I'm trying to use extend_dirs to publish a couple directories that live outside my hexo website (which is contained in a subdirectory of my main repo).
When I run hexo deploy, the directories I've identified are copied into the root of my website directory, but never get deployed. I think this is because only the public folder is being added to the .deploy_git directory. What is needed to actually deploy the contents of the extend_dirs?
I've included my file structure and deployment configuration below.
Thanks!
EDIT: I tested this by creating a directory inside my website folder and referenced that in extend_dirs, and it deploys as expected. It seems this issue only occurs when the directories exist outside the website folder.
File structure:
├─ repo
├─ docs
├─ src
├─ website
├─ public
├─ scaffolds
├─ source
├─ themes
├─ _config.yml
_config.yml:
deploy:
type: git
repo: <repository url>
branch: gh-pages
message:
extend_dirs:
- ../docs
- ../src
Taking a look at the source, I think this issue stems from the following line:
https://github.com/hexojs/hexo-deployer-git/blob/master/lib/deployer.js#L130
When pathFn.join encounters a ../ in dir, it outputs:
extendDist === website/src
instead of
extendDist === website/.deploy_git/src
Workaround:
Set up two deploy configurations, where the first one references the true location of your external directories, and the second refers to those directories within the hexo folder (since the first deploy will have copied them there for you).
Note: I point the first deploy to a dummy branch called temp, but I think this could just be the same as your real deployment branch since this deployment workflow will always execute the real one last.
deploy:
- type: git
repo: <repo>
branch: temp
extend_dirs:
- ../src
- ../docs
- type: git
repo: <repo>
branch: gh-pages
extend_dirs:
- src
- docs
Thanks for submitting the issue and its details. I think this may be a bug.
I'have same problem, the bug it was fixed?
https://github.com/hexojs/hexo-deployer-git/blob/880a3c3332d82743521f86737b7d815b128e622b/lib/deployer.js#L122