forked from nuxt/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
40 lines (37 loc) · 947 Bytes
/
Copy pathcli.ts
File metadata and controls
40 lines (37 loc) · 947 Bytes
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
import { sync, syncAll, build } from './modules'
import { version } from './version'
async function main() {
const [command, ...args] = process.argv.splice(2)
switch (command) {
case 'sync':
{
const [name, repo] = args
if (name) {
console.log('Syncing ' + (name === '-' ? repo : name))
const module = await sync(name, repo, true)
console.log('Synced', module.name)
}
else {
console.log('Syncing all modules')
const { count, success } = await syncAll()
console.log('Sync ' + count + ' modules')
if (!success)
process.exit(1)
}
}
break
case 'build':
await build()
break
case 'version':
await version()
break
default:
console.error('Unknown command: ' + command)
process.exit(1)
}
}
main().catch((err) => {
console.error(err)
process.exit(1)
})