napi-rs/cli/src/index.ts

43 lines
1 KiB
TypeScript
Raw Normal View History

2022-02-08 10:57:22 +09:00
import 'core-js/es/string/replace-all'
2020-07-27 00:53:09 +09:00
import { Cli } from 'clipanion'
2021-11-19 15:58:21 +09:00
import { version } from '../package.json'
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'
2022-11-02 11:56:34 +09:00
import { HelpCommand } from './help'
2021-09-02 00:21:11 +09:00
import { NewProjectCommand } from './new'
2020-09-04 17:22:15 +09:00
import { PrePublishCommand } from './pre-publish'
import { RenameCommand } from './rename'
2022-12-15 19:18:08 +09:00
import { UniversalCommand } from './universal'
2020-09-04 17:22:15 +09:00
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',
2021-11-19 15:58:21 +09:00
binaryVersion: version,
2020-07-27 00:53:09 +09:00
})
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)
2022-12-15 19:18:08 +09:00
cli.register(UniversalCommand)
2021-09-02 00:21:11 +09:00
cli.register(NewProjectCommand)
cli.register(RenameCommand)
2022-11-02 11:56:34 +09:00
cli.register(HelpCommand)
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)
})