1 | import type { PackageJSON } from './types';
|
2 | /**
|
3 | * Send a string to lowercase
|
4 | * @param str the string to lowercase
|
5 | * @returns the lowercased string
|
6 | */
|
7 | export declare const toLowerCase: (str: string) => string;
|
8 | /**
|
9 | * Convert a string using dash-case to PascalCase
|
10 | * @param str the string to convert to PascalCase
|
11 | * @returns the PascalCased string
|
12 | */
|
13 | export declare const dashToPascalCase: (str: string) => string;
|
14 | /**
|
15 | * Flattens a two-dimensional array into a one dimensional array
|
16 | * @param array the array to flatten
|
17 | * @returns the flattened array
|
18 | */
|
19 | export declare function flatOne<T>(array: T[][]): T[];
|
20 | /**
|
21 | * Sorts a provided array by a property belonging to an item that exists on each item in the array
|
22 | * @param array the array to sort
|
23 | * @param prop a function to look up a field on an entry in the provided array
|
24 | * @returns a shallow copy of the array, sorted by the property resolved by `prop`
|
25 | */
|
26 | export declare function sortBy<T>(array: ReadonlyArray<T>, prop: (item: T) => string): ReadonlyArray<T>;
|
27 | /**
|
28 | * Normalize a path
|
29 | * @param str the path to normalize
|
30 | * @returns the normalized path
|
31 | */
|
32 | export declare function normalizePath(str: string): string;
|
33 | /**
|
34 | * Generate the relative import from `pathFrom` to `pathTo`
|
35 | * @param pathFrom the path that shall be used as the origin in determining the relative path
|
36 | * @param pathTo the path that shall be used as the destination in determining the relative path
|
37 | * @param ext an extension to remove from the final path
|
38 | * @returns the derived relative import
|
39 | */
|
40 | export declare function relativeImport(pathFrom: string, pathTo: string, ext?: string): string;
|
41 | /**
|
42 | * Attempts to read a `package.json` file at the provided directory.
|
43 | * @param rootDir the directory to search for the `package.json` file to read
|
44 | * @returns the read and parsed `package.json` file
|
45 | */
|
46 | export declare function readPackageJson(rootDir: string): Promise<PackageJSON>;
|