Home

Published

- 2 min read

NPM: Use Github Patch Instead of Repository

img of NPM: Use Github Patch Instead of Repository

Recently I was playing around with the HEXO static site generator. For my setup, I was using Hexo in combination with Gitlab CI and the ftp deploy method.

The module hexo-deployer-ftpsync has an issue that you need to manually confirm that the FTP deployment succeeded. In essence, it does not exist on its own, thus a CI environment would not be able to automatically verify the success or failure of the build, it would just run forever.

Github allows you to fork existing code, improve upon it and issue a pull request, that your code will be integrated into the main software build. I changed a couple of lines to ensure that the FTP deploy process would terminate.

To use my patch instead of the current master build of the module you need to adjust the package.json file. Simply replace the version-number with the github url <username/project>#

Original: With Version Number

\\(...)
  "dependencies": {
    "hexo": "^3.2.0",
    "hexo-deployer-ftpsync": "^0.1.1",
\\(...)
  }
}

New: With github path to patch

\\(...)
  "dependencies": {
    "hexo": "^3.2.0",
    "hexo-deployer-ftpsync": "borgfriend/hexo-deployer-ftpsync#80b51f3",
\\(...)
  }
}

If the owner of the project integrates my suggestion on how to fix the bug, then the line can be changed back to the official master branch of the code. However, for the time being, gitlab CI uses the alternative code and successfully deploys my code to the server.

images: [”../../../assets/images/Designed by Freepik”]