forked from brave/brave-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.js
More file actions
54 lines (44 loc) · 1.45 KB
/
sync.js
File metadata and controls
54 lines (44 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const path = require('path')
const program = require('commander');
const fs = require('fs-extra')
const config = require('../lib/config')
const util = require('../lib/util')
const projectNames = config.projectNames.filter((project) => config.projects[project].ref)
program
.version(process.env.npm_package_version)
.option('--gclient_file <file>', 'gclient config file location')
.option('--gclient_verbose', 'verbose output for gclient')
.option('--run_hooks', 'run gclient hooks')
.option('--run_sync', 'run gclient sync')
.option('--submodule_sync', 'run submodule sync')
.option('--init', 'initialize all dependencies')
.option('--all', 'update all projects')
projectNames.forEach((name) => {
let project = config.projects[name]
program.option('--' + project.arg_name + '_ref <ref>', name + ' ref to checkout')
})
program.parse(process.argv)
config.update(program)
if (program.init || program.submodule_sync) {
util.submoduleSync()
}
if (program.init) {
util.buildGClientConfig()
}
if (program.init) {
util.gclientSync(true)
}
let updatedVersion = false
projectNames.forEach((name) => {
let project = config.projects[name]
if (program.init || program.all || program[project.arg_name + '_ref']) {
updatedVersion = true
util.setDepVersion(project.dir, project.ref)
}
})
if (updatedVersion || program.init || program.run_sync) {
util.gclientSync()
}
if (updatedVersion || program.init || program.run_hooks) {
util.gclientRunhooks()
}