-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Description
When installing deno-hooks from JSR using deno run -A jsr:@theswanfactory/deno-hooks/install, the generated git hook files contain invalid file paths.
Steps to Reproduce
- Add deno-hooks as a dependency in
deno.json:
"imports": {
"deno-hooks": "jsr:@theswanfactory/deno-hooks@^0.2.0"
}- Run the installer:
deno run -A deno-hooks- Check the generated hook file:
cat .git/hooks/pre-commitExpected Behavior
The hook should contain a valid path to the JSR-installed module, such as:
exec deno run -A "jsr:@theswanfactory/deno-hooks@0.2.0/src/run.ts" "pre-commit" "$@"Or use the import map alias:
exec deno run -A "deno-hooks/run.ts" "pre-commit" "$@"Actual Behavior
The generated hook contains an invalid absolute path:
exec deno run -A "/@theswanfactory/deno-hooks/0.2.0/src/run.ts" "pre-commit" "$@"Error When Hook Runs
error: Module not found "file:///@theswanfactory/deno-hooks/0.2.0/src/run.ts"
Environment
- deno-hooks version: 0.2.0
- Deno version: (latest)
- OS: macOS (Darwin 24.6.0)
Workaround
Currently using git commit --no-verify to bypass hooks.
Suggested Fix
The installer should detect when running from JSR and generate hook paths that use either:
- The full JSR specifier:
jsr:@theswanfactory/deno-hooks@0.2.0/src/run.ts - The import map alias if available:
deno-hooks/run.ts - The actual filesystem path from the Deno cache
The path generation logic likely needs to handle import.meta.url differently when the module is loaded from JSR vs a local filesystem.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels