Skip to content

Commit 6e6b5f7

Browse files
committed
Don't try to pull as it might not work. Instead always clone from scratch. Also use shallow copy for faster clone.
1 parent 973f716 commit 6e6b5f7

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# DevTools Docs
22

3-
These are scripts that *render* and publish the docs, which are hosted elsewhere (currently in the `docs/` folder in another repository).
3+
These are scripts that download the sources, *render* and publish the docs, which are hosted elsewhere (currently in the `docs/` folder in [this repository](https://github.com/ochameau/ff-dt/)).
44

55
```bash
66
npm install

update-repo.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ let shell = require('shelljs');
44
let config = require('./config.js');
55

66
let repo_path = path.join(__dirname, config.directory);
7-
let git_clone_command = `git clone ${config.address} --single-branch`;
8-
let git_update_command = `git pull origin master`;
7+
// depth=1 creates a shallow clone, which reduces download time from ~1m to ~20seconds!
8+
let git_clone_command = `git clone ${config.address} --single-branch --depth=1`;
99

1010
if (!shell.which('git')) {
1111
shell.echo('Sorry, this script requires git');
1212
shell.exit(1);
1313
}
1414

15-
var command;
15+
let command = git_clone_command;
1616

17-
if(!fs.existsSync(repo_path)) {
18-
command = git_clone_command;
19-
} else {
20-
command = git_update_command;
17+
// Due to the way the repo we use is imported from Mercurial,
18+
// git pull doesn't work, so we'll just delete and clone again :-o
19+
if(fs.existsSync(repo_path)) {
20+
console.log('Repo found, deleting old copy');
21+
shell.rm('-Rf', repo_path);
2122
}
2223

2324
// By checking the output and returning a non zero exit code

0 commit comments

Comments
 (0)