napi-rs/src/index.ts

33 lines
727 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'
import { PrePublishCommand } from './pre-publish'
import { VersionCommand } from './version'
2020-07-27 00:53:09 +09:00
const cli = new Cli({
binaryName: 'bin',
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)
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)
})