napi-rs/cli/src/index.ts

35 lines
802 B
TypeScript
Raw Normal View History

2020-08-21 23:28:10 +09:00
#!/usr/bin/env node
2020-07-27 00:53:09 +09:00
import { Cli } from 'clipanion'
2020-09-04 17:22:15 +09:00
import { ArtifactsCommand } from './artifacts'
2020-07-27 00:53:09 +09:00
import { BuildCommand } from './build'
2020-09-04 17:22:15 +09:00
import { CreateNpmDirCommand } from './create-npm-dir'
2020-12-16 01:04:11 +09:00
import { NewProjectCommand } from './new'
2020-09-04 17:22:15 +09:00
import { PrePublishCommand } from './pre-publish'
import { VersionCommand } from './version'
2020-07-27 00:53:09 +09:00
const cli = new Cli({
2020-12-23 23:43:43 +09:00
binaryName: 'napi',
2020-07-27 00:53:09 +09:00
binaryVersion: require('../package.json').version,
})
2020-09-04 17:22:15 +09:00
cli.register(ArtifactsCommand)
2020-07-27 00:53:09 +09:00
cli.register(BuildCommand)
2020-09-04 17:22:15 +09:00
cli.register(CreateNpmDirCommand)
2020-12-16 01:04:11 +09:00
cli.register(NewProjectCommand)
2020-09-04 17:22:15 +09:00
cli.register(PrePublishCommand)
cli.register(VersionCommand)
2020-07-27 00:53:09 +09:00
cli
.run(process.argv.slice(2), {
...Cli.defaultContext,
})
2020-09-04 17:22:15 +09:00
.then((status) => {
process.exit(status)
})
2020-07-27 00:53:09 +09:00
.catch((e) => {
console.error(e)
process.exit(1)
})