Initial commit

This commit is contained in:
2024-11-03 17:41:45 +01:00
commit c1640c1754
8043 changed files with 775536 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import spawn from "cross-spawn";
function getGitFirstAddedTimeStamp(filePath) {
return (
parseInt(
spawn
.sync(
"git",
// Formats https://www.git-scm.com/docs/git-log#_pretty_formats
// %at author date, UNIX timestamp
["log", "--diff-filter=A", "--follow", "-1", "--format=%at", filePath],
)
.stdout.toString("utf-8"),
) * 1000
);
}
// return a Date
export default function (inputPath) {
let timestamp = getGitFirstAddedTimeStamp(inputPath);
if (timestamp) {
return new Date(timestamp);
}
}