/** * `tdcv2 init` — create a config file, by asking rather than by making the user * hand-write JSON. * * The point (Nick's): people want to generate data, not learn a config format. * So in a real terminal this runs a short wizard — where should the config * live, where do downloaded packs go, what default locale — and writes the file * for you. With no terminal (a script, CI) it falls back to flags, so it stays * scriptable and testable. * * The wizard itself is a thin shell; the decisions it makes are pure functions * below, which is what the tests exercise. Inquirer is imported lazily so the * ordinary render path never pays for it. */ export interface InitPlan { /** Absolute path of the config file to write. */ readonly path: string; /** Where downloaded packs should live — one folder, whatever is installed. */ readonly packStore: string; /** Default locale. */ readonly locale: string; /** True for the global (per-user) config, false for a project one. */ readonly global: boolean; } export interface InitContext { readonly cwd: string; readonly home?: string | undefined; readonly platform?: NodeJS.Platform | undefined; readonly env?: NodeJS.ProcessEnv | undefined; } /** Where the config file goes: project `./tdcv2.config.json`, or the global path. */ export declare function configTargetPath(global: boolean, ctx: InitContext): string; /** * The default pack-store folder. A project keeps packs beside its config * (`./tdcv2-packs`); the global config keeps them next to itself * (`/packs`), so everything for a user sits together. */ export declare function defaultPackStore(global: boolean, configPath: string, ctx: InitContext): string; /** * The config file's JSON. The store is written as `packStore` (NOT `dataPaths`): * it is where `pack add` downloads to, and it is not a scan root until there is * something in it — the first `pack add` registers the store itself, once, for * every bundle that will ever land there. A project config writes the store * RELATIVE (portable across machines and check-in-friendly); a global config * uses the absolute path (it is machine-specific by nature). */ export declare function buildConfigContent(plan: InitPlan): string; export declare class InitError extends Error { readonly name = "InitError"; } /** * Write the config (and create the pack-store folder). Refuses to clobber an * existing config unless `force`, so a second `init` does not silently wipe * settings. */ export declare function writeInitConfig(plan: InitPlan, opts: { force: boolean; }): void; /** Where `init` puts the worked examples, beside the config it writes. */ export declare const EXAMPLES_DIR_NAME = "tdcv2-examples"; /** * Write the worked examples next to the config, and return what was written. * * `init` used to leave a reader with a config file and no way to see output: it * printed "Next: run `tdcv2 pack`" and there was still no `.tdc` anywhere. Every * documented first command named a `demo.tdc` that nothing created, so the very * first command a newcomer typed could only fail. */ export declare function writeExamples(intoDir: string): readonly string[]; /** Run `tdcv2 init`. Returns a process exit code. */ export declare function runInit(argv: readonly string[], ctx: InitContext): Promise; //# sourceMappingURL=init.d.ts.map