()
| 2 | import type { UserTinyPagesConfig } from "../../types/types"; |
| 3 | |
| 4 | export async function cli() { |
| 5 | const cli = cac("tinypages"); |
| 6 | cli |
| 7 | .option("-c, --config", `[boolean] use specified config file`) |
| 8 | .option("--base <path>", `[string] public base path (default: /)`) |
| 9 | .option("-l, --logLevel <level>", `[string] info | warn | error | silent`) |
| 10 | .option( |
| 11 | "--clearScreen", |
| 12 | `[boolean] allow/disable clear screen when logging` |
| 13 | ) |
| 14 | .option("-d, --debug [feat]", `[string | boolean] show debug logs`) |
| 15 | .option("-f, --filter <filter>", `[string] filter debug logs`) |
| 16 | .option("-m, --mode <mode>", `[string] set env mode`); |
| 17 | |
| 18 | // dev |
| 19 | cli |
| 20 | .command("[root]") |
| 21 | .alias("dev") |
| 22 | .alias("serve") |
| 23 | .alias("start") |
| 24 | .option("--https", `[boolean] use TLS + HTTP/2`) |
| 25 | .option("--open [path]", `[boolean | string] open browser on startup`) |
| 26 | .option("--cors", `[boolean] enable CORS`) |
| 27 | .option( |
| 28 | "--strictPort", |
| 29 | `[boolean] exit if specified port is already in use` |
| 30 | ) |
| 31 | .option( |
| 32 | "--force", |
| 33 | `[boolean] force the optimizer to ignore the cache and re-bundle` |
| 34 | ) |
| 35 | .action(async (root = process.cwd(), opts) => { |
| 36 | await (await import("./commands/dev")).devAction(root, opts); |
| 37 | }); |
| 38 | |
| 39 | cli |
| 40 | .command("build [root]", "build for production") |
| 41 | .option( |
| 42 | "--target <target>", |
| 43 | `[string] transpile target (default: 'modules')` |
| 44 | ) |
| 45 | .option("--outDir <dir>", `[string] output directory (default: dist)`) |
| 46 | .option( |
| 47 | "--assetsDir <dir>", |
| 48 | `[string] directory under outDir to place assets in (default: assets)` |
| 49 | ) |
| 50 | .option( |
| 51 | "--assetsInlineLimit <number>", |
| 52 | `[number] static asset base64 inline threshold in bytes (default: 4096)` |
| 53 | ) |
| 54 | // .option( |
| 55 | // "--ssr [entry]", |
| 56 | // `[string] build specified entry for server-side rendering` |
| 57 | // ) // this just does not make sense with tinypagesF |
| 58 | // .option( |
| 59 | // "--sourcemap", |
| 60 | // `[boolean] output source maps for build (default: false)` |
| 61 | // ) // neither does this |
no outgoing calls
no test coverage detected