/** * Helper functions for creating TypeScript project scripts. * * @module */ /** * The type of the function passed to the `script` helper function. (And the related helper * functions.) */ export type ScriptCallback = ( /** The full path to the directory where the closest "package.json" is located. */ packageRoot: string) => Promise | void; /** * Removes the "dist" directory (if it exists), then runs the provided logic. * * For more information, see the documentation for the `script` helper function. */ export declare function buildScript(importMetaDirname: string, func: ScriptCallback): Promise; /** See the documentation for the `script` helper function. */ export declare function lintScript(importMetaDirname: string, func: ScriptCallback): Promise; /** See the documentation for the `script` helper function. */ export declare function testScript(importMetaDirname: string, func: ScriptCallback): Promise; /** * Helper function to create a script for a TypeScript project. You can pass any arbitrary logic you * want. * * This is intended to be used with the `$` function from either `execa` or `Bun` so that you can * make a TypeScript script in the style of a Bash script. * * (This function will work in both the Node.js and Bun runtimes.) * * Specifically, this helper function will: * * 1. Change the working directory to where the nearest "package.json" file is. * 2. Run the provided function. * 3. Print a success message with the total amount of seconds taken (if a verb was provided and * there is not a quiet/silent flag). * * @param importMetaDirname The value of `import.meta.dirname` (so that this function can find the * package root). * @param func The function that contains the build logic for the particular script. This is passed * the path to the package root. (See the `ScriptCallbackData` interface.) * @param verb Optional. The verb for when the script completes. For example, "built". * @throws If the provided function fails. */ export declare function script(importMetaDirname: string, func: ScriptCallback, verb?: string): Promise; /** The type given to the `lintCommands` helper function. */ export type LintCommand = string | readonly [name: string, promise: Promise]; /** * Helper function to run a series of concurrent lint commands. Nice console output will be shown * with the "listr2" library. * * @param importMetaDirname The value of `import.meta.dirname` (so that this function can find the * package root). * @param commands Optional. The commands or functions to run. Defaults to the standard tools that * are listed in the documentation for `complete-lint`: * https://complete-ts.github.io/complete-lint#step-5---create-a-lint-script * @param quiet Optional. If true, will not print the time taken. Defaults to false. */ export declare function lintCommands(importMetaDirname: string, commands?: readonly LintCommand[], quiet?: boolean): Promise; /** * Helper function to print a success message with the number of elapsed seconds. * * @param startTime The start time in milliseconds (as recorded by the `Date.now` method). * @param verb The verb to print. For example, "built". * @param noun The noun to print. For example, "foo". */ export declare function printSuccess(startTime: number, verb: string, noun: string): void; /** * Alias for "console.log". * * @allowEmptyVariadic */ export declare function echo(...args: readonly unknown[]): void; /** Alias for "process.exit". */ export declare function exit(code?: number): never; /** * Helper function to sleep for a certain number of seconds. * * Under the hood, this uses promises with `setTimeout`. */ export declare function sleep(seconds: number): Promise; //# sourceMappingURL=scriptHelpers.d.ts.map