-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
28 lines (26 loc) · 842 Bytes
/
index.ts
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
import semver from 'semver'
import minimist from 'minimist'
import version from './version'
import chalk from 'chalk'
import { log } from './src/utils/log'
import { mapper } from './src/utils/cmdList'
const node_version = process.version.replace(/-.*$/, '')
const valid_version = semver.satisfies(node_version, '>= 16.x.x');
async function main() {
if (valid_version) {
const argv = minimist(process.argv.slice(2), { string: ['_'] })
// console.log(argv)
if ((argv.v || argv.version || argv._.includes('version')) == true) {
log.info("v" + version, '\n')
process.exit(0)
}
log.info("running on mcb", "v" + version)
const cmd = mapper(argv._[0])
if (cmd) {
await cmd.exec(argv)
} else {
console.log()
}
}
}
main()