Created
February 8, 2021 17:53
-
-
Save enjalot/688b9026ed865a790bfb390fca9c9b67 to your computer and use it in GitHub Desktop.
a set of scripts to pull the git history from the d3 git repositories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fs = require("fs") | |
let {exec} = require("child_process") | |
// read package.json | |
let packageText = fs.readFileSync("./d3/package.json").toString() | |
let packageJson = JSON.parse(packageText) | |
// loop through dependencies | |
let depends = Object.keys(packageJson.dependencies) | |
console.log("dependencies", depends) | |
// clone each repo | |
depends.forEach(repo => { | |
let command = `git clone https://github.com/d3/${repo}.git` | |
exec(command, (error, stdout, stderr) => { | |
// TODO: handle errors. | |
}) | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fs = require("fs") | |
let {exec} = require("child_process") | |
// read package.json | |
let packageText = fs.readFileSync("./d3/package.json").toString() | |
let packageJson = JSON.parse(packageText) | |
// loop through dependencies | |
let depends = Object.keys(packageJson.dependencies) | |
console.log("dependencies", depends) | |
// clone each repo | |
//let repo = "d3" | |
let commits = [] | |
depends.forEach(repo => { | |
let txt = fs.readFileSync(`data/${repo}.001.json`).toString() | |
let json = JSON.parse(txt) | |
json.forEach(c => { | |
c.repo = repo | |
commits.push(c) | |
}) | |
}) | |
fs.writeFileSync(`data/combined.001.json`, JSON.stringify(commits)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fs = require("fs") | |
let {exec} = require("child_process") | |
// read package.json | |
let packageText = fs.readFileSync("./d3/package.json").toString() | |
let packageJson = JSON.parse(packageText) | |
// loop through dependencies | |
let depends = Object.keys(packageJson.dependencies) | |
console.log("dependencies", depends) | |
// clone each repo | |
//let repo = "d3" | |
depends.forEach(repo => { | |
let txt = fs.readFileSync(`data/${repo}.001.🔪sv`).toString() | |
lines = txt.split("☕") | |
commits = lines.slice(1).map(line => { | |
let l = line.split("🔪"); | |
return { | |
hash: l[0], | |
date: l[1], | |
author: l[2], | |
subject: l[3], | |
body: l[4] | |
}; | |
}) | |
fs.writeFileSync(`data/${repo}.001.json`, JSON.stringify(commits)) | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fs = require("fs") | |
let {exec} = require("child_process") | |
// read package.json | |
let packageText = fs.readFileSync("./d3/package.json").toString() | |
let packageJson = JSON.parse(packageText) | |
// loop through dependencies | |
let depends = Object.keys(packageJson.dependencies) | |
console.log("dependencies", depends) | |
// clone each repo | |
depends.forEach(repo => { | |
let command = `cd ${repo}; git log --pretty=format:"☕%h🔪%ad🔪%an🔪%s🔪%b" --date="iso" --no-merges --compact-summary > ../data/${repo}.001.🔪sv` | |
exec(command, (error, stdout, stderr) => { | |
// TODO: handle errors. | |
}) | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's an updated version that includes commits from the original
d3
repo: https://gist.github.com/curran/18287ef2c4b64ffba32000aad47c292b