Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init(dist){
console.log(chalk.green(`creating ${dist}......`));
Git.Clone("https://github.com/leinov/wnow", dist).then(()=>{
fs.removeSync(path.resolve(dist,"bin"));
fs.removeSync(path.resolve(dist,".git"));
fs.removeSync(path.resolve(dist,"LICENSE"));
fs.removeSync(path.resolve(dist,".gitignore"));
console.log(chalk.blueBright(`${dist} created success !`));
});
}
/*eslint-env node*/
/*eslint no-console: 0*/
var rimraf = require('rimraf')
var git = require('nodegit')
rimraf.sync('upstream/prefixfree')
git
.Clone('https://github.com/leaverou/prefixfree.git', 'upstream/prefixfree')
.then(
function(/*repository*/) {
process.exit(0)
}, function(e) {
console.error(e)
process.exit(1)
}
)
const cloneRepository = state => {
console.log('Attempting to clone a fresh copy');
return Git.Clone(state.url, state.output).then(repo => {
state.repo = repo;
return state;
}).catch(ex => {
console.log(`The repository ${state.output} aready exists`);
throw state;
});
};
function getCommit(repo, branch) {
return Git.Clone(repo, '.tmp')
.then(function (repo) {
return repo.getBranchCommit(branch);
});
}
async function generateDocumentation(versions, tempDir) {
const repo = await git.Clone(REPO_URL, tempDir);
for (let version of versions) {
console.log('Clone repository into tmp directory');
await checkoutVersion(repo, version);
if (lt(version, '7.3.4')) {
fixMarkdownForPre7_3_4_versions(tempDir);
}
if (lt(version, '7.3.6')) {
fixVersionsFileForPre7_3_5_versions(tempDir);
}
generateAndCopyDocusaurusVersion(tempDir, version);
repo.cleanup(tempDir);
console.log(`Done with ${version}\n\n`);
}
}
function cloneRepository(index) {
let repo = repos[index];
console.log('Cloning ' + repo.full_name);
nodegit.Clone(repo.links.clone[0].href, 'repositories/' + repo.full_name, opts)
.then(function(repo) {
if (repos.length - 1 == index) {
console.log("All repositories cloned");
} else {
cloneRepository(index + 1);
}
})
.catch(function(err) {
if (err) {
console.log(err);
}
if (err.errno === -4) {
console.warn("Skipping existing repository");
cloneRepository(index + 1);
}
this.save(function (err, p) {
repo = p.getRepoPath();
tmp_repo = randomstring.generate(8);
tmp_repo = path.join(TMP_DIR, tmp_repo);
git.Clone(p.git_url, tmp_repo).then(function (repository) {
fse.remove(repo, function (err) {
if (err) return callback(err);
fse.move(tmp_repo, repo, function (err) {
if (err) return callback(err);
p.updateInfo(path.join(repo, "prob.json"), function () {
if (err) return callback(err);
data_path = path.join(TESTDATA_DIR, p.data);
zipFolder(repo, data_path, function (err) {
if (err) callback(err);
md5File(data_path, function(err, hash) {
p.data_md5 = hash;
p.status = "Success";
p.save(callback);
});
});
});