This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-cli/src/index.ts
2021-08-04 15:32:19 +08:00

52 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
import commander from "commander"
import { build, clean } from "./actions";
import { create, createLib } from "./create"
import dev from "./dev"
import { run } from "./run";
(process.env.FORCE_COLOR as any) = true
commander
.command('create <name>')
.action(async function (name, cmd) {
await create(name);
})
commander
.command('createLib <name>')
.action(async function (name, cmd) {
await createLib(name);
})
commander
.command('new <name>')
.action(async function (name, cmd) {
await create(name);
})
commander
.command('dev')
.action(async function () {
await dev()
})
commander
.command('build')
.action(async function () {
const ret = await build();
if (ret != 0) {
process.exit(ret)
}
})
commander
.command('clean')
.action(async function () {
await clean();
})
commander
.command('run <platform>')
.action(async function (platform, cmd) {
await run(platform);
})
commander.parse(process.argv)