#!/usr/bin/env node import { type AuthChoice } from "./auth.js"; import { type DbChoice } from "./db.js"; declare const TEMPLATES: { readonly api: "../template"; readonly site: "../template-site"; readonly isr: "../template-isr"; readonly batteries: "../template-batteries"; }; export type TemplateName = keyof typeof TEMPLATES; /** Frontend frameworks the `site` template can scaffold. React is the default (`template-site`); the * rest live in `template-site-` siblings - same multi-target deploy story, different adapter * + routes. */ declare const FRAMEWORKS: readonly ["react", "preact", "vue", "solid", "svelte"]; export type Framework = (typeof FRAMEWORKS)[number]; /** * Deploy targets for the multi-target `site` template. Every target's build + server entry already ships * in the template; choosing one repoints the canonical `build`/`deploy` scripts at it (the per-target * `build:*` scripts stay, so you can still switch). nifra never runs the deploy or enters credentials - * `deploy` shells out to the vendor CLI you've authed yourself. */ interface DeployPreset { readonly label: string; readonly build: string; /** `deploy` script; `NAME` is replaced with the app directory name. */ readonly deploy: string; readonly steps: readonly string[]; } /** * Build a GitHub Actions workflow that builds on every push/PR and deploys `target` on a push to `main`. * Reuses the canonical `bun run build` (the deploy preset repoints it), then runs the target's official * deploy mechanism. Exported for unit tests. Throws on an unknown target. */ export declare function githubDeployWorkflow(target: string, appName: string): string; export interface ScaffoldOptions { /** Destination directory. */ readonly target: string; /** Template to copy. Default `"api"`. */ readonly template?: TemplateName; /** Frontend framework (site template only). Default `"react"`. */ readonly framework?: string; /** Deploy target (site template only) - repoints the default `build`/`deploy` scripts. */ readonly deploy?: string; /** Emit a CI deploy workflow for the chosen `--deploy` target. Only `"github"` today. */ readonly ci?: string; /** Wire a data layer: `drizzle-{libsql,postgres,sqlite}` | `prisma-{postgres,sqlite}` | `kysely-postgres`. */ readonly db?: string; /** Wire authentication: `better-auth` (requires `--db` - auth needs a database). */ readonly auth?: string; /** Allow scaffolding into a non-empty directory (copies template, overwrites collisions). */ readonly force?: boolean; /** Path to a local nifra monorepo - replaces `@nifrajs/*` semver deps with `file:` refs so * the app runs against the local source before the packages are published to npm. */ readonly link?: string; } export interface ScaffoldResult { readonly name: string; readonly template: TemplateName; readonly framework?: Framework; readonly deploy?: DeployPreset; /** The CI provider a workflow was generated for, when `--ci` was passed. */ readonly ci?: "github"; /** Repo secrets the generated workflow needs (for the next-steps message). */ readonly ciSecrets?: readonly string[]; /** The Drizzle preset wired in, when `--db` was passed. */ readonly db?: DbChoice; /** The auth preset wired in, when `--auth` was passed. */ readonly auth?: AuthChoice; /** Local nifra monorepo path when `--link` was used; undefined when using published packages. */ readonly link?: string; } /** * Copy a template into `target` and finalize it (gitignore rename, package name, optional deploy preset). * Throws on: unknown template, `--deploy` with a non-site template, unknown deploy target, or an existing * destination. Pure enough to unit-test (no argv, no process.exit). */ export declare function scaffold(opts: ScaffoldOptions): Promise; interface ParsedArgs { readonly target?: string; readonly template?: TemplateName; readonly framework?: string; readonly deploy?: string; readonly ci?: string; readonly db?: string; readonly auth?: string; readonly force?: boolean; readonly link?: string; } /** Parse `[dir] [--template|-t ] [--framework|-f ] [--deploy|-d ] [--ci|-c github] * [--db ] [--auth ] [--force] [--link ]`. * `--framework`/`--deploy`/`--ci` all default the template to `site`. */ export declare function parseArgs(argv: readonly string[]): ParsedArgs; /** * Run the CLI for `argv` and return the exit code + the message to print - no `process.exit`, `console`, * or `process.argv`, so the whole flow (parse → scaffold → next-steps) is unit-testable in-process. */ export declare function run(argv: readonly string[]): Promise<{ code: 0 | 1; message: string; }>; export {}; //# sourceMappingURL=cli.d.ts.map