Skip to content

Commit

Permalink
fix: high resolution time for mtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohe-Am committed Jan 1, 2025
1 parent b9a0679 commit 1689473
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
5 changes: 0 additions & 5 deletions docs/known-issues.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Known issues

## Cache invalidation of imported scripts

Currently, ghjk is unable to track changes to local typescript files imported by the ghjk.ts file.
You can force re-serialization of the ghjkfile by deleting the `.ghjk/hash.json` file.

## GitHub API rate-limit

The GitHub API is rate-limited to 60 calls per hour for unauthenticated requests.
Expand Down
8 changes: 5 additions & 3 deletions install/hook.fish
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
function __ghjk_get_mtime_ts
switch (uname -s | tr '[:upper:]' '[:lower:]')
case "linux"
stat -c "%Y" $argv
stat -c "%.Y" $argv
case "darwin"
stat -f "%Sm" -t "%s" $argv
# darwin stat doesn't support ms since epoch so we bring out the big guns
deno eval 'console.log((await Deno.stat(Deno.args[0])).mtime.getTime())' $argv
# stat -f "%Sm" -t "%s" $argv
case "*"
stat -c "%Y" $argv
stat -c "%.Y" $argv
end
end

Expand Down
4 changes: 3 additions & 1 deletion install/hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ __ghjk_get_mtime_ts () {
stat -c "%Y" "$1"
;;
"darwin")
stat -f "%Sm" -t "%s" "$1"
# darwin stat doesn't support ms since epoch so we bring out the big guns
deno eval 'console.log((await Deno.stat(Deno.args[0])).mtime.getTime())' "$1"
# stat -f "%Sm" -t "%s" "$1"
;;
"*")
stat -c "%Y" "$1"
Expand Down
5 changes: 3 additions & 2 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ exec ${ghjkExePath.resolve().toString()} "$@"`,
HOME: tmpDir.toString(),
GHJK_REPO_ROOT: import.meta.resolve("../"),
// share the system's deno cache
GHJK_DENO_DIR: Deno.env.get("DENO_DIR") ??
$.path(Deno.env.get("HOME")!).join(".cache", "deno").toString(),
GHJK_DENO_DIR: Deno.env.get("DENO_DIR")
? $.path(Deno.env.get("DENO_DIR")!).resolve().toString()
: $.path(Deno.env.get("HOME")!).resolve(".cache", "deno").toString(),
RUST_LOG: Deno.env.get("RUST_LOG"),
GHJK_LOG: Deno.env.get("GHJK_LOG"),
...testEnvs,
Expand Down

0 comments on commit 1689473

Please sign in to comment.