@alessiofrittoli/node-scripts
Version:
Utility library with common Node.js scripts
52 lines (48 loc) • 2.07 kB
TypeScript
import { Package } from '../types.js';
interface AddTypesReferenceOptions {
/** The project name currently executing the script. */
name: string;
/** The `*.d.ts` output file name. Default: `alessiofrittoli-env.d.ts`. */
outputFile?: string;
}
/**
* Common options for types-reference scripts.
*
*/
interface CommonOptions extends Package {
/** The output file name. */
outputFile: string;
}
/**
* Creates or updates a reference file with type definitions for a project.
*
* @param options - Common options for the reference file creation.
* @param options.root - The root directory of the project.
* @param options.name - The name of the project.
* @param options.outputFile - The name of the output file to create or update.
* @returns `void` if the operation was successful.
* @throws Throws an Error if there is an issue creating or updating the file.
*/
declare const createReferenceFile: (options: CommonOptions) => true | undefined;
/**
* Updates the `tsconfig.json` file by adding the specified output file to the `include` array.
*
* @param options - The options for updating the `tsconfig.json` file.
* @param options.root - The root directory of the project.
* @param options.name - The name of the project.
* @param options.outputFile - The file to be added to the `include` array in the `tsconfig.json`.
*
* @throws Throws an Error if the `tsconfig.json` file cannot be read or updated.
*/
declare const updateTsConfig: (options: CommonOptions) => void;
/**
* Adds a TypeScript reference file and updates the tsconfig.json for the given project.
*
* @param options - The options for adding the types reference.
* @param options.outputFile - The name of the output file to create. Defaults to 'alessiofrittoli-env.d.ts'.
* @param options.name - The name of the project.
*
* @throws Will throw an error if the process fails.
*/
declare const addTypesReference: (options: AddTypesReferenceOptions) => void;
export { type AddTypesReferenceOptions, addTypesReference, createReferenceFile, updateTsConfig };