/** * scaffold.ts — Recipe-driven project scaffolding for create-litro. * * At runtime the compiled bin is dist/src/index.js and recipes live at * dist/recipes//. This module resolves recipe directories relative to * import.meta.url so it works regardless of CWD. * * No external dependencies — uses Node.js built-ins only. */ import type { LitroRecipe } from './types.js'; export interface ScaffoldOptions { projectName: string; mode: 'ssg' | 'ssr'; adapter?: 'lit' | 'fast' | 'elena'; recipeOptions?: Record; recipeVersion?: string; /** * Directory the recipes are read from. Defaults to the package's own * `dist/recipes/`. Tests point it at a fixture tree so the mechanics of * `extends` and of recipe options can be exercised without adding a recipe * that real users would then see in `--list-recipes`. */ recipesRoot?: string; } /** * The specifier `import()` needs for a recipe config at `configPath`. * * An absolute path is NOT a valid specifier for `import()`. On Windows, * `C:\...\recipe.config.js` parses as a URL with the scheme `c:`, and Node * throws ERR_UNSUPPORTED_ESM_URL_SCHEME. On every OS, a `#` or `%` in the path * is read as URL syntax, so a package installed under a folder such as `C#` cannot find * the file. A `file://` URL means the same thing everywhere. */ export declare function recipeConfigSpecifier(configPath: string): string; /** Called once for each recipe directory whose config failed to load. */ export type RecipeSkipHandler = (name: string, error: unknown) => void; /** * The default skip handler: one warning line per broken recipe, on stderr. * Without it, a config that fails to load leaves no trace, and when every * config fails the user sees only "no recipes available" (issue 218). */ export declare const warnSkippedRecipe: RecipeSkipHandler; /** * Return `LitroRecipe` objects for all recipe directories found under * dist/recipes/. Each recipe must have a `recipe.config.js` file that * exports a default `LitroRecipe`. * * A directory with no config is skipped quietly. A config that exists but * fails to import is skipped too, so one bad recipe does not stop the CLI, * but `onSkip` is told which one and why. */ export declare function listRecipes(recipesRoot?: string, onSkip?: RecipeSkipHandler): Promise; /** * Load a single recipe by name. Returns null if it has no config file. * Throws, naming the recipe, if the config exists but cannot be imported: * "not found" would send the user looking for the wrong problem. */ export declare function loadRecipe(name: string, recipesRoot?: string): Promise; /** * Resolve a recipe's `extends` chain into the layer order its templates are * copied in: the base recipe first, then the recipe itself. * * Returns `[recipeName]` for a recipe that extends nothing, and also for a * recipe directory with no readable config — a directory of templates alone * has always been enough to scaffold from, and that stays true. * * ONE LEVEL ONLY, and both failure modes throw rather than degrade: an unknown * base would otherwise scaffold a half-built app whose missing half is blamed * on the template, and a deeper chain would give four or more silent override * layers. */ export declare function resolveRecipeLineage(recipeName: string, recipesRoot?: string): Promise; /** * Scaffold a project from a recipe into `targetDir`. * * @param recipeName The recipe directory name (e.g. "fullstack"). * @param options Scaffold options (projectName, mode, etc.). * @param targetDir Absolute path to the target project directory. */ export declare function scaffold(recipeName: string, options: ScaffoldOptions, targetDir: string): Promise; //# sourceMappingURL=scaffold.d.ts.map