napi-rs/cli/src/index.ts

43 lines
1 KiB
TypeScript
Raw Normal View History

2022-02-08 09:57:22 +08:00
import 'core-js/es/string/replace-all'
2020-07-26 23:53:09 +08:00
import { Cli } from 'clipanion'
2021-11-19 14:58:21 +08:00
import { version } from '../package.json'
2020-09-04 16:22:15 +08:00
import { ArtifactsCommand } from './artifacts'
2020-07-26 23:53:09 +08:00
import { BuildCommand } from './build'
2020-09-04 16:22:15 +08:00
import { CreateNpmDirCommand } from './create-npm-dir'
2022-11-02 10:56:34 +08:00
import { HelpCommand } from './help'
2021-09-01 23:21:11 +08:00
import { NewProjectCommand } from './new'
2020-09-04 16:22:15 +08:00
import { PrePublishCommand } from './pre-publish'
import { RenameCommand } from './rename'
2022-12-15 12:18:08 +02:00
import { UniversalCommand } from './universal'
2020-09-04 16:22:15 +08:00
import { VersionCommand } from './version'
2020-07-26 23:53:09 +08:00
const cli = new Cli({
2020-12-23 22:43:43 +08:00
binaryName: 'napi',
2021-11-19 14:58:21 +08:00
binaryVersion: version,
2020-07-26 23:53:09 +08:00
})
2020-09-04 16:22:15 +08:00
cli.register(ArtifactsCommand)
2020-07-26 23:53:09 +08:00
cli.register(BuildCommand)
2020-09-04 16:22:15 +08:00
cli.register(CreateNpmDirCommand)
cli.register(PrePublishCommand)
cli.register(VersionCommand)
2022-12-15 12:18:08 +02:00
cli.register(UniversalCommand)
2021-09-01 23:21:11 +08:00
cli.register(NewProjectCommand)
cli.register(RenameCommand)
2022-11-02 10:56:34 +08:00
cli.register(HelpCommand)
2020-07-26 23:53:09 +08:00
cli
.run(process.argv.slice(2), {
...Cli.defaultContext,
})
2020-09-04 16:22:15 +08:00
.then((status) => {
process.exit(status)
})
2020-07-26 23:53:09 +08:00
.catch((e) => {
console.error(e)
process.exit(1)
})