MCPcopy Index your code
hub / github.com/darkreader/darkreader / getLastCommitTime

Function getLastCommitTime

tasks/zip.js:43–50  ·  view source on GitHub ↗

* Reproducible builds: set file timestamp to last commit timestamp * Returns the date of the last git commit to be used as archive file timestamp * @returns {Promise } JavaScript Date object with date adjusted to counterbalance user's time zone

()

Source from the content-addressed store, hash-verified

41 * @returns {Promise<Date>} JavaScript Date object with date adjusted to counterbalance user's time zone
42 */
43async function getLastCommitTime() {
44 // We need to offset the user's time zone since yazl can not represent time zone in produced archive
45 // If called outside of the git tree, make sure we don't pass a negative date.
46 return new Promise((resolve) =>
47 exec('git log -1 --format=%ct', (_, stdout) => resolve(new Date(
48 Math.max(0, Number(stdout) + (new Date()).getTimezoneOffset() * 60) * 1000
49 ))));
50}
51
52async function zip({platforms, debug, version}) {
53 if (debug) {

Callers 1

zipFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected