module.exports = function initialCommitDate (cwd, cb) { let opts = { cwd: cwd }; if (typeof cwd === "function") { cb = cwd; delete opts.cwd; } spawn("git", oargv({ pretty: "format:%ad" , "max-parents": "0" , __: "=" }, "log"), opts, (err, stdout, stderr) => { err = err || stderr; if (err) { return cb(new Error(err)); } let str = stdout.trim().split("\n").slice(-1)[0]; if (!str) { return cb(new Error("Cannot find the first commit date.")); } let d = new Date(str); if (dateIsInvalid(d)) { return cb(new Error("The date is invalid.")); } cb(null, d); }); };
module.exports = function spawnNpm (command, options, spawnOptions, cb) { if (typeof options === "function") { cb = options; options = {}; spawnOptions = {}; } if (typeof spawnOptions === "function") { cb = spawnOptions; spawnOptions = {}; } if (typeof options === "string") { spawnOptions = options; options = {}; } if (typeof spawnOptions === "string") { spawnOptions = { cwd: spawnOptions }; } spawnOptions = spawnOptions || {}; options = options || {}; let args = oargv(options, command); return spawn("npm", args, spawnOptions, cb); };
}, function (next) { if (!input.hash) { return next(); } repo.exec("checkout", oArgv({ _: [input.hash] }), next); }, function (next) {
}, function (next) { repo.exec("clone", oArgv({ _: [input.toString(), "."], depth: input.hash ? undefined : "1" }), next); }, function (next) {