Closed meruiden closed 2 months ago
The problem seems to be that lefthook has both the raw executable unzipped, and as .gz zip. and Rokit seems to think the raw unzipped asset is the best option, but then it can't extract it because its not compressed. So either, Rokit should prioritize/sort on compressed file formats, zip, gz, tar gz, or it should support downloading executables from assets that aren't compressed. + it seems rokit doesn't support .gz, only tgz and tar.gz.
Some background: It would be awesome to support lefthook in the Roblox development workflow because it allows for easy pre-commit hooks for tools like selene and stylua without needing NPM for husky or pyhton for pre-commit[dot]com. Lefthook is a CLI tool without dependencies making it a great fit for the aftman/rokit style workflow for Rojo projects.
This is a great Lefthook config for a more professional workflow in Rojo:
lefthook.yml
pre-commit:
commands:
selene:
glob: "*.{lua}"
run: selene {staged_files}
stylua:
glob: "*.{lua}"
run: stylua {staged_files}
stage_fixed: true
Looks like this mostly falls under https://github.com/rojo-rbx/rokit/issues/4 , however, looking at that release, it definitely seems like it should be grabbing one of the compatible (compressed) artifacts, and not trying to use one that Rokit doesn't know how to handle. Seems like a bug to me.
I cloned it, and from debugging, I can tell it tries to download https://api.github.com/repos/evilmartians/lefthook/releases/assets/186574661, which goes well, but then with extracting, it goes wrong. seems like it doesn't handle .gz files properly yet. Any chance you can have a look?
It fails here: https://github.com/rojo-rbx/rokit/blob/9b8097c5c064f9b9218f058ee3ffe09737ffb677/lib/sources/artifact/mod.rs#L77
I cloned it, and from debugging, I can tell it tries to download https://api.github.com/repos/evilmartians/lefthook/releases/assets/186574661, which goes well, but then with extracting, it goes wrong. seems like it doesn't handle .gz files properly yet. Any chance you can have a look?
It fails here:
Ah, I missed that those .gz
assets are actually bare executables (meaning, not inside of any container like zip
, tar
) but still compressed. This is a bit strange but something I want to support with Rokit either way. There is some ongoing work to support this in #66 .
yeah its a bit in between. a .gz file, is a zip/tar.gz file with a single file in it. but thats not what #66 implements. Although in lefthooks case, it ALSO has bare/raw exectuable files as artifacts. for every os/arch it has 2 artifacts, a raw executable, which is implemented in #66, and also a .gz file, which is simply the same format as the other compressed formats, .zip,.tar.gz etc.
https://github.com/evilmartians/lefthook/releases/download/v1.7.14/lefthook_1.7.14_Windows_x86_64.exe and https://github.com/evilmartians/lefthook/releases/download/v1.7.14/lefthook_1.7.14_Windows_x86_64.gz
are 2 of the same artifacts from lefthook with different filetypes. 1 raw and 1 zipped.
Another unrelated bug I found, is if you add a tool, using rokit add ...
and it fails to extract the asset, like with lefthook right now, it still keeps it in rokit.toml and thus leaves it in a broken state. I feel like it should only update the toml file if an add/install is successful
I kinda need the feature so I made a PR #73 . would be awesome if you could review it
I'm trying to install lefthook for better pre-commit hook support, but rokit cant properly identify the right asset, but there are definitely assets that feel like they should be compatible:
https://github.com/evilmartians/lefthook/releases/tag/v1.7.14
(I'm on windows)