Created
February 11, 2020 10:03
-
-
Save nodew/2e8dc022fb97b9bdc2156c7f6ec32e84 to your computer and use it in GitHub Desktop.
clone all d3 packages to local dev box
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
const fs = require("fs"); | |
const path = require("path"); | |
const cp = require("child_process"); | |
const clone = (package) => { | |
if (!fs.existsSync(package)) { | |
console.log(`Start to clone ${package}`); | |
cp.execSync(`git clone https://github.com/d3/${package}.git --depth=1`); | |
} | |
} | |
clone("d3"); | |
const packageFile = fs.readFileSync(path.join(__dirname, "d3", "package.json"), { encoding: "utf8" }); | |
if (packageFile) { | |
dependencies = (JSON.parse(packageFile)).dependencies; | |
packages = Object.keys(dependencies); | |
packages.forEach(package => { | |
clone(package); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment